From f85e28c9028aa3a12d8741454483274673a213f5 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 23 Sep 2016 15:57:04 +0530 Subject: [PATCH] Fix for jira: https://wso2.org/jira/browse/EMM-1622 --- .../public/js/device-detail.js | 148 ++++++++++-------- .../app/units/mdm.unit.device.view/view.hbs | 68 ++++---- 2 files changed, 116 insertions(+), 100 deletions(-) diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js index 155c2568e..b63799b1e 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/public/js/device-detail.js @@ -22,39 +22,37 @@ var InitiateViewOption = null; var deviceId = $(".device-id"); var deviceIdentifier = deviceId.data("deviceid"); var deviceType = deviceId.data("type"); - var payload = [deviceIdentifier]; var operationTable; - var serviceUrl; - - if (deviceType == "ios") { - serviceUrl = "/ios/operation/deviceinfo"; - } else if (deviceType == "android") { - //var serviceUrl = "/mdm-android-agent/operation/device-info"; - serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; - } - - if (serviceUrl) { - invokerUtil.post( - serviceUrl, - payload, - // success-callback - function () { - $(".panel-body").show(); - }, - // error-callback - function () { - var defaultInnerHTML = - "

 Device data may not have been updated. Please refresh to try again.

"; - $(".panel-body").append(defaultInnerHTML); - } - ); - } + // var payload = [deviceIdentifier]; + // var serviceUrl; +// if (deviceType == "ios") { +// serviceUrl = "/ios/operation/deviceinfo"; +// } else if (deviceType == "android") { +// //var serviceUrl = "/mdm-android-agent/operation/device-info"; +// serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; +// } +// +// if (serviceUrl) { +// invokerUtil.post( +// serviceUrl, +// payload, +// // success-callback +// function () { +// $(".panel-body").show(); +// }, +// // error-callback +// function () { +// var defaultInnerHTML = +// "

 Device data may not have been updated. Please refresh to try again.

