From edb8e71ac2917dd49ae2d38b512f680f9634e0ca Mon Sep 17 00:00:00 2001 From: lakshani Date: Tue, 7 Feb 2017 10:38:12 +0530 Subject: [PATCH 1/2] Added change device status feature to mobile plugings --- .../device-view.hbs | 44 +++++++++++--- .../device-view.js | 3 + .../public/js/device-detail.js | 56 ++++++++++++++++++ .../device-view.hbs | 44 +++++++++++--- .../device-view.js | 3 + .../public/js/device-detail.js | 59 ++++++++++++++++++- 6 files changed, 191 insertions(+), 18 deletions(-) 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 ca9efda9d..4b2dfe84a 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 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 = + '' + + ''; 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 3e999e40d..046a5ae15 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 c5e0619f7..b363aa2ec 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 0e2375033..ac2a06be8 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(); From 3c349a71e67a8ac682114ddf2484731aae474d3c Mon Sep 17 00:00:00 2001 From: lakshani Date: Tue, 7 Feb 2017 10:42:28 +0530 Subject: [PATCH 2/2] removed unwanted repositories from restconnector --- .../pom.xml | 23 ------------------- pom.xml | 2 +- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml index a9b34ac34..95489a87c 100644 --- a/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml +++ b/components/extensions/appm-connector/org.wso2.carbon.appmgt.mdm.restconnector/pom.xml @@ -27,29 +27,6 @@ bundle WSO2 Carbon - App Manager WSO2 MDM REST Connector Component http://maven.apache.org - - - wso2-maven2-repository - WSO2 Maven2 Repository - http://dist.wso2.org/maven2/ - - - wso2-maven2-snapshot-repository - WSO2 Maven2 Snapshot Repository - http://dist.wso2.org/snapshots/maven2/ - - - wso2-nexus - WSO2 internal Repository - http://maven.wso2.org/nexus/content/groups/wso2-public/ - - true - daily - ignore - - - - diff --git a/pom.xml b/pom.xml index e46da6005..183f2b19f 100644 --- a/pom.xml +++ b/pom.xml @@ -1244,7 +1244,7 @@ 1.1.1 - 2.0.13 + 2.0.17 [2.0.0, 3.0.0)