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 cf6b1dda7c7..21df8054372 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 @@ -46,7 +46,16 @@ $(document).ready(function() { }); -function loadOperationsLog() { +function loadOperationsLog(update) { + var operationsLogTable = "#operation-log"; + if (update) { + operationTable = $(operationsLogTable).DataTable(); + $("#operations-spinner").removeClass("hidden"); + operationTable.ajax.reload(function(json) { + $("#operations-spinner").addClass("hidden"); + }, false); + return; + } var table = $('#operation-log').DataTable({ serverSide: true, processing: false, @@ -164,101 +173,6 @@ function loadOperationsLog() { } } -function loadOperationsLog2(update) { - var operationsLogTable = "#operations-log-table"; - - if (update) { - operationTable = $(operationsLogTable).DataTable(); - $("#operations-spinner").removeClass("hidden"); - operationTable.ajax.reload(function(json) { - $("#operations-spinner").addClass("hidden"); - }, false); - return; - } - operationTable = $(operationsLogTable).datatables_extended({ - serverSide: true, - processing: false, - searching: false, - ordering: false, - pageLength: 10, - order: [], - ajax: { - url: "/devicemgt/api/operation/paginate", - data: { - deviceId: deviceIdentifier, - deviceType: deviceType, - owner: deviceOwner - }, - dataSrc: function(json) { - $("#operations-spinner").addClass("hidden"); - $("#operations-log-container").empty(); - return json.data; - } - }, - columnDefs: [{ - targets: 0, - data: "code" - }, - { - targets: 1, - data: "status", - render: function(status) { - var html; - switch (status) { - case "COMPLETED": - html = " Completed"; - break; - case "PENDING": - html = " Pending"; - break; - case "ERROR": - html = " Error"; - break; - case "IN_PROGRESS": - html = " In Progress"; - break; - case "REPEATED": - html = " Repeated"; - break; - } - return html; - } - }, - { - targets: 2, - data: "createdTimeStamp", - render: function(date) { - var value = String(date); - return value.slice(0, 16); - } - } - ], - "createdRow": function(row, data) { - - $(row).attr("data-type", "selectable"); - $(row).attr("data-id", data["id"]); - $.each($("td", row), - function(colIndex) { - switch (colIndex) { - case 1: - $(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"]); - break; - case 3: - $(this).attr("data-grid-label", "Created Timestamp"); - $(this).attr("data-display", data["createdTimeStamp"]); - break; - } - } - ); - } - }); -} - function loadPolicyCompliance() { var policyCompliance = $("#policy-view"); var policyComplianceTemplate = policyCompliance.attr("src"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs index e9b704cd7a1..8e56318b742 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.hbs @@ -56,10 +56,8 @@ -