"; +// $(".panel-body").append(defaultInnerHTML); +// } +// ); +// } $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { var activeTabPane = $(e.target).attr("href"); var activeListGroupItem = $(".media .list-group-item.active"); - $(activeTabPane).removeClass("visible-xs-block"); $(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block"); positionArrow(activeListGroupItem); @@ -62,25 +60,21 @@ var InitiateViewOption = null; $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { var thisParent = $(e.target).parent(); - var activeTabPaneCaret = thisParent.find('.caret-updown'); - var activeTabPaneCaretSiblings = thisParent.siblings().find('.caret-updown'); - + var activeTabPaneCaret = thisParent.find(".caret-updown"); + var activeTabPaneCaretSiblings = thisParent.siblings().find(".caret-updown"); activeTabPaneCaret.removeClass("fw-up").addClass("fw-down"); activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up"); }); - - $('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){ + $(".media.tab-responsive a[data-toggle='collapse']").on("click", function () { var clickedPanel = $(this).attr('href'); - - if($(clickedPanel).hasClass('in')){ + if ($(clickedPanel).hasClass('in')) { $(clickedPanel).collapse('hide'); - }else{ + } else { $(clickedPanel).collapse('show'); } }); - function positionArrow(selectedTab) { var selectedTabHeight = $(selectedTab).innerHeight(); var arrowPosition = 0; @@ -108,30 +102,6 @@ var InitiateViewOption = null; $(arrow).css("top", arrowPosition - 10); } - $(document).ready(function() { - $(".device-detail-body").removeClass("hidden"); - $("#loading-content").remove(); - loadOperationBar(deviceType); - loadOperationsLog(false); - loadApplicationsList(); - loadPolicyCompliance(); - - $("#refresh-policy").click(function () { - $("#policy-spinner").removeClass("hidden"); - loadPolicyCompliance(); - }); - - $("#refresh-apps").click(function () { - $("#apps-spinner").removeClass("hidden"); - loadApplicationsList(); - }); - - $("#refresh-operations").click(function () { - $("#operations-spinner").removeClass("hidden"); - loadOperationsLog(true); - }); - }); - function loadOperationsLog(update) { var operationsLogTable = "#operations-log-table"; if (update) { @@ -273,8 +243,8 @@ var InitiateViewOption = null; // success-callback function (data, textStatus, jqXHR) { if (jqXHR.status == 200 && data) { - data = JSON.parse(data); $("#policy-spinner").addClass("hidden"); + data = JSON.parse(data); if (data["active"] == true) { activePolicy = data; invokerUtil.get( @@ -300,32 +270,72 @@ var InitiateViewOption = null; $("#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.

"); + html("
" + + "

" + + "" + + "Loading policy compliance related data " + + "was not successful. please try refreshing in a while." + + "

" + + "
"); } ); } + } else if ((jqXHR.status == 200 && !data)) { + //$("#policy-spinner").addClass("hidden"); + $("#policy-list-container"). + html("
" + + "

" + + "" + + "There is currently no effective policy applied for this device." + + "

" + + "
"); } }, // error-callback function () { + $("#policy-spinner").addClass("hidden"); $("#policy-list-container"). - html("

Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

"); + html("
" + + "

" + + "" + + "Loading policy compliance related data " + + "was not successful. please try refreshing in a while." + + "

" + + "
"); } ); } ); } + $(document).ready(function () { + $(".device-detail-body").removeClass("hidden"); + $("#loading-content").remove(); + loadOperationBar(deviceType); + loadOperationsLog(false); + loadApplicationsList(); + loadPolicyCompliance(); + + $("#refresh-policy").click(function () { + $("#policy-spinner").removeClass("hidden"); + loadPolicyCompliance(); + }); + + $("#refresh-apps").click(function () { + $("#apps-spinner").removeClass("hidden"); + loadApplicationsList(); + }); + + $("#refresh-operations").click(function () { + $("#operations-spinner").removeClass("hidden"); + loadOperationsLog(true); + }); + }); + }()); diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs index 51a52044f..9a062061b 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.view/view.hbs @@ -25,27 +25,27 @@ {{#if device.viewModel.deviceIdentifier}} - Device ID + Device ID {{device.viewModel.deviceIdentifier}} {{/if}} {{#if device.viewModel.deviceName}} - Name + Name {{device.viewModel.deviceName}} {{/if}} {{#if device.viewModel.vendor}} {{#if device.viewModel.model}} - Model + Model {{device.viewModel.vendor}} {{device.viewModel.model}} {{/if}} {{/if}} {{#if device.status}} - Status + Status {{#equal device.status "ACTIVE"}}  Active{{/equal}} {{#equal device.status "INACTIVE"}}  Inactive{{/equal}} @@ -56,43 +56,43 @@ {{/if}} {{#if device.viewModel.owner}} - Owner + Owner {{device.viewModel.owner}} {{/if}} {{#if device.viewModel.ownership}} - Ownership + Ownership {{device.viewModel.ownership}} {{/if}} {{#if device.viewModel.imei}} - IMEI + IMEI {{device.viewModel.imei}} {{/if}} {{#if device.viewModel.udid}} - UDID + UDID {{device.viewModel.udid}} {{/if}} {{#if device.viewModel.os_build_date}} - Firmware Build Date + Firmware Build Date {{device.viewModel.os_build_date}} {{/if}} {{#if device.viewModel.phoneNumber}} - Phone Number + Phone Number {{device.viewModel.phoneNumber}} {{/if}} {{#if device.viewModel.lastUpdatedTime}} - Last Update + Last Update {{device.viewModel.lastUpdatedTime}} {{/if}} @@ -260,7 +260,8 @@
- - - - - + + + + +
-

There is no active policy for this device.

+

+ + There is currently no effective policy applied for this device. +

@@ -298,7 +303,7 @@

- Device Location + Device Location

@@ -359,18 +364,19 @@

- Operations Logs + Operations Log