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}}
+ {{#if permissions.CHANGE_DEVICE_STATUS}}
+ {{#equal device.status "ACTIVE"}}
+
+ {{/equal}}
+ {{#equal device.status "INACTIVE"}}
+
+ {{/equal}}
+ {{#equal device.status "BLOCKED"}}
+
+ {{/equal}}
+ {{#equal device.status "REMOVED"}}
+
+ {{/equal}}
+ {{else}}
+ {{#equal device.status "ACTIVE"}} Active{{/equal}}
+ {{#equal device.status "INACTIVE"}} Inactive{{/equal}}
+ {{#equal device.status "BLOCKED"}} Blocked{{/equal}}
+ {{#equal device.status "REMOVED"}} Removed{{/equal}}
+ {{/if}}
|
{{/if}}
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.device-view/device-view.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.device-view/device-view.js
index a5816da5b..0a0bba6ba 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.device-view/device-view.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.device-view/device-view.js
@@ -210,7 +210,10 @@ function onRequest(context) {
{"name" : "deviceId", "value" : deviceId}
];
+ var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
+ var permissions = userModule.getUIPermissions();
deviceViewData["autoCompleteParams"] = autoCompleteParams;
+ deviceViewData["permissions"] = permissions;
deviceViewData["portalUrl"] = devicemgtProps['portalURL'];
deviceViewData["anchor"] = encodeURI(JSON.stringify({ "device" : { "id" : deviceId, "type" : deviceType}}));
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.device-view/public/js/device-detail.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.device-view/public/js/device-detail.js
index 449dec84c..c628f1260 100755
--- 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.device-view/public/js/device-detail.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.device-view/public/js/device-detail.js
@@ -81,6 +81,62 @@ var InitiateViewOption = null;
}
});
+ $('#status').on('save', function (e, params) {
+ var deviceStatus = params.submitValue.toUpperCase();
+ var serviceUrl = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceIdentifier
+ + "/changestatus?newStatus=" + deviceStatus;
+ var payload = null;
+
+ if (serviceUrl) {
+ var successCallback = function (jqXHR, status, resp) {
+ if (resp.status == 200) {
+ setTimeout(function () {
+ if (deviceStatus == "REMOVED") {
+ $('#statusIcon').removeClass().addClass('fw fw-delete icon-danger');
+ } else if (deviceStatus == "INACTIVE") {
+ $('#statusIcon').removeClass().addClass('fw fw-warning icon-warning');
+ } else if (deviceStatus == "ACTIVE") {
+ $('#statusIcon').removeClass().addClass('fw fw-success icon-success');
+ }
+ $("#statusIcon").show();
+
+ }, 1500);
+ } else {
+ console.log(resp.status);
+ }
+ };
+
+ invokerUtil.put(serviceUrl, payload,
+ successCallback, function (message) {
+ console.log(message);
+ });
+ }
+
+ });
+
+ $("#status").click(function () {
+ $("#statusIcon").hide();
+ });
+
+ $.fn.editable.defaults.mode = 'inline';
+
+ $('#status').editable({
+ value: $('#status').attr("selectedValue"),
+ source: [
+ {value: 'Active', text: 'Active'},
+ {value: "Inactive", text: 'Inactive'},
+ {value: "Removed", text: 'Removed'}
+ ],
+ success: this.update_elements
+ });
+
+ $.fn.editableform.buttons =
+ '