From fdd1ef9ba164692b2913ce2a171a95e87c72bb74 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Wed, 24 Oct 2018 08:42:01 +0530 Subject: [PATCH] Configure default operations loading When loading device details page, default operatios are loaded always. With this improvement, default operations will be loaded if API paths are defined in the config.json --- .../device-view.hbs | 12 ++-- .../device-view.js | 15 +++- .../public/js/device-detail.js | 68 +++++++++---------- .../device-view.hbs | 12 ++-- .../device-view.js | 11 ++- .../public/js/device-detail.js | 54 +++++++++------ 6 files changed, 101 insertions(+), 71 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 a1f1a3862..c0424ebd4 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 @@ -12,11 +12,13 @@ {{#zone "device-details-header"}}

+ data-deviceid="{{device.deviceIdentifier}}" + data-type="{{device.type}}" + data-ownership="{{device.ownership}}" + data-owner="{{device.owner}}" + data-status="{{device.status}}" + data-deviceinfoservice="{{device.deviceInfoServiceAPI}}" + data-devicelocationservice="{{device.deviceLocationServiceAPI}}"> {{device.owner}}'s {{device.name}}

Device data may not have been updated. Please refresh to try again.

"; - $(".panel-body").append(defaultInnerHTML); - } + deviceInfoServiceAPI, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } ); + } + if (deviceLocationServiceAPI) { invokerUtil.post( - serviceUrlLocal, - payload, - // success-callback - function () { - $(".panel-body").show(); - }, - // error-callback - function () { - var defaultInnerHTML = - "

Device data may not have been updated. Please refresh to try again.

"; - $(".panel-body").append(defaultInnerHTML); - } + deviceLocationServiceAPI, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } ); - + } } $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { 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 c292e3e7d..76ca1ccfd 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 @@ -11,11 +11,13 @@ {{#zone "device-details-header"}}

+ data-deviceid="{{device.deviceIdentifier}}" + data-type="{{device.type}}" + data-ownership="{{device.ownership}}" + data-owner="{{device.owner}}" + data-status="{{device.status}}" + data-deviceinfoservice="{{device.deviceInfoServiceAPI}}" + data-devicelocationservice="{{device.deviceLocationServiceAPI}}"> {{device.owner}}'s {{device.name}}

Device data may not have been updated. Please refresh to try again.

"; - $(".panel-body").append(defaultInnerHTML); - } + deviceInfoServiceAPI, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } + ); + } + if (deviceLocationServiceAPI) { + invokerUtil.post( + deviceLocationServiceAPI, + payload, + // success-callback + function () { + $(".panel-body").show(); + }, + // error-callback + function () { + var defaultInnerHTML = + "

Device data may not have been updated. Please refresh to try again.

"; + $(".panel-body").append(defaultInnerHTML); + } ); + } }