|
|
@ -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,62 +98,79 @@ 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,
|
|
|
|
var permittedOperations = [];
|
|
|
|
// success callback
|
|
|
|
var i;
|
|
|
|
function (data) {
|
|
|
|
var permissionList = $("#operations-mod").data("permissions");
|
|
|
|
var permittedOperations = [];
|
|
|
|
var totalFeatures = JSON.parse(data);
|
|
|
|
var i;
|
|
|
|
for (i = 0; i < permissionList[deviceType].length; i++) {
|
|
|
|
var permissionList = $("#operations-mod").data("permissions");
|
|
|
|
var j;
|
|
|
|
var totalFeatures = JSON.parse(data);
|
|
|
|
for (j = 0; j < totalFeatures.length; j++) {
|
|
|
|
for (i = 0; i < permissionList[deviceType].length; i++) {
|
|
|
|
if (permissionList[deviceType][i] == totalFeatures[j]["code"]) {
|
|
|
|
var j;
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
for (j = 0; j < totalFeatures.length; j++) {
|
|
|
|
|
|
|
|
if (permissionList[deviceType][i] == totalFeatures[j]["code"]) {
|
|
|
|
|
|
|
|
if (deviceType == platformTypeConstants.ANDROID &&
|
|
|
|
|
|
|
|
totalFeatures[j]["code"] == "DEVICE_UNLOCK") {
|
|
|
|
|
|
|
|
if (ownership == ownershipTypeConstants.COPE) {
|
|
|
|
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
permittedOperations.push(totalFeatures[j]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var viewModel = {};
|
|
|
|
var viewModel = {};
|
|
|
|
permittedOperations = permittedOperations.filter(function (current) {
|
|
|
|
permittedOperations = permittedOperations.filter(function (current) {
|
|
|
|
var iconName;
|
|
|
|
var iconName;
|
|
|
|
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);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case platformTypeConstants.IOS:
|
|
|
|
case platformTypeConstants.IOS:
|
|
|
|
iconName = operationModule.getIOSIconForFeature(current.code);
|
|
|
|
iconName = operationModule.getIOSIconForFeature(current.code);
|
|
|
|
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) {
|
|
|
|
|
|
|
|
current.icon = iconName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (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
|
|
|
|
$(".wr-operations").html(message);
|
|
|
|
function (message) {
|
|
|
|
});
|
|
|
|
$(".wr-operations").html(message);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|