dilanua 8 years ago
parent fb6eded30c
commit 9d35017744

@ -99,7 +99,7 @@
<th data-for="By Owner" class="text-filter"></th>
<th data-for="By Status" class="select-filter"></th>
<th data-for="By Platform" class="select-filter data-platform"></th>
<th data-for="By Ownership" class="select-filter"></th>
<th data-for="By Ownership" class="select-filter data-ownership"></th>
<th class="no-sort"></th>
</tr>
<tr class="bulk-action-row hidden">
@ -109,7 +109,10 @@
</div>
<div id="operation-guide" class="bs-callout bs-callout-info">
<h4>Enabling Device Operations</h4>
<p>To enable device operations, select the desired platform from above filter.</p>
<h5 class="add-padding-top-1x">
To enable device operations, select the desired platform and
ownership from above filter.
</h5>
</div>
</th>
</tr>

@ -19,7 +19,7 @@
{{unit "mdm.unit.date-range-picker"}}
{{#zone "content"}}
<div id = "operations-mod" data-permissions="{{permissions}}">
<div id="operations-mod" data-permissions="{{permissions}}" data-device-type="{{deviceType}}" data-ownership="{{ownership}}">
{{unit "mdm.unit.device.operation-mod"}}
</div>
{{/zone}}

@ -16,8 +16,8 @@
* under the License.
*/
function onRequest() {
// var log = new Log("mdm.unit.device.operation-bar");
function onRequest(context) {
var log = new Log("mdm.unit.device.operation-bar");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var viewModel = {};
var permissions = {};
@ -93,10 +93,14 @@ function onRequest() {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/ring")) {
permissions["windows"].push("DEVICE_RING");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lockreset")) {
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock-reset")) {
permissions["windows"].push("LOCK_RESET");
}
viewModel["permissions"] = stringify(permissions);
viewModel["deviceType"] = context.unit.params.deviceType;
viewModel["ownership"] = context.unit.params.ownership;
return viewModel;
}

@ -31,6 +31,10 @@ var operations = '.wr-operations',
"ANDROID": "android",
"IOS": "ios",
"WINDOWS": "windows"
},
ownershipTypeConstants = {
"BYOD": "BYOD",
"COPE": "COPE"
};
/*
@ -94,20 +98,21 @@ function getDevicesByTypes(deviceList) {
return deviceTypes;
}
function unloadOperationBar() {
$("#showOperationsBtn").addClass("hidden");
$(".wr-operations").html("");
}
//function unloadOperationBar() {
// $("#showOperationsBtn").addClass("hidden");
// $(".wr-operations").html("");
//}
function loadOperationBar(deviceType) {
function loadOperationBar(deviceType, ownership) {
var operationBar = $("#operations-bar");
var operationBarSrc = operationBar.attr("src");
var platformType = deviceType;
//var selectedDeviceID = deviceId;
$.template("operations-bar", operationBarSrc, function (template) {
//var serviceURL = "/mdm-admin/features/" + platformType;
var serviceURL = "/api/device-mgt/v1.0/devices/" + platformType + "/*/features";
var successCallback = function (data) {
var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/*/features";
invokerUtil.get(
serviceURL,
// success callback
function (data) {
var permittedOperations = [];
var i;
var permissionList = $("#operations-mod").data("permissions");
@ -116,8 +121,15 @@ function loadOperationBar(deviceType) {
var 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]);
}
}
}
}
@ -127,7 +139,6 @@ function loadOperationBar(deviceType) {
switch (deviceType) {
case platformTypeConstants.ANDROID:
iconName = operationModule.getAndroidIconForFeature(current.code);
current.type = deviceType;
break;
case platformTypeConstants.WINDOWS:
iconName = operationModule.getWindowsIconForFeature(current.code);
@ -137,17 +148,27 @@ function loadOperationBar(deviceType) {
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;
return current;
}
return current;
});
viewModel.features = permittedOperations;
var content = template(viewModel);
$(".wr-operations").html(content);
};
invokerUtil.get(serviceURL, successCallback, function (message) {
},
// error callback
function (message) {
$(".wr-operations").html(message);
});
});

@ -107,14 +107,16 @@
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
{{#equal code "WIPE_DATA"}}
{{#equal type "android"}}
Enter PIN code (Optional - This is required only if the device type is BYOD).
{{#equal deviceType "android"}}
{{#equal ownership "BYOD"}}
Enter PIN code* of the device
<br><br>
<div>
<input type="password" class="form-control modal-input operationDataKeys" id="pin"
data-key="pin">
<input id="pin" type="password"
class="form-control modal-input operationDataKeys"
placeholder="[ Required for a BYOD device ]" data-key="pin" />
</div>
<br>
{{/equal}}
{{/equal}}
{{/equal}}
{{#equal code "NOTIFICATION"}}
@ -141,14 +143,8 @@
<br>
{{/equal}}
{{#equal code "DEVICE_LOCK"}}
{{#equal type "android"}}
Type your message to be shown in the lock screen (Optional).
<br><br>
<div>
<textarea class="form-control modal-input operationDataKeys" id="lock-message"
data-key="lock-message"></textarea>
</div>
<br>
{{#equal deviceType "android"}}
{{#equal ownership "COPE"}}
<label class="wr-input-control checkbox">
<input id="hard-lock" type="checkbox" class="form-control operationDataKeys"
data-key="hard-lock"/>
@ -157,10 +153,18 @@
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<br><br>
{{/equal}}
Type your message to be shown in the lock screen
<br><br>
<div>
<textarea id="lock-message" class="form-control modal-input operationDataKeys"
data-key="lock-message" placeholder="[ Message content is optional ]"></textarea>
</div>
{{/equal}}
{{/equal}}
{{#equal code "UPGRADE_FIRMWARE"}}
{{#equal type "android"}}
{{#equal deviceType "android"}}
Enter firmware upgrade scheduling information.
<br><br>
<label class="wr-input-control checkbox">

@ -22,6 +22,7 @@ var InitiateViewOption = null;
var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type");
var ownership = deviceId.data("ownership");
var operationTable;
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {
@ -291,7 +292,7 @@ var InitiateViewOption = null;
$(document).ready(function () {
$(".device-detail-body").removeClass("hidden");
$("#loading-content").remove();
loadOperationBar(deviceType);
loadOperationBar(deviceType, ownership);
loadOperationsLog(false);
loadApplicationsList();
loadPolicyCompliance();

@ -5,7 +5,7 @@
{{#zone "content"}}
{{#if deviceFound}}
{{#if isAuthorized}}
<h1 class="page-sub-title device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}">
<h1 class="page-sub-title device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}" data-ownership="{{device.viewModel.ownership}}">
Device {{device.name}}
{{#if device.viewModel.model}}
<span class="lbl-device">
@ -101,7 +101,7 @@
{{/defineZone}}
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Operations</div>
<div class="add-margin-top-4x">
{{unit "mdm.unit.device.operation-bar" deviceType=device.type}}
{{unit "mdm.unit.device.operation-bar" deviceType=device.type ownership=device.viewModel.ownership}}
</div>
</div>
</div>

@ -51,6 +51,7 @@ function onRequest(context) {
latitude: device["properties"]["LATITUDE"],
longitude: device["properties"]["LONGITUDE"]
};
viewModel["ownership"] = device["ownership"];
} else if (device["type"] == "android") {
viewModel["deviceIdentifier"] = device["deviceIdentifier"];
viewModel["deviceName"] = device["name"];
@ -132,6 +133,7 @@ function onRequest(context) {
latitude: device["properties"]["LATITUDE"],
longitude: device["properties"]["LONGITUDE"]
};
viewModel["ownership"] = device["ownership"];
}
device["viewModel"] = viewModel;
}

Loading…
Cancel
Save