From e3905e793d675c7daeb1b746ee32467a75fad92c Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 17 Oct 2019 19:36:49 +0530 Subject: [PATCH] Add policy type and corrective action UI for view policy --- .../cdmf.unit.policy.view/public/js/view.js | 15 +++++++++++ .../app/units/cdmf.unit.policy.view/view.hbs | 25 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.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.policy.view/public/js/view.js index cf9a711f42..5e3b17092d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.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.policy.view/public/js/view.js @@ -28,6 +28,7 @@ var displayPolicy = function (policyPayloadObj) { $("#policy-assignment").text(policyPayloadObj.deviceGroups); $("#policy-action").text(policyPayloadObj.compliance.toUpperCase()); $("#policy-description").text(policyPayloadObj["description"]); + $("#policy-type").text(policyPayloadObj.policyType); var policyStatus = "Active"; if (policyPayloadObj["active"] === true && policyPayloadObj["updated"] === true) { policyStatus = ' Active/Updated'; @@ -68,6 +69,20 @@ var displayPolicy = function (policyPayloadObj) { $("#policy-roles").text(policyPayloadObj.roles.toString().split(",").join(", ")); } + if ("GENERAL" === policyPayloadObj.policyType && + policyPayloadObj.correctiveActions && policyPayloadObj.correctiveActions.length > 0) { + policyPayloadObj.correctiveActions.forEach(function (correctiveAction) { + if ("POLICY" === correctiveAction.actionType) { + $("#corrective-action-type-policy-id").html(correctiveAction.policyId); + return true; + } + }); + $("#policy-corrective-actions-list").removeClass("hidden"); + } else { + $("#policy-corrective-actions-list").addClass("hidden"); + } + + var policyId = policyPayloadObj["id"]; var deviceType = policy["platform"]; var policyOperations = $("#policy-operations"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs index 5fb0aed14f..8ac41acee8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs @@ -34,7 +34,7 @@ Action upon non-compliance - + Status @@ -46,9 +46,32 @@ Assigned Roles + + Policy Type + + {{/defineZone}} +
Description