From 22ec7aa69561ac235e05c34f2248b1eba169f6be Mon Sep 17 00:00:00 2001 From: kamidu Date: Wed, 5 Oct 2016 12:25:37 +0530 Subject: [PATCH] Fixes for the ui isuess in EMM 2.2.0-beta --- .../public/js/platform-configuration.js | 7 +- .../public/js/device-detail.js | 78 +- .../app/units/mdm.unit.device.view/view.hbs | 755 ++++++++++-------- .../app/units/mdm.unit.device.view/view.js | 9 +- 4 files changed, 453 insertions(+), 396 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js index 4ad5d5341..a179701e5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.platform.configuration/public/js/platform-configuration.js @@ -227,11 +227,8 @@ $(document).ready(function () { addConfigAPI, addConfigFormData, function (data, textStatus, jqXHR) { - data = JSON.parse(data); - if (jqXHR.status == 201) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } + $("#config-save-form").addClass("hidden"); + $("#record-created-msg").removeClass("hidden"); }, function (data) { if (data.status == 500) { 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 f56ba9556..dd53bc04e 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 @@ -185,17 +185,17 @@ var InitiateViewOption = null; $("#applications-list-container").html(content); } else { $("#applications-list-container"). - html("

No applications found.

" + - "

Please try refreshing the list in a while.

"); + 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.

"); - }); + html("

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

"); + }); }); } @@ -251,50 +251,50 @@ var InitiateViewOption = null; // error-callback function () { $("#policy-list-container"). - html("
" + - "

" + - "" + - "Loading policy compliance related data " + - "was not successful. please try refreshing 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." + - "

" + - "
" + - "

" + - "

" + - "

" - ); + 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 in a while." + - "

" + - "
" + - "

" + - "

" + - "

" - ); + html("
" + + "

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

" + + "
" + + "

" + + "

" + + "

" + ); } ); } @@ -309,6 +309,10 @@ var InitiateViewOption = null; loadApplicationsList(); loadPolicyCompliance(); + if ($("#device_details_tab").length == 0) { + $(".device-detail-body").addClass("hidden"); + } + $("#refresh-policy").click(function () { $("#policy-spinner").removeClass("hidden"); loadPolicyCompliance(); 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 d44d94957..5d1470c11 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 @@ -6,7 +6,8 @@ {{#if deviceFound}} {{#if isAuthorized}}

+ data-deviceid="{{deviceView.deviceIdentifier}}" data-type="{{deviceView.deviceType}}" + data-ownership="{{deviceView.ownership}}"> Device {{deviceView.name}} {{#if deviceView.model}} @@ -15,413 +16,463 @@ {{/if}}

-
-
-
-
-
-
Device Overview
- {{#defineZone "device-detail-properties"}} - - - {{#if deviceView.deviceIdentifier}} - - - - - {{/if}} - {{#if deviceView.name}} - - - - - {{/if}} - {{#if deviceView.vendor}} - {{#if deviceView.model}} +
+
+
+
+
+
Device + Overview +
+ {{#defineZone "device-detail-properties"}} +
Device ID{{deviceView.deviceIdentifier}}
Name{{deviceView.name}}
+ + {{#if deviceView.deviceIdentifier}} - - + + {{/if}} + {{#if deviceView.name}} + + + + + {{/if}} + {{#if deviceView.vendor}} + {{#if deviceView.model}} + + + + + {{/if}} + {{/if}} + {{#if deviceView.status}} + + + + + {{/if}} + {{#if deviceView.owner}} + + + + + {{/if}} + {{#if deviceView.ownership}} + + + + + {{/if}} + {{#if deviceView.imei}} + + + + + {{/if}} + {{#if deviceView.udid}} + + + + + {{/if}} + {{#if deviceView.osBuildDate}} + + + + + {{/if}} + {{#if deviceView.phoneNumber}} + + + + + {{/if}} + {{#if deviceView.lastUpdatedTime}} + + + + + {{/if}} + +
Model{{deviceView.vendor}} {{deviceView.model}}Device ID{{deviceView.deviceIdentifier}}
Name{{deviceView.name}}
Model{{deviceView.vendor}} {{deviceView.model}}
Status + {{#equal deviceView.status "ACTIVE"}}  Active{{/equal}} + {{#equal deviceView.status "INACTIVE"}}  Inactive{{/equal}} + {{#equal deviceView.status "BLOCKED"}}  Blocked{{/equal}} + {{#equal deviceView.status "REMOVED"}}  Removed{{/equal}} +
Owner{{deviceView.owner}}
Ownership{{deviceView.ownership}}
IMEI{{deviceView.imei}}
UDID{{deviceView.udid}}
Firmware Build + Date + {{deviceView.osBuildDate}}
Phone Number{{deviceView.phoneNumber}}
Last Update{{deviceView.lastUpdatedTime}}
+ {{/defineZone}} +
+ Operations {{deviceView.isNotWindows}} +
+
+ {{unit "mdm.unit.device.operation-bar" deviceType=deviceView.deviceType ownership=deviceView.ownership}} +
+
+
+
+ -
-
-
- - {{#defineZone "device-detail-properties"}} -
-
- + {{#defineZone "device-detail-properties"}} +
+
+ -
- - -
-
-
- - {{#equal deviceView.deviceType "windows"}} -
-

Not available yet

-
- {{/equal}} - {{#if deviceView.deviceInfoAvailable}} - {{#if deviceView.BatteryLevel}} -
-
-
-
BATTERY
-
-
-
- {{deviceView.BatteryLevel.value}} % -
-
-
-
+ {{#if deviceView.isNotWindows}} +
+ - {{/if}} - - - - - - + +
+
+
+ + {{#equal deviceView.deviceType "windows"}} +
+

Not + available yet

+
+ {{/equal}} + {{#if deviceView.deviceInfoAvailable}} + {{#if deviceView.BatteryLevel}} +
+
+
+
BATTERY
+
+
+
+ {{deviceView.BatteryLevel.value}} % +
+
+
+
+
+ {{/if}} + + + + + + - + - - - - - - {{#if deviceView.ramUsage}} -
-
-
-
RAM Usage
-
-
-
- {{deviceView.ramUsage.value}} % -
-
-
-
-
- {{/if}} - {{#if deviceView.internalMemory}} -
-
-
-
Local Storage
-
-
-
- {{deviceView.internalMemory.usage}} % - + + + + + + {{#if deviceView.ramUsage}} +
+
+
+
RAM Usage
+
+
+
+ {{deviceView.ramUsage.value}} % +
+
+
+
+
+ {{/if}} + {{#if deviceView.internalMemory}} +
+
+
+
Local Storage
+
+
+
+
+ {{deviceView.internalMemory.usage}} % + TOTAL OF {{deviceView.internalMemory.total}} GB -
-
-
-
-
- {{/if}} - {{#if deviceView.externalMemory}} -
-
-
-
External Storage
-
-
-
- {{deviceView.externalMemory.usage}} % - +
+
+
+
+
+ {{/if}} + {{#if deviceView.externalMemory}} +
+
+
+
External Storage
+
+
+
+ {{deviceView.externalMemory.usage}} % + TOTAL OF {{deviceView.externalMemory.total}} GB +
+
+
+
+
+ {{/if}} + {{else}} +
+

+ + Battery, RAM and Storage related information are not + available yet. +

-
+ {{/if}}
- {{/if}} - {{else}} -
-

- - Battery, RAM and Storage related information are not available yet. -

{{/if}} -
-
-
-
-
- -
{{else}}

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.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/view.js index 6ec083d68..93276b90a 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.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/view.js @@ -21,6 +21,7 @@ function onRequest(context) { var deviceType = context["uriParams"]["deviceType"]; var deviceId = request.getParameter("id"); var deviceViewData = {}; + var log = new Log("new log"); if (deviceType && deviceId) { var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; @@ -35,6 +36,10 @@ function onRequest(context) { var viewModel = {}; if (filteredDeviceData["type"]) { viewModel["deviceType"] = filteredDeviceData["type"]; + viewModel.isNotWindows = true; + if (viewModel["deviceType"] == "windows") { + viewModel.isNotWindows = false; + } } if (filteredDeviceData["deviceIdentifier"]) { viewModel["deviceIdentifier"] = filteredDeviceData["deviceIdentifier"]; @@ -139,7 +144,7 @@ function onRequest(context) { } if (filteredDeviceData["latestDeviceInfo"]["updatedTime"]) { viewModel["lastUpdatedTime"] = filteredDeviceData["latestDeviceInfo"]["updatedTime"]. - substr(0, filteredDeviceData["latestDeviceInfo"]["updatedTime"].indexOf("+")); + substr(0, filteredDeviceData["latestDeviceInfo"]["updatedTime"].indexOf("+")); } viewModel["BatteryLevel"] = {}; viewModel["BatteryLevel"]["value"] = filteredDeviceData["latestDeviceInfo"]["batteryLevel"]; @@ -195,6 +200,6 @@ function onRequest(context) { } else { deviceViewData["deviceFound"] = false; } - + log.error(stringify(deviceViewData)); return deviceViewData; } \ No newline at end of file