From 394d97e1c895b457d48daa16f72e943c1309eac8 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 8 Jul 2017 18:47:00 +0530 Subject: [PATCH] Fixed operations not loaded correctly --- .../app/units/cdmf.unit.device.view/view.hbs | 8 +- .../app/units/cdmf.unit.device.view/view.js | 136 ------------------ 2 files changed, 4 insertions(+), 140 deletions(-) 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 8e56318b74..75e22de543 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 @@ -34,14 +34,14 @@
{{#defineZone "device-details-header"}} -

- {{#if device.viewModel.model}} -

{{device.viewModel.vendor}} {{device.viewModel.model}}

+ {{#if device.model}} +

{{device.vendor}} {{device.model}}

{{/if}} -

Ownership - {{device.viewModel.ownership}}

+

Ownership - {{device.ownership}}

Device is {{#equal device.status "ACTIVE"}}Active{{/equal}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js index 3f2d34dc87..60c8e50f2e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/view.js @@ -35,10 +35,6 @@ function onRequest(context) { if (filteredDeviceData["type"]) { viewModel["deviceType"] = filteredDeviceData["type"]; viewModel["type"] = filteredDeviceData["type"]; - viewModel.isNotWindows = true; - if (viewModel["deviceType"] == "windows") { - viewModel.isNotWindows = false; - } } if (filteredDeviceData["deviceIdentifier"]) { viewModel["deviceIdentifier"] = filteredDeviceData["deviceIdentifier"]; @@ -65,138 +61,6 @@ function onRequest(context) { viewModel["ownership"] = filteredDeviceData["enrolmentInfo"]["ownership"]; } } - if (filteredDeviceData["initialDeviceInfo"]) { - viewModel["deviceInfoAvailable"] = true; - if (filteredDeviceData["initialDeviceInfo"]["IMEI"]) { - viewModel["imei"] = filteredDeviceData["initialDeviceInfo"]["IMEI"]; - } - if (!filteredDeviceData["latestDeviceInfo"]) { - if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]) { - if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"] != "0") { - viewModel["osBuildDate"] = new Date(filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"] * 1000); - } - } - if (filteredDeviceData["initialDeviceInfo"]["LATITUDE"] && filteredDeviceData["initialDeviceInfo"]["LONGITUDE"]) { - viewModel["location"] = {}; - viewModel["location"]["latitude"] = filteredDeviceData["initialDeviceInfo"]["LATITUDE"]; - viewModel["location"]["longitude"] = filteredDeviceData["initialDeviceInfo"]["LONGITUDE"]; - } - if (filteredDeviceData["initialDeviceInfo"]["VENDOR"] && filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]) { - viewModel["vendor"] = filteredDeviceData["initialDeviceInfo"]["VENDOR"]; - viewModel["model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]; - } - if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]) { - if (deviceType == "android") { - viewModel["BatteryLevel"] = {}; - viewModel["BatteryLevel"]["value"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["BATTERY_LEVEL"]; - - viewModel["internalMemory"] = {}; - viewModel["internalMemory"]["total"] = Math. - round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 100) / 100; - if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] != 0) { - viewModel["internalMemory"]["usage"] = Math. - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] - - filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_AVAILABLE_MEMORY"]) - / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 10000) / 100; - } else { - viewModel["internalMemory"]["usage"] = 0; - } - - viewModel["externalMemory"] = {}; - viewModel["externalMemory"]["total"] = Math. - round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 100) / 100; - if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] != 0) { - viewModel["externalMemory"]["usage"] = Math. - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] - - filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_AVAILABLE_MEMORY"]) - / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100; - } else { - viewModel["externalMemory"]["usage"] = 0; - } - } else if (deviceType == "ios") { - viewModel["BatteryLevel"] = {}; - viewModel["BatteryLevel"]["value"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["BatteryLevel"]; - - viewModel["internalMemory"] = {}; - viewModel["internalMemory"]["total"] = Math. - round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 100) / 100; - if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] != 0) { - viewModel["internalMemory"]["usage"] = Math. - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] - - filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["AvailableDeviceCapacity"]) - / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 10000) / 100; - } else { - viewModel["internalMemory"]["usage"] = 0; - } - } - } - } - } - if (filteredDeviceData["latestDeviceInfo"]) { - viewModel["deviceInfoAvailable"] = true; - if (filteredDeviceData["latestDeviceInfo"]["osBuildDate"]) { - if (filteredDeviceData["latestDeviceInfo"]["osBuildDate"] != "0") { - viewModel["osBuildDate"] = new Date(filteredDeviceData["latestDeviceInfo"]["osBuildDate"] * 1000); - } - } - if (filteredDeviceData["latestDeviceInfo"]["location"]["latitude"] && - filteredDeviceData["latestDeviceInfo"]["location"]["longitude"]) { - viewModel["location"] = {}; - viewModel["location"]["latitude"] = filteredDeviceData["latestDeviceInfo"]["location"]["latitude"]; - viewModel["location"]["longitude"] = filteredDeviceData["latestDeviceInfo"]["location"]["longitude"]; - } - if (filteredDeviceData["latestDeviceInfo"]["vendor"] && filteredDeviceData["latestDeviceInfo"]["deviceModel"]) { - viewModel["vendor"] = filteredDeviceData["latestDeviceInfo"]["vendor"]; - viewModel["model"] = filteredDeviceData["latestDeviceInfo"]["deviceModel"]; - } - if (filteredDeviceData["latestDeviceInfo"]["updatedTime"]) { - viewModel["lastUpdatedTime"] = filteredDeviceData["latestDeviceInfo"]["updatedTime"]. - substr(0, filteredDeviceData["latestDeviceInfo"]["updatedTime"].indexOf("+")); - } - viewModel["BatteryLevel"] = {}; - viewModel["BatteryLevel"]["value"] = filteredDeviceData["latestDeviceInfo"]["batteryLevel"]; - - viewModel["cpuUsage"] = {}; - viewModel["cpuUsage"]["value"] = filteredDeviceData["latestDeviceInfo"]["cpuUsage"]; - - viewModel["ramUsage"] = {}; - if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) { - viewModel["ramUsage"]["value"] = Math. - round((filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] - - filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"]) - / filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] * 10000) / 100; - } else { - viewModel["ramUsage"]["value"] = 0; - } - - viewModel["internalMemory"] = {}; - viewModel["internalMemory"]["total"] = Math. - round(filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 100) / 100; - if (filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] != 0) { - viewModel["internalMemory"]["usage"] = Math. - round((filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] - - filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) - / filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 10000) / 100; - } else { - viewModel["internalMemory"]["usage"] = 0; - } - - viewModel["externalMemory"] = {}; - viewModel["externalMemory"]["total"] = Math. - round(filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 100) / 100; - if (filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] != 0) { - viewModel["externalMemory"]["usage"] = Math. - round((filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] - - filteredDeviceData["latestDeviceInfo"]["externalAvailableMemory"]) - / filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 10000) / 100; - } else { - viewModel["externalMemory"]["usage"] = 0; - } - } - if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) { - viewModel["deviceInfoAvailable"] = false; - } - deviceViewData["device"] = viewModel; } else if (response["status"] == "unauthorized") { deviceViewData["deviceFound"] = true;