From a831dc6a9a17e4d2b254dff4b057924135363a0e Mon Sep 17 00:00:00 2001 From: Supun94 Date: Mon, 19 Dec 2016 15:28:28 +0530 Subject: [PATCH] Changing cdm-config file --- .../public/js/device-view.js | 7 --- .../public/js/view.js | 56 +++++++++++-------- .../repository/conf/cdm-config.xml | 2 +- .../src/main/resources/conf/cdm-config.xml | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js index 0241ceefcf..3672656fd4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js @@ -16,7 +16,6 @@ * under the License. */ -(function () { var deviceId = $(".device-id"); var deviceIdentifier = deviceId.data("deviceid"); var deviceType = deviceId.data("type"); @@ -136,13 +135,9 @@ function loadPolicyCompliance() { var policyCompliance = $("#policy-view"); var policyComplianceTemplate = policyCompliance.attr("src"); - console.log("deviceId:"+deviceId); - console.log("deviceType:"+deviceType); var deviceId = policyCompliance.data("device-id"); var deviceType = policyCompliance.data("device-type"); var activePolicy = null; - console.log("deviceId:"+deviceId); - console.log("deviceType:"+deviceType); $.template( "policy-view", @@ -213,5 +208,3 @@ } ); } - -}()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js index cebbaef87f..a41d89fa1b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.effective-policy.view/public/js/view.js @@ -38,32 +38,40 @@ var displayPolicy = function (policyPayloadObj) { } $("#policy-status").html(policyStatus); - console.log(policyPayloadObj); - // if (policyPayloadObj.users.length > 0) { - // $("#policy-users").text(policyPayloadObj.users.toString().split(",").join(", ")); - // } else { - // $("#users-row").addClass("hidden"); - // } - // if (policyPayloadObj.deviceGroups.length > 0) { - // debugger; - // var deviceGroups = policyPayloadObj.deviceGroups; - // var assignedGroups = []; - // for (var index in deviceGroups) { - // if (deviceGroups.hasOwnProperty(index)) { - // assignedGroups.push(deviceGroups[index].name); - // } - // } - // $("#policy-groups").text(assignedGroups.toString().split(",").join(", ")); - // } else { - // $("#policy-groups").text("NONE"); - // } + if (policyPayloadObj.users == null) { + $("#policy-users").text("NONE"); + } + else if (policyPayloadObj.users.length > 0) { + $("#policy-users").text(policyPayloadObj.users.toString().split(",").join(", ")); + } else { + $("#users-row").addClass("hidden"); + } + + if (policyPayloadObj.deviceGroups == null) { + $("#policy-groups").text("NONE"); + } else if (policyPayloadObj.deviceGroups.length > 0) { + debugger; + var deviceGroups = policyPayloadObj.deviceGroups; + var assignedGroups = []; + for (var index in deviceGroups) { + if (deviceGroups.hasOwnProperty(index)) { + assignedGroups.push(deviceGroups[index].name); + } + } + $("#policy-groups").text(assignedGroups.toString().split(",").join(", ")); + } else { + $("#policy-groups").text("NONE"); + } - // if (policyPayloadObj.roles.length > 0) { - // $("#policy-roles").text(policyPayloadObj.roles.toString().split(",").join(", ")); - // } else { - // $("#roles-row").addClass("hidden"); - // } + if (policyPayloadObj.roles == null) { + $("#policy-roles").text("NONE"); + } + else if (policyPayloadObj.roles.length > 0) { + $("#policy-roles").text(policyPayloadObj.roles.toString().split(",").join(", ")); + } else { + $("#roles-row").addClass("hidden"); + } var deviceType = policy["platform"]; var policyOperationsTemplateSrc = context + '/public/cdmf.unit.device.type.' + deviceType + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml index 3e2078ad11..98be922a1c 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml @@ -43,7 +43,7 @@ 8 20 - Merged + Simple diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml index 44d131dea2..e48531dd83 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml @@ -46,7 +46,7 @@ - Merged + Simple android ios