From 2e5261b0256e70ac4d43b7da3e74202b5975030d Mon Sep 17 00:00:00 2001 From: Dileesha Rajapakse Date: Mon, 21 Aug 2017 17:37:39 +0530 Subject: [PATCH 1/2] Added a Refresh button to the application list tab in the device view --- .../cdmf.unit.device.view/public/css/main.css | 1 + .../public/js/device-view.js | 50 ++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css index 60d195c471..2fbb99f134 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css @@ -142,6 +142,7 @@ } .tab-actions { margin: 0px; + margin-bottom: 10px; } .tab-actions .action-prop{ padding: 10px; 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 50c6dfa07a..6ffda98459 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 @@ -33,7 +33,6 @@ $(document).ready(function() { loadPolicyCompliance(); } - $("#refresh-policy").click(function() { $('#policy-spinner').removeClass('hidden'); loadPolicyCompliance(); @@ -44,6 +43,11 @@ $(document).ready(function() { loadOperationsLog(true); }); + $("#refresh-apps").click(function() { + $('#apps-spinner').removeClass('hidden'); + loadApplicationsList(); + }); + }); function getLogStatusIcon(entry) { @@ -267,3 +271,47 @@ function loadPolicyCompliance() { } ); } + +function loadApplicationsList() { + var applicationsList = $("#applications-list"); + var applicationListingTemplate = applicationsList.attr("src"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + + $.template("application-list", applicationListingTemplate, function (template) { + var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/applications"; + invokerUtil.get( + serviceURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + data = JSON.parse(data); + $("#apps-spinner").addClass("hidden"); + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + data[i]["name"] = decodeURIComponent(data[i]["name"]); + data[i]["platform"] = deviceType; + } + + var viewModel = {}; + viewModel["applications"] = data; + viewModel["deviceType"] = deviceType; + viewModel["deviceId"] = deviceId; + viewModel["appContext"] = context; + var content = template(viewModel); + $("#applications-list-container").html(content); + var iconSource = $("#applications-list-container").data("public-uri") + "/img/android_app_icon.png"; + $("#applications-list-container img").attr("src",iconSource); + } else { + $("#applications-list-container").html("

No applications found.

" + + "

Please try refreshing the list in a while.

"); + } + } + }, + // error-callback + function () { + $("#applications-list-container").html("

 Loading application list " + + "was not successful. please try refreshing the list in a while.

"); + }); + }); +} From ae4442f4f345ceb5bfd6c11eff09b1236f012b70 Mon Sep 17 00:00:00 2001 From: Dileesha Rajapakse Date: Tue, 22 Aug 2017 00:11:35 +0530 Subject: [PATCH 2/2] Refactored the device group view --- .../app/pages/cdmf.page.groups/{ => public}/css/groups.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/{ => public}/css/groups.css (71%) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css similarity index 71% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css index 07e0846abe..7300a7637c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css @@ -1,3 +1,3 @@ -.dataTablesTop .dataTables_toolbar ul li:nth-child(1), .dataTables_toolbar ul li:nth-child(2){ +.dataTablesTop .dataTables_toolbar ul li:nth-child(1), .dataTables_toolbar ul li:nth-child(2) { display: none; } \ No newline at end of file