|
|
@ -31,6 +31,10 @@ var operations = '.wr-operations',
|
|
|
|
"ANDROID": "android",
|
|
|
|
"ANDROID": "android",
|
|
|
|
"IOS": "ios",
|
|
|
|
"IOS": "ios",
|
|
|
|
"WINDOWS": "windows"
|
|
|
|
"WINDOWS": "windows"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ownershipTypeConstants = {
|
|
|
|
|
|
|
|
"BYOD": "BYOD",
|
|
|
|
|
|
|
|
"COPE": "COPE"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -94,20 +98,21 @@ function getDevicesByTypes(deviceList) {
|
|
|
|
return deviceTypes;
|
|
|
|
return deviceTypes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function unloadOperationBar() {
|
|
|
|
//function unloadOperationBar() {
|
|
|
|
$("#showOperationsBtn").addClass("hidden");
|
|
|
|
// $("#showOperationsBtn").addClass("hidden");
|
|
|
|
$(".wr-operations").html("");
|
|
|
|
// $(".wr-operations").html("");
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
function loadOperationBar(deviceType) {
|
|
|
|
function loadOperationBar(deviceType, ownership) {
|
|
|
|
var operationBar = $("#operations-bar");
|
|
|
|
var operationBar = $("#operations-bar");
|
|
|
|
var operationBarSrc = operationBar.attr("src");
|
|
|
|
var operationBarSrc = operationBar.attr("src");
|
|
|
|
var platformType = deviceType;
|
|
|
|
|
|
|
|
//var selectedDeviceID = deviceId;
|
|
|
|
|
|
|
|
$.template("operations-bar", operationBarSrc, function (template) {
|
|
|
|
$.template("operations-bar", operationBarSrc, function (template) {
|
|
|
|
//var serviceURL = "/mdm-admin/features/" + platformType;
|
|
|
|
var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/*/features";
|
|
|
|
var serviceURL = "/api/device-mgt/v1.0/devices/" + platformType + "/*/features";
|
|
|
|
invokerUtil.get(
|
|
|
|
var successCallback = function (data) {
|
|
|
|
serviceURL,
|
|
|
|
|
|
|
|
// success callback
|
|
|
|
|
|
|
|
function (data) {
|
|
|
|
var permittedOperations = [];
|
|
|
|
var permittedOperations = [];
|
|
|
|
var i;
|
|
|
|
var i;
|
|
|
|
var permissionList = $("#operations-mod").data("permissions");
|
|
|
|
var permissionList = $("#operations-mod").data("permissions");
|
|
|
@ -116,8 +121,15 @@ function loadOperationBar(deviceType) {
|
|
|
|
var j;
|
|
|
|
var j;
|
|
|
|
for (j = 0; j < totalFeatures.length; j++) {
|
|
|
|
for (j = 0; j < totalFeatures.length; j++) {
|
|
|
|
if (permissionList[deviceType][i] == totalFeatures[j]["code"]) {
|
|
|
|
if (permissionList[deviceType][i] == totalFeatures[j]["code"]) {
|
|
|
|
|
|
|
|
if (deviceType == platformTypeConstants.ANDROID &&
|
|
|
|
|
|
|
|
totalFeatures[j]["code"] == "DEVICE_UNLOCK") {
|
|
|
|
|
|
|
|
if (ownership == ownershipTypeConstants.COPE) {
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -127,7 +139,6 @@ function loadOperationBar(deviceType) {
|
|
|
|
switch (deviceType) {
|
|
|
|
switch (deviceType) {
|
|
|
|
case platformTypeConstants.ANDROID:
|
|
|
|
case platformTypeConstants.ANDROID:
|
|
|
|
iconName = operationModule.getAndroidIconForFeature(current.code);
|
|
|
|
iconName = operationModule.getAndroidIconForFeature(current.code);
|
|
|
|
current.type = deviceType;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case platformTypeConstants.WINDOWS:
|
|
|
|
case platformTypeConstants.WINDOWS:
|
|
|
|
iconName = operationModule.getWindowsIconForFeature(current.code);
|
|
|
|
iconName = operationModule.getWindowsIconForFeature(current.code);
|
|
|
@ -137,17 +148,27 @@ function loadOperationBar(deviceType) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* adding ownership in addition to device-type
|
|
|
|
|
|
|
|
as it's vital in cases where UI for the same feature should change
|
|
|
|
|
|
|
|
according to ownership
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (ownership) {
|
|
|
|
|
|
|
|
current.ownership = ownership;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (iconName) {
|
|
|
|
if (iconName) {
|
|
|
|
current.icon = iconName;
|
|
|
|
current.icon = iconName;
|
|
|
|
return current;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return current;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
viewModel.features = permittedOperations;
|
|
|
|
viewModel.features = permittedOperations;
|
|
|
|
var content = template(viewModel);
|
|
|
|
var content = template(viewModel);
|
|
|
|
$(".wr-operations").html(content);
|
|
|
|
$(".wr-operations").html(content);
|
|
|
|
};
|
|
|
|
},
|
|
|
|
invokerUtil.get(serviceURL, successCallback, function (message) {
|
|
|
|
// error callback
|
|
|
|
|
|
|
|
function (message) {
|
|
|
|
$(".wr-operations").html(message);
|
|
|
|
$(".wr-operations").html(message);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|