Commit beb5a099 by kalyanikk Committed by Suma Shivaprasad

ATLAS-1103 : UI: Search type list is not refreshed

parent 4fa10b6a
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div class="row row-margin-bottom"> <div class="row row-margin-bottom">
<div class="col-sm-12" style="margin:15px 0px;"> <div class="col-sm-12" style="margin:15px 0px;">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-6">
<span class="pull-left">Text</span> <span class="pull-left">Text</span>
<label class="switch pull-left"> <label class="switch pull-left">
<input type="checkbox" name="queryType" value="text"> <input type="checkbox" name="queryType" value="text">
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
</label> </label>
<span class="pull-left">DSL</span> <span class="pull-left">DSL</span>
</div> </div>
<div class="col-md-6">
<button class="btn btn-atlasAction btn-atlas pull-right typeLOV" title="Refresh" data-id="refreshBtn"><i class="fa fa-refresh"></i></button>
</div>
</div> </div>
</div> </div>
<div class="col-sm-12"> <div class="col-sm-12">
...@@ -32,7 +35,9 @@ ...@@ -32,7 +35,9 @@
<div class="typeLOV"> <div class="typeLOV">
<select data-id="typeLOV"></select> <select data-id="typeLOV"></select>
</div> </div>
<input type="text" class="form-control" data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact" style="margin-top: 5px;"> <div class="searchInputClick">
<input type="text" class="form-control" data-id="searchInput" placeholder="Search using a query string: e.g. sales_fact" style="margin-top: 5px;">
</div>
</div> </div>
<div class="clearAdvanceSearch" data-id="clearSearch">Clear</div> <div class="clearAdvanceSearch" data-id="clearSearch">Clear</div>
<button class="btn btn-atlas advanceSearchBtn" data-id="searchBtn" disabled="disabled">Search</button> <button class="btn btn-atlas advanceSearchBtn" data-id="searchBtn" disabled="disabled">Search</button>
......
...@@ -458,21 +458,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob ...@@ -458,21 +458,19 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
} }
return '<div class="tagList">' + atags + addTag + '<div class="popover popoverTag bottom" style="display:none"><div class="arrow"></div><div class="popover-content popoverContainer">' + popTag + '</div></div></div>'; return '<div class="tagList">' + atags + addTag + '<div class="popover popoverTag bottom" style="display:none"><div class="arrow"></div><div class="popover-content popoverContainer">' + popTag + '</div></div></div>';
} }
CommonViewFunction.saveTermToAsset = function(options) { CommonViewFunction.saveTermToAsset = function(options, that) {
require(['models/VCatalog'], function(Vcatalog) { require(['models/VCatalog'], function(Vcatalog) {
var VCatalog = new Vcatalog(); var VCatalog = new Vcatalog();
var name = options.termName; var name = options.termName;
VCatalog.url = function() { VCatalog.url = function() {
return "api/atlas/v1/entities/" + options.guid + "/tags/" + name; return "api/atlas/v1/entities/" + options.guid + "/tags/" + name;
}; };
++that.asyncFetchCounter;
VCatalog.save(null, { VCatalog.save(null, {
success: function(data) { success: function(data) {
Utils.notifySuccess({ Utils.notifySuccess({
content: "Term " + name + Messages.addTermToEntitySuccessMessage content: "Term " + name + Messages.addTermToEntitySuccessMessage
}); });
if (options.callback) {
options.callback();
}
if (options.collection) { if (options.collection) {
options.collection.fetch({ reset: true }); options.collection.fetch({ reset: true });
} }
...@@ -483,12 +481,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob ...@@ -483,12 +481,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
Utils.notifyError({ Utils.notifyError({
content: data.message || data.msgDesc content: data.message || data.msgDesc
}); });
if (options.callback) {
options.callback();
}
} }
}, },
complete: function() {} complete: function() {
--that.asyncFetchCounter
if (that.callback && that.asyncFetchCounter === 0) {
that.callback(); // It will call to parent of parent Callback i.e callback of searchLayoutView
}
}
}); });
}) })
} }
......
...@@ -61,6 +61,7 @@ define(['require', ...@@ -61,6 +61,7 @@ define(['require',
allowCancel: true, allowCancel: true,
}).open(); }).open();
this.on('ok', function() { this.on('ok', function() {
that.asyncFetchCounter = 0;
if (that.multiple) { if (that.multiple) {
for (var i = 0; i < that.multiple.length; i++) { for (var i = 0; i < that.multiple.length; i++) {
if (i == 0) { if (i == 0) {
...@@ -70,23 +71,14 @@ define(['require', ...@@ -70,23 +71,14 @@ define(['require',
termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""), termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
guid: that.multiple[i].id.id guid: that.multiple[i].id.id
} }
if (that.multiple.length - 1 == i) { CommonViewFunction.saveTermToAsset(obj, that);
obj['callback'] = function() {
that.callback();
}
}
// if (that.multiple[i].model.get("$traits$") && !that.multiple[i].model.get("$traits$")[obj.termName]) {
CommonViewFunction.saveTermToAsset(obj);
// / }
} }
} else { } else {
that.asyncFetchCounter = 0;
CommonViewFunction.saveTermToAsset({ CommonViewFunction.saveTermToAsset({
termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""), termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
guid: this.guid, guid: this.guid
callback: function() { }, that);
that.callback();
}
});
} }
}); });
this.on('closeModal', function() { this.on('closeModal', function() {
......
...@@ -63,7 +63,7 @@ define(['require', ...@@ -63,7 +63,7 @@ define(['require',
this.bindEvents(); this.bindEvents();
this.fetchGraphData(); this.fetchGraphData();
this.data = {}; this.data = {};
this.fetchList = 0; this.asyncFetchCounter = 0;
}, },
bindEvents: function() { bindEvents: function() {
this.listenTo(this.inputCollection, 'reset', function() { this.listenTo(this.inputCollection, 'reset', function() {
...@@ -141,8 +141,8 @@ define(['require', ...@@ -141,8 +141,8 @@ define(['require',
} }
} }
} }
--that.fetchList; --that.asyncFetchCounter;
if (that.fetchList <= 0) { if (that.asyncFetchCounter === 0) {
if (that.edgesAndvertices) { if (that.edgesAndvertices) {
that.createGraph(that.edgesAndvertices, that.startingPoint); that.createGraph(that.edgesAndvertices, that.startingPoint);
} else if (this.outputState && !that.edgesAndvertices) { } else if (this.outputState && !that.edgesAndvertices) {
...@@ -152,7 +152,7 @@ define(['require', ...@@ -152,7 +152,7 @@ define(['require',
} }
function fetchLoadProcess(id) { function fetchLoadProcess(id) {
++that.fetchList; ++that.asyncFetchCounter;
that.entityModel.getEntity(id, { that.entityModel.getEntity(id, {
success: function(data) { success: function(data) {
addValueInObject(data); addValueInObject(data);
...@@ -227,7 +227,7 @@ define(['require', ...@@ -227,7 +227,7 @@ define(['require',
} }
} }
}); });
if (this.fetchList <= 0) { if (this.asyncFetchCounter <= 0) {
if (this.edgesAndvertices) { if (this.edgesAndvertices) {
this.createGraph(that.edgesAndvertices, this.startingPoint); this.createGraph(that.edgesAndvertices, this.startingPoint);
} else if (this.outputState && !this.edgesAndvertices) { } else if (this.outputState && !this.edgesAndvertices) {
......
...@@ -40,7 +40,8 @@ define(['require', ...@@ -40,7 +40,8 @@ define(['require',
searchType: 'input[name="queryType"]', searchType: 'input[name="queryType"]',
searchBtn: '[data-id="searchBtn"]', searchBtn: '[data-id="searchBtn"]',
clearSearch: '[data-id="clearSearch"]', clearSearch: '[data-id="clearSearch"]',
typeLov: '[data-id="typeLOV"]' typeLov: '[data-id="typeLOV"]',
refreshBtn: '[data-id="refreshBtn"]'
}, },
/** ui events hash */ /** ui events hash */
events: function() { events: function() {
...@@ -60,6 +61,7 @@ define(['require', ...@@ -60,6 +61,7 @@ define(['require',
events["click " + this.ui.searchBtn] = 'findSearchResult'; events["click " + this.ui.searchBtn] = 'findSearchResult';
events["click " + this.ui.clearSearch] = 'clearSearchData'; events["click " + this.ui.clearSearch] = 'clearSearchData';
events["change " + this.ui.typeLov] = 'onChangeTypeList'; events["change " + this.ui.typeLov] = 'onChangeTypeList';
events["click " + this.ui.refreshBtn] = 'onRefreshButton';
return events; return events;
}, },
/** /**
...@@ -105,6 +107,9 @@ define(['require', ...@@ -105,6 +107,9 @@ define(['require',
$.extend(this.typecollection.queryParams, { type: 'CLASS' }); $.extend(this.typecollection.queryParams, { type: 'CLASS' });
this.typecollection.fetch({ reset: true }); this.typecollection.fetch({ reset: true });
}, },
onRefreshButton: function() {
this.fetchCollection();
},
manualRender: function(paramObj) { manualRender: function(paramObj) {
this.setValues(paramObj); this.setValues(paramObj);
}, },
...@@ -121,11 +126,15 @@ define(['require', ...@@ -121,11 +126,15 @@ define(['require',
that.ui.typeLov.html(str); that.ui.typeLov.html(str);
}, },
onChangeTypeList: function(e) { onChangeTypeList: function(e) {
var that = this;
if (this.ui.typeLov.select2('val') !== "") { if (this.ui.typeLov.select2('val') !== "") {
this.ui.searchBtn.removeAttr("disabled"); this.ui.searchBtn.removeAttr("disabled");
} else if (this.ui.searchInput.val() === "") { } else if (this.ui.searchInput.val() === "") {
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
} }
setTimeout(function() {
that.ui.searchInput.focus();
}, 0);
}, },
setValues: function(paramObj) { setValues: function(paramObj) {
var arr = [], var arr = [],
...@@ -152,14 +161,21 @@ define(['require', ...@@ -152,14 +161,21 @@ define(['require',
this.ui.typeLov.val(typeList).trigger('change'); this.ui.typeLov.val(typeList).trigger('change');
} else { } else {
this.ui.typeLov.val(typeList); this.ui.typeLov.val(typeList);
setTimeout(function() {
that.ui.searchInput.focus();
}, 0);
} }
this.ui.searchInput.val(query.join(" ")); this.ui.searchInput.val(query.join(" "));
} else { } else {
this.ui.searchInput.val(this.value.query); this.ui.searchInput.val(this.value.query);
setTimeout(function() {
that.ui.searchInput.focus();
}, 0);
}
if (this.ui.searchBtn.val() !== "" || this.ui.typeLov.val() !== "") {
this.ui.searchBtn.removeAttr("disabled");
} }
this.ui.searchBtn.removeAttr("disabled");
} }
} }
this.bindEvents(arr); this.bindEvents(arr);
}, },
...@@ -202,7 +218,7 @@ define(['require', ...@@ -202,7 +218,7 @@ define(['require',
this.$('.typeLOV').hide(); this.$('.typeLOV').hide();
this.type = "fulltext"; this.type = "fulltext";
} }
if (this.query[this.type].query !== Utils.getUrlState.getQueryParams().query && this.type == Utils.getUrlState.getQueryParams().searchType) { if (Utils.getUrlState.getQueryParams() && this.query[this.type].query !== Utils.getUrlState.getQueryParams().query && this.type == Utils.getUrlState.getQueryParams().searchType) {
this.query[this.type].query = Utils.getUrlState.getQueryParams().query; this.query[this.type].query = Utils.getUrlState.getQueryParams().query;
} }
Utils.setUrl({ Utils.setUrl({
......
...@@ -118,7 +118,7 @@ define(['require', ...@@ -118,7 +118,7 @@ define(['require',
this.searchCollection = new VSearchList(); this.searchCollection = new VSearchList();
this.limit = 25; this.limit = 25;
this.firstFetch = true; this.firstFetch = true;
this.fetchList = 0; this.asyncFetchCounter = 0;
this.offset = 0; this.offset = 0;
this.commonTableOptions = { this.commonTableOptions = {
collection: this.searchCollection, collection: this.searchCollection,
...@@ -202,7 +202,7 @@ define(['require', ...@@ -202,7 +202,7 @@ define(['require',
}, },
fetchCollection: function(value) { fetchCollection: function(value) {
var that = this; var that = this;
if (value && (value.query === undefined || value.query === "")) { if (value && (value.query === undefined || value.query.trim() === "")) {
return; return;
} }
this.$('.fontLoader').show(); this.$('.fontLoader').show();
...@@ -305,7 +305,7 @@ define(['require', ...@@ -305,7 +305,7 @@ define(['require',
}); });
}, },
checkTableFetch: function() { checkTableFetch: function() {
if (this.fetchList <= 0) { if (this.asyncFetchCounter <= 0) {
this.$('div[data-id="r_tableSpinner"]').removeClass('show') this.$('div[data-id="r_tableSpinner"]').removeClass('show')
this.$('.fontLoader').hide(); this.$('.fontLoader').hide();
this.$('.searchTable').show(); this.$('.searchTable').show();
...@@ -344,7 +344,7 @@ define(['require', ...@@ -344,7 +344,7 @@ define(['require',
}); });
if (guid.length) { if (guid.length) {
idFound = true; idFound = true;
++fetchResultCount; ++that.asyncFetchCounter;
model.getEntity(guid, { model.getEntity(guid, {
success: function(data) { success: function(data) {
if (data.definition) { if (data.definition) {
...@@ -364,8 +364,8 @@ define(['require', ...@@ -364,8 +364,8 @@ define(['require',
}, },
error: function(error, data, status) {}, error: function(error, data, status) {},
complete: function() { complete: function() {
--fetchResultCount; --that.asyncFetchCounter;
if (fetchResultCount === 0) { if (that.asyncFetchCounter === 0) {
that.renderTableLayoutView(that.getFixedDslColumn()) that.renderTableLayoutView(that.getFixedDslColumn())
} }
} }
......
...@@ -57,6 +57,7 @@ define(['require', ...@@ -57,6 +57,7 @@ define(['require',
}).open(); }).open();
this.on('ok', function() { this.on('ok', function() {
if (that.multiple) { if (that.multiple) {
that.asyncFetchCounter = 0;
for (var i = 0; i < that.multiple.length; i++) { for (var i = 0; i < that.multiple.length; i++) {
if (i == 0) { if (i == 0) {
that.showLoader(); that.showLoader();
...@@ -65,21 +66,13 @@ define(['require', ...@@ -65,21 +66,13 @@ define(['require',
tagName: this.ui.addTagOptions.val(), tagName: this.ui.addTagOptions.val(),
guid: that.multiple[i].id.id guid: that.multiple[i].id.id
} }
if (that.multiple.length - 1 == i) {
obj['callback'] = function() {
that.callback();
}
}
that.saveTagData(obj); that.saveTagData(obj);
} }
} else { } else {
that.asyncFetchCounter = 0;
that.saveTagData({ that.saveTagData({
tagName: that.ui.addTagOptions.val(), tagName: that.ui.addTagOptions.val(),
guid: that.guid, guid: that.guid
callback: function() {
that.callback();
}
}); });
} }
}); });
...@@ -146,6 +139,7 @@ define(['require', ...@@ -146,6 +139,7 @@ define(['require',
saveTagData: function(options) { saveTagData: function(options) {
var that = this, var that = this,
values = {}; values = {};
++this.asyncFetchCounter;
this.entityModel = new VEntity(); this.entityModel = new VEntity();
var name = options.tagName; var name = options.tagName;
var tagName = this.ui.addTagOptions.val(); var tagName = this.ui.addTagOptions.val();
...@@ -160,9 +154,6 @@ define(['require', ...@@ -160,9 +154,6 @@ define(['require',
Utils.notifySuccess({ Utils.notifySuccess({
content: "Tag " + tagName + " has been added to entity" content: "Tag " + tagName + " has been added to entity"
}); });
if (options.callback) {
options.callback();
}
if (options.modalCollection) { if (options.modalCollection) {
options.modalCollection.fetch({ reset: true }); options.modalCollection.fetch({ reset: true });
} }
...@@ -176,11 +167,13 @@ define(['require', ...@@ -176,11 +167,13 @@ define(['require',
Utils.notifyError({ Utils.notifyError({
content: message content: message
}); });
if (options.callback) {
options.callback();
}
}, },
complete: function() {} complete: function() {
--that.asyncFetchCounter;
if (that.callback && that.asyncFetchCounter === 0) {
that.callback();
}
}
}); });
}, },
}); });
......
...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags) ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-1103 : UI: Search type list is not refreshed (Kalyanikashikar via sumasai)
ATLAS-693 Titan 0.5.4 implementation of the graph db abstraction {jnhagelb via dkantor) ATLAS-693 Titan 0.5.4 implementation of the graph db abstraction {jnhagelb via dkantor)
ATLAS-1099 UI : multiple tag assign button hides wrongly (Kalyanikashikar via sumasai) ATLAS-1099 UI : multiple tag assign button hides wrongly (Kalyanikashikar via sumasai)
ATLAS-1087 Provide an option to turn off persisting entity definition in audits (sumasai, shwethags) ATLAS-1087 Provide an option to turn off persisting entity definition in audits (sumasai, shwethags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment