-
-
BATTERY
-
-
-
- {{device.viewModel.BatteryLevel}} %
-
-
-
+ {{/equal}}
+ {{#if deviceView.deviceInfoAvailable}}
+ {{#if deviceView.BatteryLevel}}
+
+
+
+
BATTERY
+
+
+
+ {{deviceView.BatteryLevel.value}} %
- {{/if}}
- {{#if device.viewModel.DeviceCapacity}}
-
-
-
-
STORAGE
-
-
-
- {{device.viewModel.DeviceCapacityPercentage}} %
-
- {{device.viewModel.AvailableDeviceCapacity}} GB Free
-
-
-
-
-
-
- {{/if}}
- {{#if device.viewModel.internal_memory.FreeCapacity}}
-
-
-
-
LOCAL STORAGE
-
-
-
- {{device.viewModel.internal_memory.DeviceCapacityPercentage}} %
-
- {{device.viewModel.internal_memory.FreeCapacity}} GB Free
-
-
-
-
+
+
+
+ {{/if}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{#if deviceView.ramUsage}}
+
+
+
+
RAM Usage
+
+
+
+ {{deviceView.ramUsage.value}} %
- {{/if}}
- {{#if device.viewModel.external_memory.FreeCapacity}}
-
-
-
-
EXTERNAL STORAGE
-
-
-
- {{device.viewModel.external_memory.DeviceCapacityPercentage}} %
-
- {{device.viewModel.external_memory.FreeCapacity}} GB Free
-
-
-
-
+
+
+
+ {{/if}}
+ {{#if deviceView.internalMemory}}
+
+
+
+
Local Storage
+
+
+
+ {{deviceView.internalMemory.usage}} %
+
+ TOTAL OF {{deviceView.internalMemory.total}} GB
+
- {{/if}}
+
-
-
-
-
-
- Policy Compliance
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading Policy Compliance...
-
-
-
-
There is no active policy for this device.
+ {{/if}}
+ {{#if deviceView.externalMemory}}
+
+
+
+
External Storage
+
+
+
+ {{deviceView.externalMemory.usage}} %
+
+ TOTAL OF {{deviceView.externalMemory.total}} GB
+
+
+
-
-
-
-
-
-
-
- Device Location
-
-
+ {{/if}}
+ {{else}}
+
+
+
+ Battery, RAM and Storage related information are not available yet.
- Device Location
-
-
-
-
Device location cannot be retrieved.
-
-
-
-
-
+ {{/if}}
+
+
+
+
+
+
+
+ Policy Compliance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading Policy Compliance...
+
+
+
+
+
+
+
+
+
Device Location
+
+
+ {{#if deviceView.location}}
+
-
-
-
- Installed Applications
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading Applications List...
-
-
-
-
No applications found.
-
Please try refreshing the list in a while.
-
-
-
-
+ {{else}}
+
+
+
+ Device location information is not available.
+
-
-
-
- Operations Logs
-
-
-
-
-
-
-
+
+
+
+
+ Installed Applications
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading Applications List...
+
+
+
+
+
+ No applications found.
+
+
Please try refreshing in a while.
+
+
+
+
+
+
+
+
+ Operations Log
+
+
+
+
+
+
+
+
+
-
- Loading Operations Log...
-
-
-
-
There are no operations, performed yet on this device.
-
-
-
-
-
- Operation Code |
- Status |
- Request created at |
-
-
-
-
-
-
-
+
+ Loading Operations Log...
+
+
+
+
+
+ There are no operations, performed yet on this device.
+
+
+
+
+ Operation Code |
+ Status |
+ Request created at |
+
+
+
+
+
- {{/defineZone}}
+
+
-
+
+ {{/defineZone}}
+
+
+ {{else}}
+
+ Permission Denied
+
+
+ You are not authorized to view specified device in the system.
+ {{/if}}
{{else}}
- Permission Denied
+ Device not found
- You are not authorized to view specified device in the system.
+ You have tried to access either a removed or non-existing device.
{{/if}}
{{/zone}}
{{#zone "bottomJs"}}
{{#if isAuthorized}}
-
-
-
- {{js "js/device-detail.js"}}
-
- {{js "js/load-map.js"}}
+
+
+
+
+
+
+ {{js "js/device-detail.js"}}
+
+ {{js "js/load-map.js"}}
{{/if}}
{{/zone}}
\ No newline at end of file
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 05309e1fa8..6ec083d684 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
@@ -18,88 +18,183 @@
function onRequest(context) {
// var log = new Log("view.js");
- var deviceType = context.uriParams.deviceType;
+ var deviceType = context["uriParams"]["deviceType"];
var deviceId = request.getParameter("id");
- var deviceData = {};
+ var deviceViewData = {};
if (deviceType && deviceId) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId);
if (response["status"] == "success") {
- deviceData["isAuthorized"] = true;
+ deviceViewData["deviceFound"] = true;
+ deviceViewData["isAuthorized"] = true;
- var device = response["content"];
+ var filteredDeviceData = response["content"];
+
+ // creating deviceView information model from filtered device data
var viewModel = {};
- var deviceInfo = device["properties"]["DEVICE_INFO"];
- if (deviceInfo && String(deviceInfo.toString()).length > 0) {
- deviceInfo = parse(stringify(deviceInfo));
- if (device["type"] == "ios") {
- deviceInfo = parse(deviceInfo);
- viewModel["imei"] = device["properties"]["IMEI"];
- viewModel["phoneNumber"] = deviceInfo["PhoneNumber"];
- viewModel["udid"] = deviceInfo["UDID"];
- viewModel["BatteryLevel"] = Math.round(deviceInfo["BatteryLevel"] * 100);
- viewModel["DeviceCapacity"] = Math.round(deviceInfo["DeviceCapacity"] * 100) / 100;
- viewModel["AvailableDeviceCapacity"] = Math.
- round(deviceInfo["AvailableDeviceCapacity"] * 100) / 100;
- viewModel["DeviceCapacityUsed"] = Math.
- round((viewModel["DeviceCapacity"] - viewModel["AvailableDeviceCapacity"]) * 100) / 100;
- viewModel["DeviceCapacityPercentage"] = Math.
- round(viewModel["AvailableDeviceCapacity"] / viewModel["DeviceCapacity"] * 10000) / 100;
- viewModel["location"] = {
- latitude: device["properties"]["LATITUDE"],
- longitude: device["properties"]["LONGITUDE"]
- };
- } else if (device["type"] == "android") {
- viewModel["imei"] = device["properties"]["IMEI"];
- viewModel["model"] = device["properties"]["DEVICE_MODEL"];
- viewModel["vendor"] = device["properties"]["VENDOR"];
- var osBuildDate = device["properties"]["OS_BUILD_DATE"];
- if (osBuildDate != null && osBuildDate != "0") {
- viewModel["os_build_date"] = new Date(osBuildDate * 1000);
+ if (filteredDeviceData["type"]) {
+ viewModel["deviceType"] = filteredDeviceData["type"];
+ }
+ if (filteredDeviceData["deviceIdentifier"]) {
+ viewModel["deviceIdentifier"] = filteredDeviceData["deviceIdentifier"];
+ }
+ if (filteredDeviceData["name"]) {
+ viewModel["name"] = filteredDeviceData["name"];
+ }
+ if (filteredDeviceData["enrolmentInfo"]) {
+ if (filteredDeviceData["enrolmentInfo"]["status"]) {
+ viewModel["status"] = filteredDeviceData["enrolmentInfo"]["status"];
+ }
+ if (filteredDeviceData["enrolmentInfo"]["owner"]) {
+ viewModel["owner"] = filteredDeviceData["enrolmentInfo"]["owner"];
+ }
+ if (filteredDeviceData["enrolmentInfo"]["ownership"]) {
+ 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"];
}
- viewModel["internal_memory"] = {};
- viewModel["external_memory"] = {};
- viewModel["location"] = {
- latitude: device["properties"]["LATITUDE"],
- longitude: device["properties"]["LONGITUDE"]
- };
- var info = {};
- var infoList = parse(deviceInfo);
- if (infoList != null && infoList != undefined) {
- for (var j = 0; j < infoList.length; j++) {
- info[infoList[j].name] = infoList[j].value;
+ 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;
+ }
}
}
- deviceInfo = info;
- viewModel["BatteryLevel"] = deviceInfo["BATTERY_LEVEL"];
- viewModel["internal_memory"]["FreeCapacity"] = Math.
- round(deviceInfo["INTERNAL_AVAILABLE_MEMORY"] * 100)/100;
- viewModel["internal_memory"]["DeviceCapacityPercentage"] = Math.
- round(deviceInfo["INTERNAL_AVAILABLE_MEMORY"]
- / deviceInfo["INTERNAL_TOTAL_MEMORY"] * 10000) / 100;
- viewModel["external_memory"]["FreeCapacity"] = Math.
- round(deviceInfo["EXTERNAL_AVAILABLE_MEMORY"] * 100) / 100;
- viewModel["external_memory"]["DeviceCapacityPercentage"] = Math.
- round(deviceInfo["EXTERNAL_AVAILABLE_MEMORY"]
- / deviceInfo["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100;
- } 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["location"] = {
- latitude: device["properties"]["LATITUDE"],
- longitude: device["properties"]["LONGITUDE"]
- };
}
- device["viewModel"] = viewModel;
}
- deviceData["device"] = device;
+ 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["deviceView"] = viewModel;
} else if (response["status"] == "unauthorized") {
- deviceData["isAuthorized"] = false;
+ deviceViewData["deviceFound"] = true;
+ deviceViewData["isAuthorized"] = false;
+ } else if (response["status"] == "notFound") {
+ deviceViewData["deviceFound"] = false;
}
- return deviceData;
+ } else {
+ deviceViewData["deviceFound"] = false;
}
+
+ return deviceViewData;
}
\ No newline at end of file
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.policy.create/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs
index b77aaa7a6e..f05d320f93 100644
--- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.policy.create/public/templates/hidden-operations-android.hbs
@@ -62,7 +62,7 @@
- Applications Restrictions
+ Application Restrictions
@@ -103,12 +103,12 @@
-
- This configuration can be used to set a passcode policy to an Android Device.
- Once this configuration profile is installed on a device, corresponding users will not be
- able
- to modify these settings on their devices.
-
+
+ This configuration can be used to set a passcode policy to an Android Device.
+ Once this configuration profile is installed on a device, corresponding users will not be
+ able
+ to modify these settings on their devices.
+
@@ -907,9 +907,9 @@
-
- This configuration can be used to create a black list or white list of applications.
-
+
+ This configuration can be used to create a black list or white list of applications.
+