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',
var ruleUrl = CommonViewFunction.attributeFilter.generateUrl(rule.rules);
this.searchTableFilters[filtertype][(isTag ? this.value.tag : this.value.type)] = ruleUrl;
this.makeFilterButtonActive(filtertype);
if (this.value && this.searchTableColumns) {
if (!isTag && this.value && this.value.type && this.searchTableColumns) {
if (!this.searchTableColumns[this.value.type]) {
this.searchTableColumns[this.value.type] = ["selected", "name", "owner", "description", "tag", "typeName"]
}
......@@ -344,9 +344,13 @@ define(['require',
}
if (this.value) {
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 {
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);
if (this.ui.typeLov.data('select2')) {
......@@ -385,7 +389,9 @@ define(['require',
searchType: this.type,
dslChecked: this.ui.searchType.is(':checked'),
tagFilters: null,
entityFilters: null
entityFilters: null,
attributes: null,
includeDE: null
}
this.query[this.type].type = this.ui.typeLov.select2('val') || null;
if (!this.dsl) {
......@@ -398,15 +404,12 @@ define(['require',
if (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;
if (columnList) {
params['attributes'] = columnList.join(',');
} else {
params['attributes'] = null;
}
if (this.value.includeDE) {
params['includeDE'] = this.value.includeDE
}
}
......
......@@ -294,7 +294,7 @@ define(['require',
});
listOfColumns = _.sortBy(listOfColumns);
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;
}
} else if (this.value && this.value.type && this.searchTableColumns && this.value.attributes) {
......@@ -343,7 +343,7 @@ define(['require',
tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters),
entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters);
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 = {
'entityFilters': entityFilters,
'tagFilters': tagFilters,
......
......@@ -73,7 +73,7 @@ define(['require',
onRender: function() {
var that = this;
this.bindEvents();
this.fetchCollections();
this.tagsGenerator();
$('body').on("click", '.tagPopoverList li', function(e) {
that[$(this).find("a").data('fn')](e);
});
......@@ -148,31 +148,32 @@ define(['require',
}
},
tagsGenerator: function(searchString) {
var that = this,
str = '';
that.collection.fullCollection.comparator = function(model) {
return Utils.getName(model.toJSON(), 'name').toLowerCase();
};
that.collection.fullCollection.sort().each(function(model) {
var name = Utils.getName(model.toJSON(), 'name');
var checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) {
if (searchString) {
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>';
var str = '';
if (this.collection && this.collection.fullCollection.length) {
this.collection.fullCollection.comparator = function(model) {
return Utils.getName(model.toJSON(), 'name').toLowerCase();
};
this.collection.fullCollection.sort().each(function(model) {
var name = Utils.getName(model.toJSON(), 'name');
var checkTagOrTerm = Utils.checkTagOrTerm(name);
if (checkTagOrTerm.tag) {
if (searchString) {
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>';
} else {
return;
}
} 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) {
......
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