Commit 4ab49623 by kevalbhatt

ATLAS-3978: In Administration, Audits filter for 'OR' condition does not work

parent 70c1087a
...@@ -459,6 +459,7 @@ define(['require', ...@@ -459,6 +459,7 @@ define(['require',
this.activePage = Math.round(this.pageTo / this.limit); this.activePage = Math.round(this.pageTo / this.limit);
this.ui.activePage.attr('title', "Page " + this.activePage); this.ui.activePage.attr('title', "Page " + this.activePage);
this.ui.activePage.text(this.activePage); this.ui.activePage.text(this.activePage);
this.ui.showPage.val(this.limit).trigger('change', { "skipViewChange": true });
}, },
/** /**
......
...@@ -127,19 +127,6 @@ define(['require', ...@@ -127,19 +127,6 @@ define(['require',
that.ui.attrFilter.find('.fa-angle-right').toggleClass('fa-angle-down'); that.ui.attrFilter.find('.fa-angle-right').toggleClass('fa-angle-down');
that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide'); that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
}, },
getAttributes: function(options) {
var adminAttributes = [];
if (options.isFilter) {
_.each(options.isFilter, function(adminFilter) {
adminAttributes.push({
"attributeName": adminFilter.id,
"operator": adminFilter.operator,
"attributeValue": (adminFilter.type == "date" && options.isDateParsed) ? Date.parse(adminFilter.value).toString() : adminFilter.value
})
})
}
return adminAttributes;
},
onClickAttrFilter: function() { onClickAttrFilter: function() {
var that = this; var that = this;
this.ui.adminRegion.show(); this.ui.adminRegion.show();
...@@ -154,6 +141,7 @@ define(['require', ...@@ -154,6 +141,7 @@ define(['require',
if (queryBuilderRef.data("queryBuilder")) { if (queryBuilderRef.data("queryBuilder")) {
var queryBuilder = queryBuilderRef.queryBuilder("getRules"); var queryBuilder = queryBuilderRef.queryBuilder("getRules");
if (queryBuilder) { if (queryBuilder) {
that.ruleUrl = that.searchTableFilters["adminAttrFilters"] = CommonViewFunction.attributeFilter.generateUrl({ value: queryBuilder, formatedDateToLong: true });
that.isFilters = queryBuilder.rules.length ? queryBuilder.rules : null; that.isFilters = queryBuilder.rules.length ? queryBuilder.rules : null;
} else { } else {
isFilterValidate = false isFilterValidate = false
...@@ -167,24 +155,8 @@ define(['require', ...@@ -167,24 +155,8 @@ define(['require',
}, },
getAdminCollection: function(option) { getAdminCollection: function(option) {
var that = this, var that = this,
options = { auditFilters = CommonViewFunction.attributeFilter.generateAPIObj(that.ruleUrl);
isDateParsed: true, $.extend(that.entityCollection.queryParams, { auditFilters: that.isFilters ? auditFilters : null });
isFilter: this.isFilters
},
adminParam = {
condition: "AND",
criterion: that.getAttributes(options)
};
options.isDateParsed = false;
if (this.isFilters) {
var auditQueryParam = {
condition: "AND",
criterion: that.getAttributes(options)
};
that.searchTableFilters["adminAttrFilters"] = CommonViewFunction.attributeFilter.generateUrl({ value: auditQueryParam, formatedDateToLong: true });
}
$.extend(that.entityCollection.queryParams, { auditFilters: that.isFilters ? adminParam : null });
var apiObj = { var apiObj = {
sort: false, sort: false,
data: that.entityCollection.queryParams, data: that.entityCollection.queryParams,
......
...@@ -459,6 +459,7 @@ define(['require', ...@@ -459,6 +459,7 @@ define(['require',
this.activePage = Math.round(this.pageTo / this.limit); this.activePage = Math.round(this.pageTo / this.limit);
this.ui.activePage.attr('title', "Page " + this.activePage); this.ui.activePage.attr('title', "Page " + this.activePage);
this.ui.activePage.text(this.activePage); this.ui.activePage.text(this.activePage);
this.ui.showPage.val(this.limit).trigger('change', { "skipViewChange": true });
}, },
/** /**
......
...@@ -127,19 +127,6 @@ define(['require', ...@@ -127,19 +127,6 @@ define(['require',
that.ui.attrFilter.find('.fa-angle-right').toggleClass('fa-angle-down'); that.ui.attrFilter.find('.fa-angle-right').toggleClass('fa-angle-down');
that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide'); that.$('.attribute-filter-container, .attr-filter-overlay').toggleClass('hide');
}, },
getAttributes: function(options) {
var adminAttributes = [];
if (options.isFilter) {
_.each(options.isFilter, function(adminFilter) {
adminAttributes.push({
"attributeName": adminFilter.id,
"operator": adminFilter.operator,
"attributeValue": (adminFilter.type == "date" && options.isDateParsed) ? Date.parse(adminFilter.value).toString() : adminFilter.value
})
})
}
return adminAttributes;
},
onClickAttrFilter: function() { onClickAttrFilter: function() {
var that = this; var that = this;
this.ui.adminRegion.show(); this.ui.adminRegion.show();
...@@ -154,6 +141,7 @@ define(['require', ...@@ -154,6 +141,7 @@ define(['require',
if (queryBuilderRef.data("queryBuilder")) { if (queryBuilderRef.data("queryBuilder")) {
var queryBuilder = queryBuilderRef.queryBuilder("getRules"); var queryBuilder = queryBuilderRef.queryBuilder("getRules");
if (queryBuilder) { if (queryBuilder) {
that.ruleUrl = that.searchTableFilters["adminAttrFilters"] = CommonViewFunction.attributeFilter.generateUrl({ value: queryBuilder, formatedDateToLong: true });
that.isFilters = queryBuilder.rules.length ? queryBuilder.rules : null; that.isFilters = queryBuilder.rules.length ? queryBuilder.rules : null;
} else { } else {
isFilterValidate = false isFilterValidate = false
...@@ -167,24 +155,8 @@ define(['require', ...@@ -167,24 +155,8 @@ define(['require',
}, },
getAdminCollection: function(option) { getAdminCollection: function(option) {
var that = this, var that = this,
options = { auditFilters = CommonViewFunction.attributeFilter.generateAPIObj(that.ruleUrl);
isDateParsed: true, $.extend(that.entityCollection.queryParams, { auditFilters: that.isFilters ? auditFilters : null });
isFilter: this.isFilters
},
adminParam = {
condition: "AND",
criterion: that.getAttributes(options)
};
options.isDateParsed = false;
if (this.isFilters) {
var auditQueryParam = {
condition: "AND",
criterion: that.getAttributes(options)
};
that.searchTableFilters["adminAttrFilters"] = CommonViewFunction.attributeFilter.generateUrl({ value: auditQueryParam, formatedDateToLong: true });
}
$.extend(that.entityCollection.queryParams, { auditFilters: that.isFilters ? adminParam : null });
var apiObj = { var apiObj = {
sort: false, sort: false,
data: that.entityCollection.queryParams, data: that.entityCollection.queryParams,
......
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