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.hbs 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.hbs
index ca9efda9d4..4b2dfe84af 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.hbs
+++ 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.hbs
@@ -1,4 +1,5 @@
{{unit "cdmf.unit.device.type.android.leaflet"}}
+{{unit "cdmf.unit.lib.editable"}}
{{unit "cdmf.unit.lib.qrcode"}}
{{unit "cdmf.unit.device.type.qr-modal"}}
@@ -51,14 +52,41 @@
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 a5816da5b9..0a0bba6ba8 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 449dec84c0..c628f1260c 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 =
+ '' +
+ '';
function positionArrow(selectedTab) {
var selectedTabHeight = $(selectedTab).innerHeight();
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
index 3e999e40db..046a5ae154 100644
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs
@@ -1,4 +1,5 @@
{{unit "cdmf.unit.device.type.windows.leaflet"}}
+{{unit "cdmf.unit.lib.editable"}}
{{unit "cdmf.unit.lib.qrcode"}}
{{unit "cdmf.unit.device.type.qr-modal"}}
@@ -51,14 +52,41 @@
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/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js
index c5e0619f7a..b363aa2ecb 100644
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js
@@ -112,6 +112,9 @@ 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;
return deviceViewData;
}
\ No newline at end of file
diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js
index 0e2375033f..ac2a06be8b 100755
--- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js
+++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js
@@ -69,8 +69,7 @@ var InitiateViewOption = null;
activeTabPaneCaret.removeClass("fw-up").addClass("fw-down");
activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up");
});
-
-
+
$('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){
var clickedPanel = $(this).attr('href');
@@ -81,6 +80,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 =
+ '' +
+ '';
function positionArrow(selectedTab) {
var selectedTabHeight = $(selectedTab).innerHeight();