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
revert-dabc3590
lasanthaDLPDS 6 years ago
parent c20492eb1c
commit fdd1ef9ba1

@ -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,19 +24,28 @@ 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;
var filteredDeviceData = response["content"];
// creating deviceView information model from filtered device data
// 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) {

Loading…
Cancel
Save