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 3acdc053879..20cc6f96f51 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 @@ -17,7 +17,6 @@ */ (function () { - var deviceId = $(".device-id"); var deviceIdentifier = deviceId.data("deviceid"); var deviceType = deviceId.data("type"); @@ -46,7 +45,7 @@ }); }); - + function loadOperationsLog(update) { var operationsLogTable = "#operations-log-table"; if (update) { @@ -58,92 +57,67 @@ serverSide: true, processing: false, searching: false, - ordering: false, - pageLength: 10, + ordering: false, + pageLength : 10, order: [], ajax: { - url: "/emm/api/operation/paginate", - data: { - deviceId: deviceIdentifier, - deviceType: deviceType - }, + url: context + "/api/operation/paginate", + data: {deviceId : deviceIdentifier, deviceType: deviceType}, dataSrc: function (json) { - $("#operations-spinner").addClass( - "hidden"); + $("#operations-spinner").addClass("hidden"); $("#operations-log-container").empty(); return json.data; } }, columnDefs: [ - {targets: 0, data: "code"}, - { - targets: 1, - data: "status", - render: function (status) { + {targets: 0, data: "code" }, + {targets: 1, data: "status", render: + function (status) { var html; switch (status) { case "COMPLETED" : - html = - " Completed"; + html = " Completed"; break; case "PENDING" : - html = - " Pending"; + html = " Pending"; break; case "ERROR" : - html = - " Error"; + html = " Error"; break; case "IN_PROGRESS" : - html = - " In Progress"; + html = " In Progress"; break; case "REPEATED" : - html = - " Repeated"; + html = " Repeated"; break; } return html; } }, - { - targets: 2, - data: "createdTimeStamp", - render: function (date) { + {targets: 2, data: "createdTimeStamp", render: + function (date) { var value = String(date); return value.slice(0, 16); } } ], - "createdRow": function (row, data) { + "createdRow": function(row, data) { $(row).attr("data-type", "selectable"); $(row).attr("data-id", data["id"]); $.each($("td", row), - function (colIndex) { - switch (colIndex) { + function(colIndex) { + switch(colIndex) { case 1: - $(this).attr( - "data-grid-label", - "Code"); - $(this).attr( - "data-display", - data["code"]); + $(this).attr("data-grid-label", "Code"); + $(this).attr("data-display", data["code"]); break; case 2: - $(this).attr( - "data-grid-label", - "Status"); - $(this).attr( - "data-display", - data["status"]); + $(this).attr("data-grid-label", "Status"); + $(this).attr("data-display", data["status"]); break; case 3: - $(this).attr( - "data-grid-label", - "Created Timestamp"); - $(this).attr( - "data-display", - data["createdTimeStamp"]); + $(this).attr("data-grid-label", "Created Timestamp"); + $(this).attr("data-display", data["createdTimeStamp"]); break; } } @@ -163,10 +137,8 @@ "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"; + 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, @@ -191,8 +163,7 @@ if (data["complianceData"]["complianceFeatures"] && data["complianceData"]["complianceFeatures"].length > 0) { viewModel["compliance"] = "NON-COMPLIANT"; - viewModel["complianceFeatures"] = - data["complianceData"]["complianceFeatures"]; + viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"]; content = template(viewModel); $("#policy-list-container").html(content); } else { @@ -202,18 +173,17 @@ $("#policy-compliance-table").addClass("hidden"); } } else { - $("#policy-list-container").html( - "
This device " + - "has no policy applied.
This device " + + "has no policy applied.
Loading policy compliance related data " - + - "was not successful. please try refreshing data in a while.
Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.
Loading policy compliance related data " - + - "was not successful. please try refreshing data in a while.
Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.