From dbfdb0d0849443b5964647cd7dc7a5f0fcab33fb Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Tue, 20 Jun 2017 15:29:59 +0530 Subject: [PATCH] Prevented unnecessary API calls to fetch device-info if the device is disenrolled which resolves wso2/product-iots#429 --- .../cdmf.unit.device.type.android.device-view/device-view.hbs | 2 +- .../public/js/device-detail.js | 3 ++- .../cdmf.unit.device.type.windows.device-view/device-view.hbs | 2 +- .../public/js/device-detail.js | 3 ++- 4 files changed, 6 insertions(+), 4 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 189bcf087..f59eb33c3 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 @@ -9,7 +9,7 @@

+ data-owner="{{device.owner}}" data-status="{{device.status}}"> Device {{device.name}} {{#if device.model}} 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 4399b6152..be187afa2 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 @@ -23,6 +23,7 @@ var InitiateViewOption = null; var deviceIdentifier = deviceId.data("deviceid"); var deviceType = deviceId.data("type"); var ownership = deviceId.data("ownership"); + var devStatus = deviceId.data("status"); var payload = [deviceIdentifier]; var operationTable; var serviceUrl; @@ -35,7 +36,7 @@ var InitiateViewOption = null; serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; serviceUrlLocal = "/api/device-mgt/android/v1.0/admin/devices/location"; } - if (serviceUrl) { + if (serviceUrl && ("REMOVED" !== devStatus)) { invokerUtil.post( serviceUrl, payload, 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 046a5ae15..937ab7c4b 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 @@ -10,7 +10,7 @@

+ data-owner="{{device.owner}}" data-status="{{device.status}}"> Device {{device.name}} {{#if device.model}} 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 ac2a06be8..13684afe4 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 @@ -23,6 +23,7 @@ var InitiateViewOption = null; var deviceIdentifier = deviceId.data("deviceid"); var deviceType = deviceId.data("type"); var ownership = deviceId.data("ownership"); + var devStatus = deviceId.data("status"); var payload = [deviceIdentifier]; var operationTable; var serviceUrl; @@ -34,7 +35,7 @@ var InitiateViewOption = null; serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info"; } - if (serviceUrl) { + if (serviceUrl && ("REMOVED" !== devStatus)) { invokerUtil.post( serviceUrl, payload,