+
+ {{#equal device.type "windows"}}
+
+
Not available yet
-
Device Details
-
- Loading Device Details...
-
-
-
-
-
- {{#equal device.type "windows"}}
-
-
Not available yet
-
- {{/equal}}
- {{#if device.viewModel.BatteryLevel}}
-
-
-
-
BATTERY
-
-
-
- {{device.viewModel.BatteryLevel}} %
-
-
-
+ {{/equal}}
+ {{#if device.viewModel.deviceInfo}}
+ {{#if device.viewModel.BatteryLevel}}
+
+
+
+
BATTERY
+
+
+
+ {{device.viewModel.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 device.viewModel.external_memory.FreeCapacity}}
-
-
-
-
EXTERNAL STORAGE
-
-
-
- {{device.viewModel.external_memory.DeviceCapacityPercentage}} %
-
- {{device.viewModel.external_memory.FreeCapacity}} GB Free
-
-
-
-
-
-
- {{/if}}
-
-
-
-
-
-
-
- Policy Compliance
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading Policy Compliance...
-
-
-
-
There is no active policy for this device.
-
-
-
-
-
Device Location
-
-
-
-
Device location cannot be retrieved.
-
-
-
-
-
-
-
-
-
- Installed Applications
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading Applications List...
-
-
-
-
No applications found.
-
Please try refreshing the list in a while.
+ {{/if}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{#if device.viewModel.ramUsage}}
+
+
+
+
RAM Usage
+
+
+
+ {{device.viewModel.ramUsage.value}} %
+
+
-
-
-
-
-
-
-
- Operations Logs
-
-
+ {{/if}}
+ {{#if device.viewModel.internalMemory}}
+
+
+
+
Local Storage
+
+
+
+ {{device.viewModel.internalMemory.usage}} %
+
+ TOTAL OF {{device.viewModel.internalMemory.total}} GB
+
+
+
+
+
+
+ {{/if}}
+ {{#if device.viewModel.externalMemory}}
+
+
+
+
External Storage
+
+
+
+ {{device.viewModel.externalMemory.usage}} %
+
+ TOTAL OF {{device.viewModel.externalMemory.total}} GB
+
+
+
+
+
+
+ {{/if}}
+ {{else}}
+
+
+
+ Battery, RAM and Storage related information are not available yet.
-
- Operations Logs
-
-
-
-
-
-
-
+
+
+
+
+
+ Policy Compliance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading Policy Compliance...
+
+
+
+
+
+ There is currently no effective policy applied for this device.
+
+
+
+
+
+
+
+
+
Device Location
+
+
+
+
+
+ Device location cannot be retrieved.
+
+
+
+
+
+
+
+
+
+
+ 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}}
+
+
+
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 05309e1fa..2fee10e12 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
@@ -26,6 +26,7 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId);
if (response["status"] == "success") {
+ deviceData["deviceFound"] = true;
deviceData["isAuthorized"] = true;
var device = response["content"];
@@ -50,16 +51,18 @@ function onRequest(context) {
latitude: device["properties"]["LATITUDE"],
longitude: device["properties"]["LONGITUDE"]
};
+ viewModel["ownership"] = device["ownership"];
} else if (device["type"] == "android") {
+ viewModel["deviceIdentifier"] = device["deviceIdentifier"];
+ viewModel["deviceName"] = device["name"];
+ viewModel["owner"] = device["owner"];
+ viewModel["ownership"] = device["ownership"];
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);
}
- viewModel["internal_memory"] = {};
- viewModel["external_memory"] = {};
+
viewModel["location"] = {
latitude: device["properties"]["LATITUDE"],
longitude: device["properties"]["LONGITUDE"]
@@ -72,33 +75,74 @@ function onRequest(context) {
}
}
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;
+
+ if (device["deviceInfo"]) {
+ viewModel["deviceInfo"] = true;
+
+ viewModel["model"] = device["deviceInfo"]["deviceModel"];
+ viewModel["vendor"] = device["deviceInfo"]["vendor"];
+ viewModel["lastUpdatedTime"] = device["deviceInfo"]["updatedTime"].
+ substr(0, device["deviceInfo"]["updatedTime"].indexOf("+"));
+
+ 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 {
+ viewModel["deviceInfo"] = false;
+ }
} 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"]
};
+ viewModel["ownership"] = device["ownership"];
}
device["viewModel"] = viewModel;
}
deviceData["device"] = device;
} else if (response["status"] == "unauthorized") {
+ deviceData["deviceFound"] = true;
deviceData["isAuthorized"] = false;
+ } else if (response["status"] == "notFound") {
+ deviceData["deviceFound"] = false;
}
return deviceData;
}
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/js/policy-create.js 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/js/policy-create.js
index 655acfc1d..6ee4e6d82 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/js/policy-create.js
+++ 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/js/policy-create.js
@@ -49,7 +49,9 @@ var androidOperationConstants = {
"VPN_OPERATION": "vpn",
"VPN_OPERATION_CODE": "VPN",
"APPLICATION_OPERATION":"app-restriction",
- "APPLICATION_OPERATION_CODE":"APP-RESTRICTION"
+ "APPLICATION_OPERATION_CODE":"APP-RESTRICTION",
+ "KIOSK_APPS_CODE":"KIOSK_APPS",
+ "KIOSK_APPS":"cosu-whitelisted-applications"
};
// Constants to define iOS Operation Constants
@@ -520,6 +522,93 @@ validateStep["policy-profile"] = function () {
validationStatusArray.push(validationStatus);
}
+ if ($.inArray(androidOperationConstants["KIOSK_APPS_CODE"], configuredOperations) != -1) {
+ //If COSU whitelisting applications configured
+ operation = androidOperationConstants["KIOSK_APPS"];
+ // Initializing continueToCheckNextInputs to true
+ continueToCheckNextInputs = true;
+
+ var whitelistedApplicationsGridChildInputs = "div#cosu-whitelisted-applications .child-input";
+
+ if (continueToCheckNextInputs) {
+ if ($(whitelistedApplicationsGridChildInputs).length == 0) {
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "Applications are not provided in application whitelist list.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ }
+ else {
+ childInputCount = 0;
+ childInputArray = [];
+ emptyChildInputCount = 0;
+ duplicatesExist = false;
+ // Looping through each child input
+ $(whitelistedApplicationsGridChildInputs).each(function () {
+ childInputCount++;
+ if (childInputCount % 2 == 0) {
+ // If child input is of second column
+ childInput = $(this).val();
+ childInputArray.push(childInput);
+ // Updating emptyChildInputCount
+ if (!childInput) {
+ // If child input field is empty
+ emptyChildInputCount++;
+ }
+ }
+ });
+ // Checking for duplicates
+ initialChildInputArrayLength = childInputArray.length;
+ if (emptyChildInputCount == 0 && initialChildInputArrayLength > 1) {
+ for (m = 0; m < (initialChildInputArrayLength - 1); m++) {
+ poppedChildInput = childInputArray.pop();
+ for (n = 0; n < childInputArray.length; n++) {
+ if (poppedChildInput == childInputArray[n]) {
+ duplicatesExist = true;
+ break;
+ }
+ }
+ if (duplicatesExist) {
+ break;
+ }
+ }
+ }
+ // Updating validationStatus
+ if (emptyChildInputCount > 0) {
+ // If empty child inputs are present
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "One or more package names of " +
+ "applications are empty.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ } else if (duplicatesExist) {
+ // If duplicate input is present
+ validationStatus = {
+ "error": true,
+ "subErrorMsg": "Duplicate values exist with " +
+ "for package names.",
+ "erroneousFeature": operation
+ };
+ continueToCheckNextInputs = false;
+ }
+
+ }
+ }
+
+ if (continueToCheckNextInputs) {
+ validationStatus = {
+ "error": false,
+ "okFeature": operation
+ };
+ }
+
+ // Updating validationStatusArray with validationStatus
+ validationStatusArray.push(validationStatus);
+
+ }
}
}if (policy["platform"] == platformTypeConstants["WINDOWS"]) {
if (configuredOperations.length == 0) {
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 731d00a74..fb49d7987 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
@@ -1445,4 +1445,4 @@