Merge pull request #1225 from rasika/master

Adding filter value options for data-dep-status and data-boolean
revert-70aa11f8
Rasika Perera 7 years ago committed by GitHub
commit 5d1e4ed99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -74,6 +74,7 @@ if (uriMatcher.match("/{context}/api/data-tables/invoker/filters")) {
}
//Adding policy compliance
result.compliance = ["MONITOR", "ENFORCE", "WARN", "BLOCK"];
result.depStatus = ["Empty", "Assigned", "Pushed", "Removed"];
response["status"] = 200;
response["content"] = result;
response["contentType"] = "application/json";

@ -109,17 +109,17 @@ $.fn.datatables_extended = function (settings) {
$(column).each(function () {
var i;
if (filterColumn.eq(column.index()).hasClass('data-status')) {
for(i = 0; i < cachedFilterRes.status.length; i++){
for (i = 0; i < cachedFilterRes.status.length; i++) {
var status = cachedFilterRes.status[i];
select.append('<option value="' + status + '">' + status + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-ownership')) {
for(i = 0; i < cachedFilterRes.ownership.length; i++){
for (i = 0; i < cachedFilterRes.ownership.length; i++) {
var ownership = cachedFilterRes.ownership[i];
select.append('<option value="' + ownership + '">' + ownership + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-platform')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var deviceTypes = cachedFilterRes.deviceTypes[i];
var name = deviceTypes;
var value = deviceTypes;
@ -130,10 +130,18 @@ $.fn.datatables_extended = function (settings) {
select.append('<option value="' + value + '">' + name + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-compliance')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var compliance = cachedFilterRes.compliance[i];
select.append('<option value="' + compliance + '">' + compliance + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-dep-status')) {
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var depStatus = cachedFilterRes.depStatus[i];
select.append('<option value="' + depStatus + '">' + depStatus + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-boolean')) {
select.append('<option value="true">Enabled</option>');
select.append('<option value="false">Disabled</option>');
} else if ($(column.nodes()).attr('data-search')) {
var values = [];
column.nodes().unique().sort().each(function (d, j) {

@ -177,17 +177,17 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
$(column).each(function () {
var i;
if (filterColumn.eq(column.index()).hasClass('data-status')) {
for(i = 0; i < cachedFilterRes.status.length; i++){
for (i = 0; i < cachedFilterRes.status.length; i++) {
var status = cachedFilterRes.status[i];
select.append('<option value="' + status + '">' + status + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-ownership')) {
for(i = 0; i < cachedFilterRes.ownership.length; i++){
for (i = 0; i < cachedFilterRes.ownership.length; i++) {
var ownership = cachedFilterRes.ownership[i];
select.append('<option value="' + ownership + '">' + ownership + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-platform')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var deviceTypes = cachedFilterRes.deviceTypes[i];
var name = deviceTypes;
var value = deviceTypes;
@ -198,10 +198,18 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter
select.append('<option value="' + value + '">' + name + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-compliance')) {
for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var compliance = cachedFilterRes.compliance[i];
select.append('<option value="' + compliance + '">' + compliance + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-dep-status')) {
for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) {
var depStatus = cachedFilterRes.depStatus[i];
select.append('<option value="' + depStatus + '">' + depStatus + '</option>')
}
} else if (filterColumn.eq(column.index()).hasClass('data-boolean')) {
select.append('<option value="true">Enabled</option>');
select.append('<option value="false">Disabled</option>');
} else if ($(column.nodes()).attr('data-search')) {
var titles = [];
column.nodes().unique().sort().each(function (d, j) {

Loading…
Cancel
Save