From 36eb2e2b162e4a203f7534af33a12cecf8310184 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 23 Sep 2016 06:37:24 +0530 Subject: [PATCH] Fix for JIRA: https://wso2.org/jira/browse/EMM-1615 --- .../app/units/mdm.unit.device.view/view.hbs | 105 +++++++++++------- .../app/units/mdm.unit.device.view/view.js | 55 ++++++--- 2 files changed, 105 insertions(+), 55 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/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 beaad78c88..894a78098c 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 @@ -23,9 +23,15 @@ {{#defineZone "device-detail-properties"}} - {{#if device.viewModel.vendor}} + {{#if device.viewModel.deviceIdentifier}} + + + + + {{/if}} + {{#if device.viewModel.deviceName}} - + {{/if}} @@ -37,12 +43,31 @@ {{/if}} {{/if}} - - - - - {{#if device.viewModel.udid}} + {{#if device.status}} + + + + {{/if}} + {{#if device.viewModel.owner}} + + + + + {{/if}} + {{#if device.viewModel.imei}} + + + + + {{/if}} + {{#if device.viewModel.udid}} + @@ -54,20 +79,11 @@ {{/if}} {{#if device.viewModel.phoneNumber}} - + {{/if}} - - - -
ID{{device.viewModel.deviceIdentifier}}
DeviceName {{device.viewModel.deviceName}}
IMEI{{device.viewModel.imei}}
Status + {{#equal device.status "ACTIVE"}}  Active{{/equal}} + {{#equal device.status "INACTIVE"}}  Inactive{{/equal}} + {{#equal device.status "BLOCKED"}}  Blocked{{/equal}} + {{#equal device.status "REMOVED"}}  Removed{{/equal}} +
Owner{{device.viewModel.owner}}
IMEI{{device.viewModel.imei}}
UDID {{device.viewModel.udid}}
Phone Number {{device.viewModel.phoneNumber}}
Status - {{#equal device.status "ACTIVE"}}  Active{{/equal}} - {{#equal device.status "INACTIVE"}}  Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}  Blocked{{/equal}} - {{#equal device.status "REMOVED"}}  Removed{{/equal}} -
{{/defineZone}} @@ -126,9 +142,6 @@ -
- Loading Device Details... -
@@ -146,61 +159,73 @@
- {{device.viewModel.BatteryLevel}} % + {{device.viewModel.BatteryLevel.value}} %
{{/if}} - {{#if device.viewModel.DeviceCapacity}} + {{#if device.viewModel.cpuUsage}}
-
STORAGE
+
CPU Usage
-
+
+
+ {{device.viewModel.cpuUsage.value}} % +
+
+
+
+
+ {{/if}} + {{#if device.viewModel.ramUsage}} +
+
+
+
RAM Usage
+
+
- {{device.viewModel.DeviceCapacityPercentage}} % - - {{device.viewModel.AvailableDeviceCapacity}} GB Free - + {{device.viewModel.ramUsage.value}} %
{{/if}} - {{#if device.viewModel.internal_memory.FreeCapacity}} + {{#if device.viewModel.internalMemory}}
-
LOCAL STORAGE
+
Local Storage
- {{device.viewModel.internal_memory.DeviceCapacityPercentage}} % - - {{device.viewModel.internal_memory.FreeCapacity}} GB Free - + {{device.viewModel.internalMemory.usage}} % + + TOTAL OF {{device.viewModel.internalMemory.total}} GB +
{{/if}} - {{#if device.viewModel.external_memory.FreeCapacity}} + {{#if device.viewModel.externalMemory}}
-
EXTERNAL STORAGE
+
External Storage
- {{device.viewModel.external_memory.DeviceCapacityPercentage}} % - - {{device.viewModel.external_memory.FreeCapacity}} GB Free - + {{device.viewModel.externalMemory.usage}} % + + TOTAL OF {{device.viewModel.externalMemory.total}} GB +
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 65a2e5fba1..f7111d10eb 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 @@ -57,12 +57,12 @@ function onRequest(context) { viewModel["imei"] = device["properties"]["IMEI"]; viewModel["model"] = device["deviceInfo"]["deviceModel"]; viewModel["vendor"] = device["deviceInfo"]["vendor"]; + viewModel["owner"] = device["owner"]; var osBuildDate = device["properties"]["OS_BUILD_DATE"]; if (osBuildDate != null && osBuildDate != "0") { viewModel["os_build_date"] = new Date(osBuildDate * 1000); } - viewModel["internal_memory"] = {}; - viewModel["external_memory"] = {}; + viewModel["location"] = { latitude: device["properties"]["LATITUDE"], longitude: device["properties"]["LONGITUDE"] @@ -75,23 +75,48 @@ function onRequest(context) { } } deviceInfo = info; - viewModel["BatteryLevel"] = device["deviceInfo"]["batteryLevel"]; - viewModel["internal_memory"]["FreeCapacity"] = Math. - round(device["deviceInfo"]["internalAvailableMemory"] * 100)/100; - viewModel["internal_memory"]["DeviceCapacityPercentage"] = Math. - round(device["deviceInfo"]["internalAvailableMemory"] - / device["deviceInfo"]["internalTotalMemory"] * 10000) / 100; - viewModel["external_memory"]["FreeCapacity"] = Math. - round(deviceInfo["EXTERNAL_AVAILABLE_MEMORY"] * 100) / 100; - viewModel["external_memory"]["DeviceCapacityPercentage"] = Math. - round(device["deviceInfo"]["externalAvailableMemory"] - / device["deviceInfo"]["externalTotalMemory"] * 10000) / 100; + viewModel["BatteryLevel"] = {}; + viewModel["BatteryLevel"]["value"] = device["deviceInfo"]["batteryLevel"]; + + viewModel["cpuUsage"] = {}; + viewModel["cpuUsage"]["value"] = device["deviceInfo"]["cpuUsage"]; + + viewModel["ramUsage"] = {}; + if (device["deviceInfo"]["totalRAMMemory"] != 0) { + viewModel["ramUsage"]["value"] = Math. + round((device["deviceInfo"]["totalRAMMemory"] - device["deviceInfo"]["availableRAMMemory"]) + / device["deviceInfo"]["totalRAMMemory"] * 10000) / 100; + } else { + viewModel["ramUsage"]["value"] = 0; + } + + viewModel["internalMemory"] = {}; + viewModel["externalMemory"] = {}; + viewModel["internalMemory"]["total"] = Math. + round(device["deviceInfo"]["internalTotalMemory"] * 100) / 100; + if (device["deviceInfo"]["internalTotalMemory"] != 0) { + viewModel["internalMemory"]["usage"] = Math. + round((device["deviceInfo"]["internalTotalMemory"] - device["deviceInfo"]["internalAvailableMemory"]) + / device["deviceInfo"]["internalTotalMemory"] * 10000) / 100; + } else { + viewModel["internalMemory"]["usage"] = 0; + } + + viewModel["externalMemory"]["total"] = Math. + round(device["deviceInfo"]["externalTotalMemory"] * 100) / 100; + if (device["deviceInfo"]["externalTotalMemory"] != 0) { + viewModel["externalMemory"]["usage"] = Math. + round((device["deviceInfo"]["externalTotalMemory"] - device["deviceInfo"]["externalAvailableMemory"]) + / device["deviceInfo"]["externalTotalMemory"] * 10000) / 100; + } else { + viewModel["externalMemory"]["usage"] = 0; + } } else if (device["type"] == "windows") { viewModel["imei"] = device["properties"]["IMEI"]; viewModel["model"] = device["properties"]["DEVICE_MODEL"]; viewModel["vendor"] = device["properties"]["VENDOR"]; - viewModel["internal_memory"] = {}; - viewModel["external_memory"] = {}; + viewModel["internalMemory"] = {}; + viewModel["externalMemory"] = {}; viewModel["location"] = { latitude: device["properties"]["LATITUDE"], longitude: device["properties"]["LONGITUDE"]