Commit 97ae3a3c by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2080: fix - tag filters should not be added in the results attributes list

parent 024fd221
...@@ -297,7 +297,7 @@ define(['require', ...@@ -297,7 +297,7 @@ define(['require',
var ruleUrl = CommonViewFunction.attributeFilter.generateUrl(rule.rules); var ruleUrl = CommonViewFunction.attributeFilter.generateUrl(rule.rules);
this.searchTableFilters[filtertype][(isTag ? this.value.tag : this.value.type)] = ruleUrl; this.searchTableFilters[filtertype][(isTag ? this.value.tag : this.value.type)] = ruleUrl;
this.makeFilterButtonActive(filtertype); this.makeFilterButtonActive(filtertype);
if (this.value && this.searchTableColumns) { if (!isTag && this.value && this.value.type && this.searchTableColumns) {
if (!this.searchTableColumns[this.value.type]) { if (!this.searchTableColumns[this.value.type]) {
this.searchTableColumns[this.value.type] = ["selected", "name", "owner", "description", "tag", "typeName"] this.searchTableColumns[this.value.type] = ["selected", "name", "owner", "description", "tag", "typeName"]
} }
...@@ -344,9 +344,13 @@ define(['require', ...@@ -344,9 +344,13 @@ define(['require',
} }
if (this.value) { if (this.value) {
if (this.value.dslChecked == "true") { if (this.value.dslChecked == "true") {
this.ui.searchType.prop("checked", true).trigger("change"); if (!this.ui.searchType.prop("checked")) {
this.ui.searchType.prop("checked", true).trigger("change");
}
} else { } else {
this.ui.searchType.prop("checked", false).trigger("change"); if (this.ui.searchType.prop("checked")) {
this.ui.searchType.prop("checked", false).trigger("change");
}
} }
this.ui.typeLov.val(this.value.type); this.ui.typeLov.val(this.value.type);
if (this.ui.typeLov.data('select2')) { if (this.ui.typeLov.data('select2')) {
...@@ -385,7 +389,9 @@ define(['require', ...@@ -385,7 +389,9 @@ define(['require',
searchType: this.type, searchType: this.type,
dslChecked: this.ui.searchType.is(':checked'), dslChecked: this.ui.searchType.is(':checked'),
tagFilters: null, tagFilters: null,
entityFilters: null entityFilters: null,
attributes: null,
includeDE: null
} }
this.query[this.type].type = this.ui.typeLov.select2('val') || null; this.query[this.type].type = this.ui.typeLov.select2('val') || null;
if (!this.dsl) { if (!this.dsl) {
...@@ -398,15 +404,12 @@ define(['require', ...@@ -398,15 +404,12 @@ define(['require',
if (this.value.type) { if (this.value.type) {
params['entityFilters'] = entityFilterObj[this.value.type] params['entityFilters'] = entityFilterObj[this.value.type]
} }
}
if (this.dsl) {
params['attributes'] = null;
} else {
var columnList = this.value && this.value.type && this.searchTableColumns ? this.searchTableColumns[this.value.type] : null; var columnList = this.value && this.value.type && this.searchTableColumns ? this.searchTableColumns[this.value.type] : null;
if (columnList) { if (columnList) {
params['attributes'] = columnList.join(','); params['attributes'] = columnList.join(',');
} else { }
params['attributes'] = null; if (this.value.includeDE) {
params['includeDE'] = this.value.includeDE
} }
} }
......
...@@ -294,7 +294,7 @@ define(['require', ...@@ -294,7 +294,7 @@ define(['require',
}); });
listOfColumns = _.sortBy(listOfColumns); listOfColumns = _.sortBy(listOfColumns);
this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null; this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null;
if (this.value && this.searchTableColumns) { if (this.value && this.value.type && this.searchTableColumns) {
this.searchTableColumns[this.value.type] = listOfColumns.length ? listOfColumns : null; this.searchTableColumns[this.value.type] = listOfColumns.length ? listOfColumns : null;
} }
} else if (this.value && this.value.type && this.searchTableColumns && this.value.attributes) { } else if (this.value && this.value.type && this.searchTableColumns && this.value.attributes) {
...@@ -343,7 +343,7 @@ define(['require', ...@@ -343,7 +343,7 @@ define(['require',
tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters), tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters),
entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters); entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters);
if (isPostMethod) { if (isPostMethod) {
var excludeDefaultColumn = this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms") : null, var excludeDefaultColumn = this.value.type && this.searchTableColumns ? _.without(this.searchTableColumns[this.value.type], "selected", "name", "description", "typeName", "owner", "tag", "terms") : null,
filterObj = { filterObj = {
'entityFilters': entityFilters, 'entityFilters': entityFilters,
'tagFilters': tagFilters, 'tagFilters': tagFilters,
......
...@@ -73,7 +73,7 @@ define(['require', ...@@ -73,7 +73,7 @@ define(['require',
onRender: function() { onRender: function() {
var that = this; var that = this;
this.bindEvents(); this.bindEvents();
this.fetchCollections(); this.tagsGenerator();
$('body').on("click", '.tagPopoverList li', function(e) { $('body').on("click", '.tagPopoverList li', function(e) {
that[$(this).find("a").data('fn')](e); that[$(this).find("a").data('fn')](e);
}); });
...@@ -148,31 +148,32 @@ define(['require', ...@@ -148,31 +148,32 @@ define(['require',
} }
}, },
tagsGenerator: function(searchString) { tagsGenerator: function(searchString) {
var that = this, var str = '';
str = ''; if (this.collection && this.collection.fullCollection.length) {
that.collection.fullCollection.comparator = function(model) { this.collection.fullCollection.comparator = function(model) {
return Utils.getName(model.toJSON(), 'name').toLowerCase(); return Utils.getName(model.toJSON(), 'name').toLowerCase();
}; };
that.collection.fullCollection.sort().each(function(model) { this.collection.fullCollection.sort().each(function(model) {
var name = Utils.getName(model.toJSON(), 'name'); var name = Utils.getName(model.toJSON(), 'name');
var checkTagOrTerm = Utils.checkTagOrTerm(name); var checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) { if (checkTagOrTerm.tag) {
if (searchString) { if (searchString) {
if (name.search(new RegExp(searchString, "i")) != -1) { if (name.search(new RegExp(searchString, "i")) != -1) {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '" >' + name + '</a></li>'; str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '" >' + name + '</a></li>';
} else {
return;
}
} else { } else {
return; str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '">' + name + '</a></li>';
} }
} else {
str += '<li class="parent-node" data-id="tags"><div class="tools"><i class="fa fa-ellipsis-h tagPopover"></i></div><a href="#!/tag/tagAttribute/' + name + '" data-name="' + name + '">' + name + '</a></li>';
} }
});
this.ui.tagsParent.empty().html(str);
this.setValues();
this.createTagAction();
if (this.createTag) {
this.createTag = false;
} }
});
this.ui.tagsParent.empty().html(str);
this.setValues();
this.createTagAction();
if (this.createTag) {
this.createTag = false;
} }
}, },
onClickCreateTag: function(e) { onClickCreateTag: function(e) {
......
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