Commit f511f272 by kevalbhatt Committed by Madhan Neethiraj

ATLAS-1967: search UI - render attribute filter based on browser URL

parent 62d85a4c
...@@ -29,7 +29,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb ...@@ -29,7 +29,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this.trigger('closeModal'); this.trigger('closeModal');
if (this.options.content && this.options.content.trigger) { if (this.options.content && this.options.content.trigger) {
this.options.content.trigger('closeModal', this); this.options.content.trigger('closeModal', this, event);
} }
}, },
'click .cancel': function(event) { 'click .cancel': function(event) {
...@@ -38,7 +38,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb ...@@ -38,7 +38,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this.trigger('closeModal'); this.trigger('closeModal');
if (this.options.content && this.options.content.trigger) { if (this.options.content && this.options.content.trigger) {
this.options.content.trigger('closeModal', this); this.options.content.trigger('closeModal', this, event);
} }
}, },
'click .ok': function(event) { 'click .ok': function(event) {
...@@ -47,7 +47,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb ...@@ -47,7 +47,7 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
this.trigger('ok'); this.trigger('ok');
if (this.options.content && this.options.content.trigger) { if (this.options.content && this.options.content.trigger) {
this.options.content.trigger('ok', this); this.options.content.trigger('ok', this, event);
} }
if (this.options.okCloses) { if (this.options.okCloses) {
...@@ -85,7 +85,8 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb ...@@ -85,7 +85,8 @@ define(['require', 'backbone', 'hbs!tmpl/common/modal'], function(require, Backb
animate: true, animate: true,
contentWithFooter: false, contentWithFooter: false,
template: template, template: template,
width: null width: null,
buttons: null
}, options); }, options);
}, },
......
...@@ -53,10 +53,6 @@ define([ ...@@ -53,10 +53,6 @@ define([
'enumDefCollection': this.enumDefCollection, 'enumDefCollection': this.enumDefCollection,
'classificationDefCollection': this.classificationDefCollection 'classificationDefCollection': this.classificationDefCollection
} }
this.filterObj = {
'tagFilters': JSON.parse(Utils.localStorage.getValue('tagFilters')),
'entityFilters': JSON.parse(Utils.localStorage.getValue('entityFilters'))
}
}, },
bindCommonEvents: function() { bindCommonEvents: function() {
var that = this; var that = this;
...@@ -128,8 +124,7 @@ define([ ...@@ -128,8 +124,7 @@ define([
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'url': url, 'url': url
'filterObj': that.filterObj
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
} else { } else {
...@@ -161,7 +156,7 @@ define([ ...@@ -161,7 +156,7 @@ define([
App.rNHeader.show(new Header()); App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ 'filterObj': that.filterObj }, that.preFetchedCollectionLists) _.extend({}, that.preFetchedCollectionLists)
)); ));
} else { } else {
App.rSideNav.currentView.selectTab(); App.rSideNav.currentView.selectTab();
...@@ -198,8 +193,7 @@ define([ ...@@ -198,8 +193,7 @@ define([
} }
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'tag': tagName, 'tag': tagName
'filterObj': that.filterObj
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
} else { } else {
...@@ -242,8 +236,7 @@ define([ ...@@ -242,8 +236,7 @@ define([
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'searchVent': that.searchVent, 'searchVent': that.searchVent
'filterObj': that.filterObj
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
} else { } else {
...@@ -259,7 +252,6 @@ define([ ...@@ -259,7 +252,6 @@ define([
_.extend({ _.extend({
'value': paramObj, 'value': paramObj,
'initialView': true, 'initialView': true,
'filterObj': that.filterObj,
'searchVent': that.searchVent 'searchVent': that.searchVent
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
...@@ -277,39 +269,13 @@ define([ ...@@ -277,39 +269,13 @@ define([
'views/business_catalog/SideNavLayoutView', 'views/business_catalog/SideNavLayoutView',
'views/search/SearchDetailLayoutView' 'views/search/SearchDetailLayoutView'
], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) { ], function(Header, BusinessCatalogLayoutView, SideNavLayoutView, SearchDetailLayoutView) {
var paramObj = Utils.getUrlState.getQueryParams(), var paramObj = Utils.getUrlState.getQueryParams();
filterObj = that.filterObj
if (paramObj && paramObj.searchType === "basic") {
if (paramObj.type) {
if (_.has(filterObj.entityFilters, paramObj.type)) {
_.extend(paramObj, {
'entityFilters': +new Date()
})
}
}
if (paramObj.tag) {
if (_.has(filterObj.entityFilters, paramObj.type)) {
_.extend(paramObj, {
'tagFilters': +new Date()
})
}
}
Utils.setUrl({
url: '#!/search/searchResult',
trigger: false,
urlParams: paramObj,
updateTabState: function() {
return { searchUrl: this.url, stateChanged: true };
},
});
}
App.rNHeader.show(new Header()); App.rNHeader.show(new Header());
if (!App.rSideNav.currentView) { if (!App.rSideNav.currentView) {
App.rSideNav.show(new SideNavLayoutView( App.rSideNav.show(new SideNavLayoutView(
_.extend({ _.extend({
'value': paramObj, 'value': paramObj,
'searchVent': that.searchVent, 'searchVent': that.searchVent
'filterObj': that.filterObj
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
} else { } else {
...@@ -320,7 +286,6 @@ define([ ...@@ -320,7 +286,6 @@ define([
_.extend({ _.extend({
'value': paramObj, 'value': paramObj,
'searchVent': that.searchVent, 'searchVent': that.searchVent,
'filterObj': that.filterObj,
'initialView': (paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag) || (paramObj.query ? paramObj.query.trim() : "")).length === 0 'initialView': (paramObj.type || (paramObj.dslChecked == "true" ? "" : paramObj.tag) || (paramObj.query ? paramObj.query.trim() : "")).length === 0
}, that.preFetchedCollectionLists) }, that.preFetchedCollectionLists)
)); ));
......
...@@ -31,10 +31,13 @@ ...@@ -31,10 +31,13 @@
<div class="modal-body">{{content}}</div> <div class="modal-body">{{content}}</div>
{{#if showFooter}} {{#if showFooter}}
<div class="modal-footer"> <div class="modal-footer">
{{#if allowCancel}} {{#if cancelText}} {{#if buttons}} {{#each buttons}}
<button type="button" class="btn btn-atlas {{this.btnClass}}">{{this.text}}</button>
{{/each}} {{else}} {{#if allowCancel}} {{#if cancelText}}
<button type="button" class="btn btn-atlas cancel">{{tt cancelText}}</button> <button type="button" class="btn btn-atlas cancel">{{tt cancelText}}</button>
{{/if}} {{/if}} {{/if}} {{/if}}
<button type="button" class="btn btn-atlas ok">{{tt okText}}</button> <button type="button" class="btn btn-atlas ok">{{tt okText}}</button>
{{/if}}
</div> </div>
{{/if}} {{/if}} {{/if}} {{/if}}
</div> </div>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<select data-id="typeLOV"></select> <select data-id="typeLOV"></select>
</div> </div>
<div class="col-sm-2 no-padding temFilterBtn"> <div class="col-sm-2 no-padding temFilterBtn">
<button type="button" class="btn btn-atlasAction btn-atlas pull-right typeLOV" title="Entity Attribute Filter" data-id="typeAttrFilter"><i class="fa fa-filter"></i></button> <button type="button" class="btn btn-atlasAction btn-atlas pull-right typeLOV active" title="Entity Attribute Filter" data-id="typeAttrFilter"><i class="fa fa-filter"></i></button>
</div> </div>
</div> </div>
</div> </div>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<select data-id="tagLOV"></select> <select data-id="tagLOV"></select>
</div> </div>
<div class="col-sm-2 no-padding"> <div class="col-sm-2 no-padding">
<button type="button" class="btn btn-atlasAction btn-atlas pull-right" title="Tag Attribute Filter" data-id="tagAttrFilter"><i class="fa fa-filter"></i></button> <button type="button" class="btn btn-atlasAction btn-atlas pull-right active" title="Tag Attribute Filter" data-id="tagAttrFilter"><i class="fa fa-filter"></i></button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -20,21 +20,6 @@ ...@@ -20,21 +20,6 @@
<div class="fontLoader"> <div class="fontLoader">
<i class="fa fa-refresh fa-spin-custom"></i> <i class="fa fa-refresh fa-spin-custom"></i>
</div> </div>
<div>
<div id="r_searchQuery">
<div class="panel panel-default" id="filterPanel">
<div class="panel-heading clearfix">
<h4 class="panel-title pull-left">Type,Tag filter/s</h4>
<div class="btn-group pull-right">
<button type="button" id="expand_collapse_panel" class="expand_collapse_panel" title="Collapse"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
</div>
</div>
<div id="panel_body" class="panel-body collapse in" align="center">
<p class="filterQuery" id="filterQuery"></p>
</div>
</div>
</div>
</div>
<div class="ellipsis" style="display: none;"><span class="searchResult" style=" font-size: 16px;"></span> <div class="ellipsis" style="display: none;"><span class="searchResult" style=" font-size: 16px;"></span>
<a href="javascript:void(0)" class="inputAssignTag multiSelectTerm btnAssign" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i> Assign Term</a> <a href="javascript:void(0)" class="inputAssignTag multiSelectTerm btnAssign" style="display:none" data-id="addTerm"><i class="fa fa-folder-o"></i> Assign Term</a>
<a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag btnAssign" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a> <a href="javascript:void(0)" class="inputAssignTag multiSelectTag assignTag btnAssign" style="display:none" data-id="addAssignTag"><i class="fa fa-plus"></i> Assign Tag</a>
......
...@@ -398,6 +398,64 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum ...@@ -398,6 +398,64 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enum
}); });
}) })
} }
CommonViewFunction.attributeFilter = {
generateUrl: function(attrObj) {
var attrQuery = [];
if (attrObj) {
_.each(attrObj, function(obj) {
attrQuery.push(obj.id + "::" + obj.operator + "::" + obj.value + "::" + obj.type);
});
return attrQuery.join();
} else {
return null;
}
},
extractUrl: function(urlObj) {
var attrObj = [];
if (urlObj && urlObj.length) {
_.each(urlObj.split(","), function(obj) {
var temp = obj.split("::");
attrObj.push({ id: temp[0], operator: temp[1], value: temp[2], type: temp[3] });
});
return attrObj;
} else {
return null;
}
},
generateAPIObj: function(url) {
if (url && url.length) {
var parsObj = {
"condition": 'AND',
"criterion": convertKeyAndExtractObj(this.extractUrl(url))
}
return parsObj;
} else {
return null;
}
function convertKeyAndExtractObj(rules) {
var convertObj = [];
_.each(rules, function(rulObj) {
var tempObj = {};
// For nested
// if (rulObj.rules) {
// tempObj = {
// "condition": "AND",
// "criterion": convertKeyAndExtractObj(rulObj.rules)
// }
// } else {
// }
tempObj = {
"attributeName": rulObj.id,
"operator": rulObj.operator,
"attributeValue": (rulObj.type === "date" ? Date.parse(rulObj.value) : rulObj.value)
}
convertObj.push(tempObj);
});
return convertObj;
}
}
}
CommonViewFunction.addRestCsrfCustomHeader = function(xhr, settings) { CommonViewFunction.addRestCsrfCustomHeader = function(xhr, settings) {
// if (settings.url == null || !settings.url.startsWith('/webhdfs/')) { // if (settings.url == null || !settings.url.startsWith('/webhdfs/')) {
if (settings.url == null) { if (settings.url == null) {
......
...@@ -238,7 +238,9 @@ define(['require', ...@@ -238,7 +238,9 @@ define(['require',
*/ */
renderTable: function() { renderTable: function() {
var that = this; var that = this;
this.rTableList.show(new Backgrid.Grid(this.gridOpts)); this.rTableList.show(new Backgrid.Grid(this.gridOpts).on('backgrid:rendered', function() {
that.trigger('backgrid:rendered', this)
}));
}, },
/** /**
......
...@@ -66,7 +66,7 @@ define(['require', ...@@ -66,7 +66,7 @@ define(['require',
return events; return events;
}, },
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'filterObj')); _.extend(this, _.pick(options, 'url', 'value', 'tag', 'selectFirst', 'classificationDefCollection', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection'));
if (Globals.taxonomy) { if (Globals.taxonomy) {
this.tabClass = "tab col-sm-4"; this.tabClass = "tab col-sm-4";
} else { } else {
...@@ -97,7 +97,6 @@ define(['require', ...@@ -97,7 +97,6 @@ define(['require',
collection: that.classificationDefCollection, collection: that.classificationDefCollection,
tag: that.tag, tag: that.tag,
value: that.value, value: that.value,
filterObj: that.filterObj,
typeHeaders: that.typeHeaders typeHeaders: that.typeHeaders
})); }));
}); });
...@@ -107,7 +106,6 @@ define(['require', ...@@ -107,7 +106,6 @@ define(['require',
require(['views/search/SearchLayoutView'], function(SearchLayoutView) { require(['views/search/SearchLayoutView'], function(SearchLayoutView) {
that.RSearchLayoutView.show(new SearchLayoutView({ that.RSearchLayoutView.show(new SearchLayoutView({
value: that.value, value: that.value,
filterObj: that.filterObj,
searchVent: that.searchVent, searchVent: that.searchVent,
typeHeaders: that.typeHeaders, typeHeaders: that.typeHeaders,
entityDefCollection: that.entityDefCollection, entityDefCollection: that.entityDefCollection,
......
...@@ -20,9 +20,10 @@ define(['require', ...@@ -20,9 +20,10 @@ define(['require',
'backbone', 'backbone',
'hbs!tmpl/search/QueryBuilder_tmpl', 'hbs!tmpl/search/QueryBuilder_tmpl',
'utils/Utils', 'utils/Utils',
'utils/CommonViewFunction',
'query-builder', 'query-builder',
'daterangepicker' 'daterangepicker'
], function(require, Backbone, QueryBuilder_Tmpl, Utils) { ], function(require, Backbone, QueryBuilder_Tmpl, Utils, CommonViewFunction) {
var QueryBuilderView = Backbone.Marionette.LayoutView.extend( var QueryBuilderView = Backbone.Marionette.LayoutView.extend(
/** @lends QueryBuilderView */ /** @lends QueryBuilderView */
...@@ -51,8 +52,9 @@ define(['require', ...@@ -51,8 +52,9 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'filterObj', 'entityDefCollection', 'enumDefCollection', 'tag')); _.extend(this, _.pick(options, 'attrObj', 'value', 'typeHeaders', 'entityDefCollection', 'enumDefCollection', 'tag'));
this.attrObj = _.sortBy(this.attrObj, 'name'); this.attrObj = _.sortBy(this.attrObj, 'name');
this.filterType = this.tag ? 'tagFilters' : 'entityFilters';
}, },
bindEvents: function() {}, bindEvents: function() {},
getOperator: function(type) { getOperator: function(type) {
...@@ -89,8 +91,8 @@ define(['require', ...@@ -89,8 +91,8 @@ define(['require',
format: 'MM/DD/YYYY h:mm A' format: 'MM/DD/YYYY h:mm A'
} }
}; };
if (rules && rules.rules) { if (rules) {
var valueObj = _.find(rules.rules, { id: obj.id }); var valueObj = _.find(rules, { id: obj.id });
if (valueObj) { if (valueObj) {
obj.plugin_config["startDate"] = valueObj.value; obj.plugin_config["startDate"] = valueObj.value;
} }
...@@ -128,15 +130,8 @@ define(['require', ...@@ -128,15 +130,8 @@ define(['require',
onRender: function() { onRender: function() {
var that = this, var that = this,
filters = []; filters = [];
if (this.filterObj) { if (this.value) {
var filter = this.filterObj[(this.tag ? 'tagFilters' : 'entityFilters')], var rules_widgets = CommonViewFunction.attributeFilter.extractUrl(this.value[this.filterType]);
tagTermName = this.tag ? this.value.tag : this.value.type;
if (filter) {
ruleObj = filter[tagTermName];
if (ruleObj) {
var rules_widgets = ruleObj.rule;
}
}
} }
_.each(this.attrObj, function(obj) { _.each(this.attrObj, function(obj) {
var returnObj = that.getObjDef(obj, rules_widgets); var returnObj = that.getObjDef(obj, rules_widgets);
...@@ -145,20 +140,6 @@ define(['require', ...@@ -145,20 +140,6 @@ define(['require',
} }
}); });
filters = _.uniq(filters, 'id'); filters = _.uniq(filters, 'id');
if (rules_widgets) {
for (var i = 0; i < rules_widgets.rules.length; i++) {
if (!_.find(filters, { id: rules_widgets.rules[i].id })) {
var type = (this.tag ? 'tagFilters' : 'entityFilters');
var list = JSON.parse(Utils.localStorage.getValue(type));
delete list[this.value.tag];
list = _.isEmpty(list) ? null : list;
Utils.localStorage.setValue(type, JSON.stringify(list));
this.filterObj[type] = list;
rules_widgets = null;
break;
}
}
}
if (filters && !_.isEmpty(filters)) { if (filters && !_.isEmpty(filters)) {
this.ui.builder.queryBuilder({ this.ui.builder.queryBuilder({
plugins: ['bt-tooltip-errors'], plugins: ['bt-tooltip-errors'],
......
...@@ -43,7 +43,7 @@ define(['require', ...@@ -43,7 +43,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'filterObj')); _.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection'));
}, },
bindEvents: function() {}, bindEvents: function() {},
onRender: function() { onRender: function() {
...@@ -62,7 +62,6 @@ define(['require', ...@@ -62,7 +62,6 @@ define(['require',
entityDefCollection: that.entityDefCollection, entityDefCollection: that.entityDefCollection,
typeHeaders: that.typeHeaders, typeHeaders: that.typeHeaders,
searchVent: that.searchVent, searchVent: that.searchVent,
filterObj: that.filterObj,
enumDefCollection: that.enumDefCollection enumDefCollection: that.enumDefCollection
})); }));
} }
......
...@@ -22,7 +22,8 @@ define(['require', ...@@ -22,7 +22,8 @@ define(['require',
'utils/Utils', 'utils/Utils',
'utils/UrlLinks', 'utils/UrlLinks',
'utils/Globals', 'utils/Globals',
], function(require, Backbone, SearchLayoutViewTmpl, Utils, UrlLinks, Globals) { 'utils/CommonViewFunction'
], function(require, Backbone, SearchLayoutViewTmpl, Utils, UrlLinks, Globals, CommonViewFunction) {
'use strict'; 'use strict';
var SearchLayoutView = Backbone.Marionette.LayoutView.extend( var SearchLayoutView = Backbone.Marionette.LayoutView.extend(
...@@ -80,7 +81,7 @@ define(['require', ...@@ -80,7 +81,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection', 'filterObj')); _.extend(this, _.pick(options, 'value', 'typeHeaders', 'searchVent', 'entityDefCollection', 'enumDefCollection', 'classificationDefCollection'));
this.type = "basic"; this.type = "basic";
var param = Utils.getUrlState.getQueryParams(); var param = Utils.getUrlState.getQueryParams();
this.query = { this.query = {
...@@ -121,52 +122,88 @@ define(['require', ...@@ -121,52 +122,88 @@ define(['require',
this.checkForButtonVisiblity(); this.checkForButtonVisiblity();
}, this); }, this);
}, },
bindSelect2Events: function(argument) { makeFilterButtonActive: function(filtertypeParam) {
var that = this; var filtertype = ['entityFilters', 'tagFilters'],
this.ui.typeLov.on('select2:select', function(argument) { that = this;
// this function calles after checkForButtonVisiblity that is why disabled flter here if (filtertypeParam) {
if (_.isArray(filtertypeParam)) {
filtertype = filtertypeParam;
} else if (_.isString(filtertypeParam)) {
filtertype = [filtertypeParam];
}
}
var typeCheck = function(filterQueryObj, type) {
var filterObj = filterQueryObj[type];
if (that.value.type) {
if (filterObj && filterObj.length) {
that.ui.typeAttrFilter.addClass('active');
} else {
filterQueryObj[type] = null;
that.value[type] = null;
that.ui.typeAttrFilter.removeClass('active');
}
that.ui.typeAttrFilter.prop('disabled', false); that.ui.typeAttrFilter.prop('disabled', false);
_.extend(that.value, { 'type': this.value });
that.makeFilterButtonActive('type');
});
this.ui.tagLov.on('select2:select', function(argument) {
// this function calles after checkForButtonVisiblity that is why disabled flter here
that.ui.tagAttrFilter.prop('disabled', false);
_.extend(that.value, { 'tag': this.value });
that.makeFilterButtonActive('tag');
});
this.ui.typeLov.on('select2:unselect', function(argument) {
_.extend(that.value, { 'type': null });
});
this.ui.tagLov.on('select2:unselect', function(argument) {
_.extend(that.value, { 'tag': null });
});
},
makeFilterButtonActive: function(type) {
if (this.filterObj) {
var tagFilters = this.filterObj.tagFilters,
entityFilters = this.filterObj.entityFilters;
if (type == "type") {
if (_.has(entityFilters, this.value[type])) {
this.query[this.type]['entityFilters'] = +new Date();
this.ui.typeAttrFilter.addClass('active');
} else { } else {
this.query[this.type]['entityFilters'] = null; filterQueryObj[type] = null;
this.ui.typeAttrFilter.removeClass('active'); that.value[type] = null;
that.ui.typeAttrFilter.removeClass('active');
that.ui.typeAttrFilter.prop('disabled', true);
} }
}
var tagCheck = function(filterQueryObj, type) {
var filterObj = filterQueryObj[type];
if (that.value.tag) {
that.ui.tagAttrFilter.prop('disabled', false);
if (filterObj && filterObj.length) {
that.ui.tagAttrFilter.addClass('active');
} else {
filterQueryObj[type] = null;
that.value[type] = null;
that.ui.tagAttrFilter.removeClass('active');
} }
if (type == "tag") {
if (_.has(tagFilters, this.value[type])) {
this.query[this.type]['tagFilters'] = +new Date();
this.ui.tagAttrFilter.addClass('active');
} else { } else {
this.query[this.type]['tagFilters'] = null; filterQueryObj[type] = null;
this.ui.tagAttrFilter.removeClass('active'); that.value[type] = null;
that.ui.tagAttrFilter.removeClass('active');
that.ui.tagAttrFilter.prop('disabled', true);
}
} }
_.each(filtertype, function(type) {
var filterObj = that.query[that.type][type],
filterQueryObj = that.query[that.type];
if (type == "entityFilters") {
typeCheck(filterQueryObj, type)
} }
if (type == "tagFilters") {
tagCheck(filterQueryObj, type)
} }
});
}, },
checkForButtonVisiblity: function() { checkForButtonVisiblity: function(e) {
if (this.type == "basic" && e && e.currentTarget) {
var $el = $(e.currentTarget),
isTagEl = $el.data('id') == "tagLOV" ? true : false;
if (e.type == "change" && $el.select2('data')) {
var value = $el.val(),
key = (isTagEl ? 'tag' : 'type'),
filterType = (isTagEl ? 'tagFilters' : 'entityFilters'),
value = value.length ? value : null;
if (this.value) {
if (this.value[key] !== value || (!value && !this.value[key]) || (!this.value[filterType])) {
var temp = {};
temp[key] = value;
_.extend(this.value, temp);
this.query[this.type][filterType] = null;
this.value[filterType] = null;
this.makeFilterButtonActive(filterType);
}
} else {
this.ui.tagAttrFilter.prop('disabled', true);
this.ui.typeAttrFilter.prop('disabled', true);
}
}
}
var that = this, var that = this,
value = this.ui.searchInput.val() || this.ui.typeLov.val(); value = this.ui.searchInput.val() || this.ui.typeLov.val();
if (!this.dsl && !value) { if (!this.dsl && !value) {
...@@ -180,24 +217,6 @@ define(['require', ...@@ -180,24 +217,6 @@ define(['require',
} else { } else {
this.ui.searchBtn.attr("disabled", "true"); this.ui.searchBtn.attr("disabled", "true");
} }
if (this.value) {
if (this.value.tag) {
this.ui.tagAttrFilter.prop('disabled', false);
} else {
this.ui.tagAttrFilter.prop('disabled', true);
}
if (this.value.type) {
this.ui.typeAttrFilter.prop('disabled', false);
} else {
this.ui.typeAttrFilter.prop('disabled', true);
}
this.makeFilterButtonActive('type');
this.makeFilterButtonActive('tag');
} else {
this.ui.tagAttrFilter.prop('disabled', true);
this.ui.typeAttrFilter.prop('disabled', true);
}
}, },
onRender: function() { onRender: function() {
// array of tags which is coming from url // array of tags which is coming from url
...@@ -211,8 +230,6 @@ define(['require', ...@@ -211,8 +230,6 @@ define(['require',
placeholder: "Select", placeholder: "Select",
allowClear: true allowClear: true
}); });
this.bindSelect2Events();
this.checkForButtonVisiblity();
}, },
updateQueryObject: function(param) { updateQueryObject: function(param) {
if (param && param.searchType) { if (param && param.searchType) {
...@@ -270,78 +287,24 @@ define(['require', ...@@ -270,78 +287,24 @@ define(['require',
typeHeaders: that.typeHeaders, typeHeaders: that.typeHeaders,
entityDefCollection: that.entityDefCollection, entityDefCollection: that.entityDefCollection,
enumDefCollection: that.enumDefCollection, enumDefCollection: that.enumDefCollection,
filterObj: that.filterObj,
classificationDefCollection: that.classificationDefCollection classificationDefCollection: that.classificationDefCollection
}); });
that.attrModal.on('ok', function(e) { that.attrModal.on('ok', function(scope, e) {
that.okAttrFilterButton(); that.okAttrFilterButton(e);
}); });
}); });
}, },
okAttrFilterButton: function() { okAttrFilterButton: function(e) {
var filtertype = this.attrModal.tag ? 'tagFilters' : 'entityFilters', var filtertype = this.attrModal.tag ? 'tagFilters' : 'entityFilters',
rule = this.attrModal.RQueryBuilder.currentView.ui.builder.queryBuilder('getRules'), rule = this.attrModal.RQueryBuilder.currentView.ui.builder.queryBuilder('getRules');
result = this.getQueryBuilderParsData(rule); if (rule) {
this.query[this.type][filtertype] = CommonViewFunction.attributeFilter.generateUrl(rule.rules);
if (result) { this.makeFilterButtonActive(filtertype);
if (!_.isEmpty(result.criterion)) {
this.query[this.type][filtertype] = +new Date();
if (result) {
var filterObj = this.filterObj ? this.filterObj[filtertype] : null;
if (!filterObj) {
filterObj = {};
}
var temp = {}; // IE fix
temp[(this.attrModal.tag ? this.value.tag : this.value.type)] = { 'result': result, 'rule': rule };
_.extend(filterObj, temp);
this.filterObj[filtertype] = filterObj;
this.makeFilterButtonActive(this.attrModal.tag ? 'tag' : 'type');
Utils.localStorage.setValue((filtertype), JSON.stringify(filterObj));
} else {
this.filterObj[filtertype] = null;
this.query[this.type][filtertype] = null;
this.makeFilterButtonActive(this.attrModal.tag ? 'tag' : 'type');
Utils.localStorage.removeValue(filtertype);
}
}
this.attrModal.modal.close(); this.attrModal.modal.close();
} else { if ($(e.currentTarget).hasClass('search')) {
this.filterObj[filtertype] = null; this.findSearchResult();
this.query[this.type][filtertype] = null;
this.makeFilterButtonActive(this.attrModal.tag ? 'tag' : 'type');
Utils.localStorage.removeValue(filtertype);
}
},
getQueryBuilderParsData: function(obj) {
if (obj) {
var parsObj = {
"condition": obj.condition,
"criterion": convertKeyAndExtractObj(obj.rules)
}
} }
function convertKeyAndExtractObj(rules) {
var convertObj = [];
_.each(rules, function(rulObj) {
var tempObj = {}
if (rulObj.rules) {
tempObj = {
"condition": rulObj.condition,
"criterion": convertKeyAndExtractObj(rulObj.rules)
}
} else {
tempObj = {
"attributeName": rulObj.id,
"operator": rulObj.operator,
"attributeValue": (rulObj.type === "date" ? Date.parse(rulObj.value) : rulObj.value)
}
}
convertObj.push(tempObj);
});
return convertObj;
} }
return parsObj;
}, },
manualRender: function(paramObj) { manualRender: function(paramObj) {
this.updateQueryObject(paramObj); this.updateQueryObject(paramObj);
...@@ -408,7 +371,6 @@ define(['require', ...@@ -408,7 +371,6 @@ define(['require',
setTimeout(function() { setTimeout(function() {
that.ui.searchInput.focus(); that.ui.searchInput.focus();
}, 0); }, 0);
//this.searchVent.trigger('searchAttribute', this.value);
} }
}, },
findSearchResult: function() { findSearchResult: function() {
...@@ -482,10 +444,6 @@ define(['require', ...@@ -482,10 +444,6 @@ define(['require',
this.ui.tagLov.val("").trigger("change"); this.ui.tagLov.val("").trigger("change");
this.ui.searchInput.val(""); this.ui.searchInput.val("");
this.checkForButtonVisiblity(); this.checkForButtonVisiblity();
Utils.localStorage.removeValue('tagFilters');
Utils.localStorage.removeValue('entityFilters');
this.filterObj.tagFilters = null;
this.filterObj.entityFilters = null;
Utils.setUrl({ Utils.setUrl({
url: '#!/search/searchResult', url: '#!/search/searchResult',
urlParams: { urlParams: {
......
...@@ -50,17 +50,27 @@ define(['require', ...@@ -50,17 +50,27 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'classificationDefCollection', 'tag', 'filterObj')); _.extend(this, _.pick(options, 'value', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'classificationDefCollection', 'tag'));
this.bindEvents(); this.bindEvents();
var that = this; var that = this;
this.modal = new Modal({ this.modal = new Modal({
title: 'Attribute Filter', title: 'Attribute Filter',
content: this, content: this,
okText: 'Apply',
cancelText: "Cancel",
allowCancel: true, allowCancel: true,
okCloses: false, okCloses: false,
width: '50%' width: '50%',
buttons: [{
text: 'Apply',
btnClass: "ok"
},
{
text: 'Apply & Search',
btnClass: "ok search"
}, {
text: 'Cancel',
btnClass: "cancel"
}
]
}).open(); }).open();
this.modal.on('closeModal', function() { this.modal.on('closeModal', function() {
that.modal.trigger('cancel'); that.modal.trigger('cancel');
...@@ -73,7 +83,6 @@ define(['require', ...@@ -73,7 +83,6 @@ define(['require',
searchVent: this.searchVent, searchVent: this.searchVent,
entityDefCollection: this.entityDefCollection, entityDefCollection: this.entityDefCollection,
enumDefCollection: this.enumDefCollection, enumDefCollection: this.enumDefCollection,
filterObj: this.filterObj,
classificationDefCollection: this.classificationDefCollection classificationDefCollection: this.classificationDefCollection
} }
......
...@@ -62,9 +62,7 @@ define(['require', ...@@ -62,9 +62,7 @@ define(['require',
editEntityButton: "[data-id='editEntityButton']", editEntityButton: "[data-id='editEntityButton']",
createEntity: "[data-id='createEntity']", createEntity: "[data-id='createEntity']",
checkDeletedEntity: "[data-id='checkDeletedEntity']", checkDeletedEntity: "[data-id='checkDeletedEntity']",
containerCheckBox: "[data-id='containerCheckBox']", containerCheckBox: "[data-id='containerCheckBox']"
filterPanel: "#filterPanel",
filterQuery: "#filterQuery"
}, },
templateHelpers: function() { templateHelpers: function() {
return { return {
...@@ -129,8 +127,7 @@ define(['require', ...@@ -129,8 +127,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection', 'filterObj')); _.extend(this, _.pick(options, 'value', 'initialView', 'entityDefCollection', 'typeHeaders', 'searchVent', 'enumDefCollection', 'tagCollection'));
var pagination = "";
this.entityModel = new VEntity(); this.entityModel = new VEntity();
this.searchCollection = new VSearchList(); this.searchCollection = new VSearchList();
this.limit = 25; this.limit = 25;
...@@ -142,7 +139,8 @@ define(['require', ...@@ -142,7 +139,8 @@ define(['require',
includePagination: false, includePagination: false,
includeFooterRecords: false, includeFooterRecords: false,
includeColumnManager: (this.value && this.value.searchType === "basic" ? true : false), includeColumnManager: (this.value && this.value.searchType === "basic" ? true : false),
includeOrderAbleColumns: false, includeOrderAbleColumns: true,
includeSizeAbleColumns: true,
columnOpts: { columnOpts: {
opts: { opts: {
initialColumnsVisible: null, initialColumnsVisible: null,
...@@ -237,9 +235,6 @@ define(['require', ...@@ -237,9 +235,6 @@ define(['require',
this.listenTo(this.searchVent, "search:refresh", function(model, response) { this.listenTo(this.searchVent, "search:refresh", function(model, response) {
this.fetchCollection(); this.fetchCollection();
}, this); }, this);
this.listenTo(this.searchVent, "searchAttribute", function(obj) {
this.showHideFilter(obj);
}, this);
}, },
onRender: function() { onRender: function() {
if (!this.initialView) { if (!this.initialView) {
...@@ -269,76 +264,66 @@ define(['require', ...@@ -269,76 +264,66 @@ define(['require',
this.$(".entityLink").show(); this.$(".entityLink").show();
} }
} }
this.showHideFilter();
}, },
updateColumnList: function(updatedList) { updateColumnList: function(updatedList) {
if (updatedList) { if (updatedList) {
var listOfColumns = [] var listOfColumns = []
_.map(updatedList, function(obj) { _.map(updatedList, function(obj) {
var key = obj.name; var key = obj.name;
if (key == "selected" || key == "displayText" || key == "description" || key == "typeName" || key == "owner" || key == "tag" || key == "terms") {
return;
}
if (obj.renderable) { if (obj.renderable) {
listOfColumns.push(obj.name); listOfColumns.push(obj.name);
} }
}); });
listOfColumns = _.sortBy(listOfColumns);
this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null; this.value.attributes = listOfColumns.length ? listOfColumns.join(",") : null;
} }
this.columnToShow = this.value && this.value.attributes ? this.value.attributes.split(',') : []; this.columnToShow = this.value && this.value.attributes ? this.value.attributes.split(',') : [];
}, },
generateQueryOfFilter: function() { generateQueryOfFilter: function() {
var value = this.value, var value = this.value,
entityFilters = this.filterObj && this.filterObj.entityFilters ? this.filterObj.entityFilters[value.type] : null, entityFilters = CommonViewFunction.attributeFilter.extractUrl(value.entityFilters),
tagFilters = this.filterObj && this.filterObj.tagFilters ? this.filterObj.tagFilters[value.tag] : null, tagFilters = CommonViewFunction.attributeFilter.extractUrl(value.tagFilters),
queryArray = [], queryArray = [],
objToString = function(filterObj) { objToString = function(filterObj) {
var tempObj = []; var tempObj = [];
_.each(filterObj.rules, function(obj) { _.each(filterObj, function(obj) {
tempObj.push('<span class="key">' + obj.field + '</span>&nbsp<span class="operator">' + obj.operator + '</span>&nbsp<span class="value">' + obj.value + "</span>") tempObj.push('<span class="key">' + obj.id + '</span>&nbsp<span class="operator">' + obj.operator + '</span>&nbsp<span class="value">' + obj.value + "</span>")
}); });
return tempObj.join('&nbsp<span class="operator">AND</span>&nbsp'); return tempObj.join('&nbsp<span class="operator">AND</span>&nbsp');
} }
if (value.type) {
var typeKeyValue = '<span class="key">Type:</span>&nbsp<span class="value">' + value.type + '</span>';
if (entityFilters) { if (entityFilters) {
var typeKeyValue = '<span class="key">Type:</span>&nbsp<span class="value">' + value.type + '</span>&nbsp<span class="operator">AND</span>&nbsp'; typeKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(entityFilters);
queryArray = queryArray.concat(typeKeyValue + objToString(entityFilters.rule));
} }
queryArray.push(typeKeyValue)
}
if (value.tag) {
var tagKeyValue = '<span class="key">Tag:</span>&nbsp<span class="value">' + value.tag + '</span>';
if (tagFilters) { if (tagFilters) {
var tagKeyValue = '<span class="key">Tag:</span>&nbsp<span class="value">' + value.tag + '</span>&nbsp<span class="operator">AND</span>&nbsp'; tagKeyValue += '&nbsp<span class="operator">AND</span>&nbsp' + objToString(tagFilters);
queryArray = queryArray.concat(tagKeyValue + objToString(tagFilters.rule));
} }
if (queryArray.length == 2) { queryArray.push(tagKeyValue);
return "<span>(</span>&nbsp" + queryArray.join('<span>&nbsp)</span>&nbsp<span>AND</span>&nbsp<span>(</span>&nbsp') + "&nbsp<span>)</span>";
} else {
return queryArray.join();
} }
}, if (value.query) {
showHideFilter: function() { queryArray.push('<span class="key">Query:</span>&nbsp<span class="value">' + value.query + '</span>&nbsp');
if (this.value) {
if (Utils.getUrlState.isSearchTab() && this.value.searchType == "basic") {
var query = this.generateQueryOfFilter();
if (query) {
this.ui.filterQuery.html(query);
this.ui.filterPanel.show();
} else
this.ui.filterPanel.hide();
} else {
this.ui.filterPanel.hide();
} }
if (queryArray.length == 1) {
return queryArray.join();
} else { } else {
this.ui.filterPanel.hide(); return "<span>(</span>&nbsp" + queryArray.join('<span>&nbsp)</span>&nbsp<span>AND</span>&nbsp<span>(</span>&nbsp') + "&nbsp<span>)</span>";
} }
}, },
fetchCollection: function(value, clickObj) { fetchCollection: function(value, clickObj) {
var that = this, var that = this,
isPostMethod = this.value.searchType === "basic" && Utils.getUrlState.isSearchTab(), isPostMethod = this.value.searchType === "basic" && Utils.getUrlState.isSearchTab(),
tagFilters = this.filterObj && this.filterObj.tagFilters ? this.filterObj.tagFilters[this.value.tag] : null, tagFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.tagFilters),
entityFilters = this.filterObj && this.filterObj.entityFilters ? this.filterObj.entityFilters[this.value.type] : null, entityFilters = CommonViewFunction.attributeFilter.generateAPIObj(this.value.entityFilters),
filterObj = { filterObj = {
'entityFilters': entityFilters ? entityFilters.result : null, 'entityFilters': entityFilters,
'tagFilters': tagFilters ? tagFilters.result : null, 'tagFilters': tagFilters,
'attributes': this.columnToShow.length ? this.columnToShow : null 'attributes': this.columnToShow.length ? _.without(this.columnToShow, "selected", "name", "description", "typeName", "owner", "tag", "terms") : null
} }
this.showLoader(); this.showLoader();
if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) { if (Globals.searchApiCallRef && Globals.searchApiCallRef.readyState === 1) {
...@@ -393,7 +378,7 @@ define(['require', ...@@ -393,7 +378,7 @@ define(['require',
if (that.searchCollection.queryParams.query) { if (that.searchCollection.queryParams.query) {
resultArr.push(that.searchCollection.queryParams.query) resultArr.push(that.searchCollection.queryParams.query)
} }
var searchString = 'Results for <b>' + _.escape(resultArr.join(that.searchType == 'Advanced Search' ? " " : " & ")) + '</b>'; var searchString = 'Results for: <span class="filterQuery">' + that.generateQueryOfFilter() + "</span>";
if (Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab()) { if (Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab()) {
searchString += "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>'; searchString += "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>';
} }
...@@ -412,7 +397,6 @@ define(['require', ...@@ -412,7 +397,6 @@ define(['require',
if (isPostMethod) { if (isPostMethod) {
apiObj['data'] = _.extend({}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification')) apiObj['data'] = _.extend({}, filterObj, _.pick(this.searchCollection.queryParams, 'query', 'excludeDeletedEntities', 'limit', 'offset', 'typeName', 'classification'))
Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj); Globals.searchApiCallRef = this.searchCollection.getBasicRearchResult(apiObj);
this.showHideFilter();
} else { } else {
apiObj.data = null; apiObj.data = null;
Globals.searchApiCallRef = this.searchCollection.fetch(apiObj); Globals.searchApiCallRef = this.searchCollection.fetch(apiObj);
...@@ -441,13 +425,13 @@ define(['require', ...@@ -441,13 +425,13 @@ define(['require',
count = 5; count = 5;
require(['utils/TableLayout'], function(TableLayout) { require(['utils/TableLayout'], function(TableLayout) {
var columnCollection = Backgrid.Columns.extend({ var columnCollection = Backgrid.Columns.extend({
sortKey: "position", sortKey: "displayOrder",
comparator: function(item) { comparator: function(item) {
return item.get(this.sortKey) || 999; return item.get(this.sortKey) || 999;
}, },
setPositions: function() { setPositions: function() {
_.each(this.models, function(model, index) { _.each(this.models, function(model, index) {
model.set("position", index + 1, { silent: true }); model.set("displayOrder", index + 1, { silent: true });
}); });
return this; return this;
} }
...@@ -491,10 +475,13 @@ define(['require', ...@@ -491,10 +475,13 @@ define(['require',
name: "selected", name: "selected",
label: "Select", label: "Select",
cell: "select-row", cell: "select-row",
resizeable: false,
orderable: false,
renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'selected') : true),
headerCell: "select-all" headerCell: "select-all"
}; };
col['displayText'] = { col['name'] = {
label: "Name", label: "Name",
cell: "html", cell: "html",
editable: false, editable: false,
...@@ -556,7 +543,7 @@ define(['require', ...@@ -556,7 +543,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: true, renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'typeName') : true),
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var obj = model.toJSON(); var obj = model.toJSON();
...@@ -590,7 +577,7 @@ define(['require', ...@@ -590,7 +577,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: true, renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'tag') : true),
className: 'searchTag', className: 'searchTag',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
...@@ -612,7 +599,7 @@ define(['require', ...@@ -612,7 +599,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: true, renderable: (that.columnToShow && that.columnToShow.length ? _.contains(that.columnToShow, 'terms') : true),
className: 'searchTerm', className: 'searchTerm',
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
...@@ -636,8 +623,11 @@ define(['require', ...@@ -636,8 +623,11 @@ define(['require',
var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(), collection: this.entityDefCollection, attrMerge: true }); var attrObj = Utils.getNestedSuperTypeObj({ data: def.toJSON(), collection: this.entityDefCollection, attrMerge: true });
_.each(attrObj, function(obj, key) { _.each(attrObj, function(obj, key) {
var key = obj.name, var key = obj.name,
isEenderable = that.columnToShow.length ? _.contains(that.columnToShow, key) : false; isRenderable = _.contains(that.columnToShow, key)
if (key == "name" || key == "description" || key == "owner") { if (key == "name" || key == "description" || key == "owner") {
if (that.columnToShow && that.columnToShow.length) {
col[key].renderable = isRenderable;
}
return; return;
} }
col[obj.name] = { col[obj.name] = {
...@@ -647,7 +637,7 @@ define(['require', ...@@ -647,7 +637,7 @@ define(['require',
sortable: false, sortable: false,
resizeable: true, resizeable: true,
orderable: true, orderable: true,
renderable: isEenderable, renderable: isRenderable,
formatter: _.extend({}, Backgrid.CellFormatter.prototype, { formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
fromRaw: function(rawValue, model) { fromRaw: function(rawValue, model) {
var modelObj = model.toJSON(); var modelObj = model.toJSON();
......
...@@ -59,7 +59,7 @@ define(['require', ...@@ -59,7 +59,7 @@ define(['require',
* @constructs * @constructs
*/ */
initialize: function(options) { initialize: function(options) {
_.extend(this, _.pick(options, 'tag', 'collection', 'typeHeaders', 'filterObj', 'value')); _.extend(this, _.pick(options, 'tag', 'collection', 'typeHeaders', 'value'));
}, },
bindEvents: function() { bindEvents: function() {
var that = this; var that = this;
...@@ -417,15 +417,6 @@ define(['require', ...@@ -417,15 +417,6 @@ define(['require',
} }
that.collection.remove(deleteTagData); that.collection.remove(deleteTagData);
// to update tag list of search tab fetch typeHeaders. // to update tag list of search tab fetch typeHeaders.
var tagList = JSON.parse(Utils.localStorage.getValue('tagFilters'));
if (tagList) {
delete tagList[that.tagName];
}
tagList = _.isEmpty(tagList) ? null : tagList;
if (that.filterObj['tagFilters'] && that.filterObj['tagFilters'][that.tagName]) {
delete that.filterObj['tagFilters'][that.tagName];
}
Utils.localStorage.setValue('tagFilters', JSON.stringify(tagList));
that.typeHeaders.fetch({ reset: true }); that.typeHeaders.fetch({ reset: true });
} }
}); });
......
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