From 3dcf19dffa1ea047b7baa1c54a7dc8f4b6b56ed8 Mon Sep 17 00:00:00 2001 From: Vinojini Paramasivam Date: Fri, 27 Sep 2019 05:51:59 +0000 Subject: [PATCH] Show the applied policies when click view button on policy compliance --- .../cdmf.page.effective-policy.view/view.hbs | 1 + .../public/js/view.js | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs index 4fbf555f53..c8c9b5e23c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.effective-policy.view/view.hbs @@ -40,4 +40,5 @@ {{#zone "content"}} {{unit "cdmf.unit.device.operation-mod"}} {{unit "cdmf.unit.effective-policy.view"}} + {{unit "cdmf.unit.lib.data-table"}} {{/zone}} \ No newline at end of file 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 a2b2e27b94..acc427d16f 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 @@ -76,25 +76,26 @@ var displayPolicy = function (policyPayloadObj) { var policyOperationsStylesSrc = context + '/public/cdmf.unit.device.type.' + deviceType + '.policy-view/css/' + deviceType + '-policy-view.css'; var policyOperationsTemplateCacheKey = deviceType + '-policy-operations'; - - $.isResourceExists(policyOperationsTemplateSrc, function (status) { + + if (policyOperationsTemplateSrc) { + if (policyOperationsScriptSrc) { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = policyOperationsScriptSrc; + $(".wr-advance-operations").prepend(script); + } $.template(policyOperationsTemplateCacheKey, policyOperationsTemplateSrc, function (template) { var content = template(); $("#device-type-policy-operations").html(content).removeClass("hidden"); $(".policy-platform").addClass("hidden"); - $.isResourceExists(policyOperationsScriptSrc, function (status) { - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = policyOperationsScriptSrc; - $(".wr-advance-operations").prepend(script); + if (policyOperationsScriptSrc) { /* This method should be implemented in the relevant plugin side and should include the logic to populate the policy profile in the plugin specific UI. */ polulateProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]); - }); + } }); - $.isResourceExists(policyOperationsStylesSrc, function (status) { var style = document.createElement('link'); style.type = 'text/css'; @@ -104,7 +105,7 @@ var displayPolicy = function (policyPayloadObj) { }); $(".wr-advance-operations-init").addClass("hidden"); - }); + } }; /**