Merge pull request #920 from lasanthaDLPDS/master

Improve default operations loading
revert-dabc3590
Geeth 6 years ago committed by GitHub
commit f81c8a1e87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,7 +16,9 @@
data-type="{{device.type}}"
data-ownership="{{device.ownership}}"
data-owner="{{device.owner}}"
data-status="{{device.status}}">
data-status="{{device.status}}"
data-deviceinfoservice="{{device.deviceInfoServiceAPI}}"
data-devicelocationservice="{{device.deviceLocationServiceAPI}}">
{{device.owner}}'s {{device.name}}
<a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}}
Firmware Build Date: {{device.osBuildDate}}

@ -24,12 +24,12 @@ function onRequest(context) {
var deviceViewData = {};
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var carbonServer = require("carbon").server;
var constants = require("/app/modules/constants.js")
var constants = require("/app/modules/constants.js");
if (deviceType && deviceId) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId, owner);
if (response["status"] == "success") {
if (response["status"] === "success") {
deviceViewData["deviceFound"] = true;
deviceViewData["isAuthorized"] = true;
@ -37,6 +37,15 @@ function onRequest(context) {
// creating deviceView information model from filtered device data
var viewModel = {};
var deviceInfoServiceAPI = devicemgtProps["deviceInfoServiceAPI"];
var deviceLocationServiceAPI = devicemgtProps["deviceLocationServiceAPI"];
if (deviceInfoServiceAPI){
viewModel["deviceInfoServiceAPI"] = deviceInfoServiceAPI.replace("%device-type%", deviceType)
}
if (deviceLocationServiceAPI){
viewModel['deviceLocationServiceAPI'] = deviceLocationServiceAPI.replace("%device-type%", deviceType)
}
if (filteredDeviceData["type"]) {
viewModel["type"] = filteredDeviceData["type"];
viewModel.isNotWindows = true;

@ -26,19 +26,13 @@ var InitiateViewOption = null;
var devStatus = deviceId.data("status");
var payload = [deviceIdentifier];
var operationTable;
var serviceUrl;
var serviceUrlLocal = "/api/device-mgt/android/v1.0/admin/devices/location";
if (deviceType == "ios") {
serviceUrl = "/ios/operation/deviceinfo";
} else if (deviceType == "android") {
//var serviceUrl = "/mdm-android-agent/operation/device-info";
serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info";
serviceUrlLocal = "/api/device-mgt/android/v1.0/admin/devices/location";
}
if (serviceUrl && ("REMOVED" !== devStatus)) {
if ("REMOVED" !== devStatus) {
var deviceInfoServiceAPI = deviceId.data("deviceinfoservice");
var deviceLocationServiceAPI = deviceId.data("devicelocationservice");
if (deviceInfoServiceAPI) {
invokerUtil.post(
serviceUrl,
deviceInfoServiceAPI,
payload,
// success-callback
function () {
@ -51,8 +45,10 @@ var InitiateViewOption = null;
$(".panel-body").append(defaultInnerHTML);
}
);
}
if (deviceLocationServiceAPI) {
invokerUtil.post(
serviceUrlLocal,
deviceLocationServiceAPI,
payload,
// success-callback
function () {
@ -65,7 +61,7 @@ var InitiateViewOption = null;
$(".panel-body").append(defaultInnerHTML);
}
);
}
}
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {

@ -15,7 +15,9 @@
data-type="{{device.type}}"
data-ownership="{{device.ownership}}"
data-owner="{{device.owner}}"
data-status="{{device.status}}">
data-status="{{device.status}}"
data-deviceinfoservice="{{device.deviceInfoServiceAPI}}"
data-devicelocationservice="{{device.deviceLocationServiceAPI}}">
{{device.owner}}'s {{device.name}}
</h1>
<a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}}

@ -26,7 +26,7 @@ function onRequest(context) {
if (deviceType && deviceId) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId, owner);
if (response["status"] == "success") {
if (response["status"] === "success") {
deviceViewData["deviceFound"] = true;
deviceViewData["isAuthorized"] = true;
@ -34,6 +34,15 @@ function onRequest(context) {
// creating deviceView information model from filtered device data
var viewModel = {};
var deviceInfoServiceAPI = devicemgtProps["deviceInfoServiceAPI"];
var deviceLocationServiceAPI = devicemgtProps["deviceLocationServiceAPI"];
if (deviceInfoServiceAPI){
viewModel["deviceInfoServiceAPI"] = deviceInfoServiceAPI.replace("%device-type%", deviceType)
}
if (deviceLocationServiceAPI){
viewModel['deviceLocationServiceAPI'] = deviceLocationServiceAPI.replace("%device-type%", deviceType)
}
if (filteredDeviceData["type"]) {
viewModel["type"] = filteredDeviceData["type"];
viewModel.isNotWindows = true;

@ -26,18 +26,29 @@ var InitiateViewOption = null;
var devStatus = deviceId.data("status");
var payload = [deviceIdentifier];
var operationTable;
var serviceUrl;
if (deviceType == "ios") {
serviceUrl = "/ios/operation/deviceinfo";
} else if (deviceType == "android") {
//var serviceUrl = "/mdm-android-agent/operation/device-info";
serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info";
if ("REMOVED" !== devStatus) {
var deviceInfoServiceAPI = deviceId.data("deviceinfoservice");
var deviceLocationServiceAPI = deviceId.data("devicelocationservice");
if (deviceInfoServiceAPI) {
invokerUtil.post(
deviceInfoServiceAPI,
payload,
// success-callback
function () {
$(".panel-body").show();
},
// error-callback
function () {
var defaultInnerHTML =
"<br><p class='fw-warning'>Device data may not have been updated. Please refresh to try again.<p>";
$(".panel-body").append(defaultInnerHTML);
}
if (serviceUrl && ("REMOVED" !== devStatus)) {
);
}
if (deviceLocationServiceAPI) {
invokerUtil.post(
serviceUrl,
deviceLocationServiceAPI,
payload,
// success-callback
function () {
@ -51,6 +62,7 @@ var InitiateViewOption = null;
}
);
}
}
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {

@ -1230,7 +1230,7 @@
<javax.ws.rs.version>1.1.1</javax.ws.rs.version>
<!-- Carbon Device Management -->
<carbon.devicemgt.version>3.1.47</carbon.devicemgt.version>
<carbon.devicemgt.version>3.1.48</carbon.devicemgt.version>
<carbon.devicemgt.version.range>[3.1.0, 4.0.0)</carbon.devicemgt.version.range>
<!-- Carbon App Management -->

Loading…
Cancel
Save