Commit beb5a099 by kalyanikk Committed by Suma Shivaprasad

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

parent 4fa10b6a
......@@ -17,7 +17,7 @@
<div class="row row-margin-bottom">
<div class="col-sm-12" style="margin:15px 0px;">
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<span class="pull-left">Text</span>
<label class="switch pull-left">
<input type="checkbox" name="queryType" value="text">
......@@ -25,6 +25,9 @@
</label>
<span class="pull-left">DSL</span>
</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 class="col-sm-12">
......@@ -32,7 +35,9 @@
<div class="typeLOV">
<select data-id="typeLOV"></select>
</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 class="clearAdvanceSearch" data-id="clearSearch">Clear</div>
<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
}
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) {
var VCatalog = new Vcatalog();
var name = options.termName;
VCatalog.url = function() {
return "api/atlas/v1/entities/" + options.guid + "/tags/" + name;
};
++that.asyncFetchCounter;
VCatalog.save(null, {
success: function(data) {
Utils.notifySuccess({
content: "Term " + name + Messages.addTermToEntitySuccessMessage
});
if (options.callback) {
options.callback();
}
if (options.collection) {
options.collection.fetch({ reset: true });
}
......@@ -483,12 +481,14 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob
Utils.notifyError({
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',
allowCancel: true,
}).open();
this.on('ok', function() {
that.asyncFetchCounter = 0;
if (that.multiple) {
for (var i = 0; i < that.multiple.length; i++) {
if (i == 0) {
......@@ -70,23 +71,14 @@ define(['require',
termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
guid: that.multiple[i].id.id
}
if (that.multiple.length - 1 == i) {
obj['callback'] = function() {
that.callback();
}
}
// if (that.multiple[i].model.get("$traits$") && !that.multiple[i].model.get("$traits$")[obj.termName]) {
CommonViewFunction.saveTermToAsset(obj);
// / }
CommonViewFunction.saveTermToAsset(obj, that);
}
} else {
that.asyncFetchCounter = 0;
CommonViewFunction.saveTermToAsset({
termName: this.modal.$el.find('.taxonomyTree li.active a').data('name').split("`").join(""),
guid: this.guid,
callback: function() {
that.callback();
}
});
guid: this.guid
}, that);
}
});
this.on('closeModal', function() {
......
......@@ -63,7 +63,7 @@ define(['require',
this.bindEvents();
this.fetchGraphData();
this.data = {};
this.fetchList = 0;
this.asyncFetchCounter = 0;
},
bindEvents: function() {
this.listenTo(this.inputCollection, 'reset', function() {
......@@ -141,8 +141,8 @@ define(['require',
}
}
}
--that.fetchList;
if (that.fetchList <= 0) {
--that.asyncFetchCounter;
if (that.asyncFetchCounter === 0) {
if (that.edgesAndvertices) {
that.createGraph(that.edgesAndvertices, that.startingPoint);
} else if (this.outputState && !that.edgesAndvertices) {
......@@ -152,7 +152,7 @@ define(['require',
}
function fetchLoadProcess(id) {
++that.fetchList;
++that.asyncFetchCounter;
that.entityModel.getEntity(id, {
success: function(data) {
addValueInObject(data);
......@@ -227,7 +227,7 @@ define(['require',
}
}
});
if (this.fetchList <= 0) {
if (this.asyncFetchCounter <= 0) {
if (this.edgesAndvertices) {
this.createGraph(that.edgesAndvertices, this.startingPoint);
} else if (this.outputState && !this.edgesAndvertices) {
......
......@@ -40,7 +40,8 @@ define(['require',
searchType: 'input[name="queryType"]',
searchBtn: '[data-id="searchBtn"]',
clearSearch: '[data-id="clearSearch"]',
typeLov: '[data-id="typeLOV"]'
typeLov: '[data-id="typeLOV"]',
refreshBtn: '[data-id="refreshBtn"]'
},
/** ui events hash */
events: function() {
......@@ -60,6 +61,7 @@ define(['require',
events["click " + this.ui.searchBtn] = 'findSearchResult';
events["click " + this.ui.clearSearch] = 'clearSearchData';
events["change " + this.ui.typeLov] = 'onChangeTypeList';
events["click " + this.ui.refreshBtn] = 'onRefreshButton';
return events;
},
/**
......@@ -105,6 +107,9 @@ define(['require',
$.extend(this.typecollection.queryParams, { type: 'CLASS' });
this.typecollection.fetch({ reset: true });
},
onRefreshButton: function() {
this.fetchCollection();
},
manualRender: function(paramObj) {
this.setValues(paramObj);
},
......@@ -121,11 +126,15 @@ define(['require',
that.ui.typeLov.html(str);
},
onChangeTypeList: function(e) {
var that = this;
if (this.ui.typeLov.select2('val') !== "") {
this.ui.searchBtn.removeAttr("disabled");
} else if (this.ui.searchInput.val() === "") {
this.ui.searchBtn.attr("disabled", "true");
}
setTimeout(function() {
that.ui.searchInput.focus();
}, 0);
},
setValues: function(paramObj) {
var arr = [],
......@@ -152,14 +161,21 @@ define(['require',
this.ui.typeLov.val(typeList).trigger('change');
} else {
this.ui.typeLov.val(typeList);
setTimeout(function() {
that.ui.searchInput.focus();
}, 0);
}
this.ui.searchInput.val(query.join(" "));
} else {
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);
},
......@@ -202,7 +218,7 @@ define(['require',
this.$('.typeLOV').hide();
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;
}
Utils.setUrl({
......
......@@ -118,7 +118,7 @@ define(['require',
this.searchCollection = new VSearchList();
this.limit = 25;
this.firstFetch = true;
this.fetchList = 0;
this.asyncFetchCounter = 0;
this.offset = 0;
this.commonTableOptions = {
collection: this.searchCollection,
......@@ -202,7 +202,7 @@ define(['require',
},
fetchCollection: function(value) {
var that = this;
if (value && (value.query === undefined || value.query === "")) {
if (value && (value.query === undefined || value.query.trim() === "")) {
return;
}
this.$('.fontLoader').show();
......@@ -305,7 +305,7 @@ define(['require',
});
},
checkTableFetch: function() {
if (this.fetchList <= 0) {
if (this.asyncFetchCounter <= 0) {
this.$('div[data-id="r_tableSpinner"]').removeClass('show')
this.$('.fontLoader').hide();
this.$('.searchTable').show();
......@@ -344,7 +344,7 @@ define(['require',
});
if (guid.length) {
idFound = true;
++fetchResultCount;
++that.asyncFetchCounter;
model.getEntity(guid, {
success: function(data) {
if (data.definition) {
......@@ -364,8 +364,8 @@ define(['require',
},
error: function(error, data, status) {},
complete: function() {
--fetchResultCount;
if (fetchResultCount === 0) {
--that.asyncFetchCounter;
if (that.asyncFetchCounter === 0) {
that.renderTableLayoutView(that.getFixedDslColumn())
}
}
......
......@@ -57,6 +57,7 @@ define(['require',
}).open();
this.on('ok', function() {
if (that.multiple) {
that.asyncFetchCounter = 0;
for (var i = 0; i < that.multiple.length; i++) {
if (i == 0) {
that.showLoader();
......@@ -65,21 +66,13 @@ define(['require',
tagName: this.ui.addTagOptions.val(),
guid: that.multiple[i].id.id
}
if (that.multiple.length - 1 == i) {
obj['callback'] = function() {
that.callback();
}
}
that.saveTagData(obj);
}
} else {
that.asyncFetchCounter = 0;
that.saveTagData({
tagName: that.ui.addTagOptions.val(),
guid: that.guid,
callback: function() {
that.callback();
}
guid: that.guid
});
}
});
......@@ -146,6 +139,7 @@ define(['require',
saveTagData: function(options) {
var that = this,
values = {};
++this.asyncFetchCounter;
this.entityModel = new VEntity();
var name = options.tagName;
var tagName = this.ui.addTagOptions.val();
......@@ -160,9 +154,6 @@ define(['require',
Utils.notifySuccess({
content: "Tag " + tagName + " has been added to entity"
});
if (options.callback) {
options.callback();
}
if (options.modalCollection) {
options.modalCollection.fetch({ reset: true });
}
......@@ -176,11 +167,13 @@ define(['require',
Utils.notifyError({
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:
ATLAS-1060 Add composite indexes for exact match performance improvements for all attributes (sumasai via shwethags)
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-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)
......
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