Commit 6d8c50cc by kevalbhatt Committed by Madhan Neethiraj

ATLAS-2018: UI: Attribute filter does not preserve state

Signed-off-by: 's avatarMadhan Neethiraj <madhan@apache.org> (cherry picked from commit db317a4708fe1f6c87a1f7674f4fb3bbf70bebb1)
parent 86fb9da4
......@@ -54,7 +54,11 @@ define([
'classificationDefCollection': this.classificationDefCollection
}
this.sharedObj = {
searchTableColumns: {}
searchTableColumns: {},
searchTableFilters: {
tagFilters: {},
entityFilters: {}
}
}
},
bindCommonEvents: function() {
......
......@@ -408,7 +408,11 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
_.each(attrObj, function(obj) {
attrQuery.push(obj.id + "::" + obj.operator + "::" + obj.value + "::" + obj.type);
});
return attrQuery.join();
if (attrQuery.length) {
return attrQuery.join();
} else {
return null;
}
} else {
return null;
}
......
......@@ -83,7 +83,7 @@ define(['require',
return events;
},
initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns'));
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'searchTableColumns', 'searchTableFilters'));
if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4";
} else {
......@@ -128,7 +128,8 @@ define(['require',
entityDefCollection: that.entityDefCollection,
enumDefCollection: that.enumDefCollection,
classificationDefCollection: that.classificationDefCollection,
searchTableColumns: that.searchTableColumns
searchTableColumns: that.searchTableColumns,
searchTableFilters: that.searchTableFilters
}));
});
},
......
......@@ -52,7 +52,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'tag'));
_.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'tag', 'searchTableFilters'));
this.attrObj = _.sortBy(this.attrObj, 'name');
this.filterType = this.tag ? 'tagFilters' : 'entityFilters';
},
......@@ -134,7 +134,7 @@ define(['require',
var that = this,
filters = [];
if (this.value) {
var rules_widgets = CommonViewFunction.attributeFilter.extractUrl(this.value[this.filterType]);
var rules_widgets = CommonViewFunction.attributeFilter.extractUrl(this.searchTableFilters[this.filterType][(this.tag ? this.value.tag : this.value.type)]);
}
_.each(this.attrObj, function(obj) {
var returnObj = that.getObjDef(obj, rules_widgets);
......
......@@ -50,7 +50,7 @@ define(['require',
* @constructs
*/
initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'classificationDefCollection', 'tag'));
_.extend(this, _.pick(options, 'value', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'classificationDefCollection', 'tag', 'searchTableFilters'));
this.bindEvents();
var that = this;
this.modal = new Modal({
......@@ -83,7 +83,8 @@ define(['require',
searchVent: this.searchVent,
entityDefCollection: this.entityDefCollection,
enumDefCollection: this.enumDefCollection,
classificationDefCollection: this.classificationDefCollection
classificationDefCollection: this.classificationDefCollection,
searchTableFilters: this.searchTableFilters
}
if (this.tag) {
......
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