From f3da8d4a57dc3b236693e51762e1e97cdc4383f0 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 14 Mar 2018 22:07:20 +0530 Subject: [PATCH 1/2] Adding filter value options for data-dep-status and data-boolean --- .../jaggeryapps/devicemgt/api/data-tables-invoker-api.jag | 1 + .../public/js/dataTables.extended.js | 8 ++++++++ .../public/js/dataTables.extended.serversidepaging.js | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag index a0ddd0e294..146abcf0d0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/api/data-tables-invoker-api.jag @@ -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"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js index d33cc3b4df..7422a3c1f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js @@ -134,6 +134,14 @@ $.fn.datatables_extended = function (settings) { var compliance = cachedFilterRes.compliance[i]; select.append('') } + } 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('') + } + } else if (filterColumn.eq(column.index()).hasClass('data-boolean')) { + select.append(''); + select.append(''); } else if ($(column.nodes()).attr('data-search')) { var values = []; column.nodes().unique().sort().each(function (d, j) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js index 85af438c1c..58a26211d4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js @@ -202,6 +202,14 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter var compliance = cachedFilterRes.compliance[i]; select.append('') } + } 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('') + } + } else if (filterColumn.eq(column.index()).hasClass('data-boolean')) { + select.append(''); + select.append(''); } else if ($(column.nodes()).attr('data-search')) { var titles = []; column.nodes().unique().sort().each(function (d, j) { From b04af4959499dea35194aa80b9b60ffd4d1c0fea Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 14 Mar 2018 22:15:16 +0530 Subject: [PATCH 2/2] Fix minor formatting issue --- .../public/js/dataTables.extended.js | 10 +++++----- .../public/js/dataTables.extended.serversidepaging.js | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js index 7422a3c1f3..3914111525 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.js @@ -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('') } } 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('') } } 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,12 +130,12 @@ $.fn.datatables_extended = function (settings) { select.append('') } } 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('') } } else if (filterColumn.eq(column.index()).hasClass('data-dep-status')) { - for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){ + for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) { var depStatus = cachedFilterRes.depStatus[i]; select.append('') } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js index 58a26211d4..a560cc8220 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.data-tables-extended/public/js/dataTables.extended.serversidepaging.js @@ -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('') } } 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('') } } 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,12 +198,12 @@ $.fn.datatables_extended_serverside_paging = function (settings, url, dataFilter select.append('') } } 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('') } } else if (filterColumn.eq(column.index()).hasClass('data-dep-status')) { - for(i = 0; i < cachedFilterRes.deviceTypes.length; i++){ + for (i = 0; i < cachedFilterRes.deviceTypes.length; i++) { var depStatus = cachedFilterRes.depStatus[i]; select.append('') }