Loading application list " +
+ "was not successful. please try refreshing the list in a while.
");
});
});
}
+ function loadPolicyCompliance() {
+ var policyCompliance = $("#policy-view");
+ var policyComplianceTemplate = policyCompliance.attr("src");
+ var deviceId = policyCompliance.data("device-id");
+ var deviceType = policyCompliance.data("device-type");
+ var activePolicy = null;
+
+ $.template(
+ "policy-view",
+ policyComplianceTemplate,
+ function (template) {
+ var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy";
+ var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data";
+
+ invokerUtil.get(
+ getEffectivePolicyURL,
+ // success-callback
+ function (data, textStatus, jqXHR) {
+ if (jqXHR.status == 200 && data) {
+ data = JSON.parse(data);
+ $("#policy-spinner").addClass("hidden");
+ if (data["active"] == true) {
+ activePolicy = data;
+ invokerUtil.get(
+ getDeviceComplianceURL,
+ // success-callback
+ function (data, textStatus, jqXHR) {
+ if (jqXHR.status == 200 && data) {
+ var viewModel = {};
+ viewModel["policy"] = activePolicy;
+ viewModel["deviceType"] = deviceType;
+ data = JSON.parse(data);
+ var content;
+ if (data["complianceData"]) {
+ if (data["complianceData"]["complianceFeatures"] &&
+ data["complianceData"]["complianceFeatures"].length > 0) {
+ viewModel["compliance"] = "NON-COMPLIANT";
+ viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"];
+ content = template(viewModel);
+ $("#policy-list-container").html(content);
+ } else {
+ viewModel["compliance"] = "COMPLIANT";
+ content = template(viewModel);
+ $("#policy-list-container").html(content);
+ $("#policy-compliance-table").addClass("hidden");
+ }
+ } else {
+ $("#policy-list-container").
+ html(" This device " +
+ "has no policy applied.
");
+ }
+ }
+ },
+ // error-callback
+ function () {
+ $("#policy-list-container").
+ html(" Loading policy compliance related data " +
+ "was not successful. please try refreshing data in a while.
");
+ }
+ );
+ }
+ }
+ },
+ // error-callback
+ function () {
+ $("#policy-list-container").
+ html(" Loading policy compliance related data " +
+ "was not successful. please try refreshing data in a while.
");
+ }
+ );
+ }
+ );
+ }
}());
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs
index 5becb8e14..3662eb6b1 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/mdm.page.devices/devices.hbs
@@ -50,7 +50,7 @@
{{/if}}
{{#if permissions.ADVANCED_SEARCH}}