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 Owner" class="text-filter"></th>
<th data-for="By Status" class="select-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 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> <th class="no-sort"></th>
</tr> </tr>
<tr class="bulk-action-row hidden"> <tr class="bulk-action-row hidden">
@ -109,7 +109,10 @@
</div> </div>
<div id="operation-guide" class="bs-callout bs-callout-info"> <div id="operation-guide" class="bs-callout bs-callout-info">
<h4>Enabling Device Operations</h4> <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> </div>
</th> </th>
</tr> </tr>

@ -19,7 +19,7 @@
{{unit "mdm.unit.date-range-picker"}} {{unit "mdm.unit.date-range-picker"}}
{{#zone "content"}} {{#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"}} {{unit "mdm.unit.device.operation-mod"}}
</div> </div>
{{/zone}} {{/zone}}

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

@ -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);
});
}); });
} }

@ -107,14 +107,16 @@
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4> <h4>
{{#equal code "WIPE_DATA"}} {{#equal code "WIPE_DATA"}}
{{#equal type "android"}} {{#equal deviceType "android"}}
Enter PIN code (Optional - This is required only if the device type is BYOD). {{#equal ownership "BYOD"}}
<br><br> Enter PIN code* of the device
<div> <br><br>
<input type="password" class="form-control modal-input operationDataKeys" id="pin" <div>
data-key="pin"> <input id="pin" type="password"
</div> class="form-control modal-input operationDataKeys"
<br> placeholder="[ Required for a BYOD device ]" data-key="pin" />
</div>
{{/equal}}
{{/equal}} {{/equal}}
{{/equal}} {{/equal}}
{{#equal code "NOTIFICATION"}} {{#equal code "NOTIFICATION"}}
@ -141,26 +143,28 @@
<br> <br>
{{/equal}} {{/equal}}
{{#equal code "DEVICE_LOCK"}} {{#equal code "DEVICE_LOCK"}}
{{#equal type "android"}} {{#equal deviceType "android"}}
Type your message to be shown in the lock screen (Optional). {{#equal ownership "COPE"}}
<br><br> <label class="wr-input-control checkbox">
<div> <input id="hard-lock" type="checkbox" class="form-control operationDataKeys"
<textarea class="form-control modal-input operationDataKeys" id="lock-message" data-key="hard-lock"/>
data-key="lock-message"></textarea>
</div>
<br>
<label class="wr-input-control checkbox">
<input id="hard-lock" type="checkbox" class="form-control operationDataKeys"
data-key="hard-lock"/>
<span class="helper" title="Once it enables, device will be blocked permanently."> <span class="helper" title="Once it enables, device will be blocked permanently.">
&nbsp;&nbsp;&nbsp;Enable Permanent Lock &nbsp;&nbsp;&nbsp;Enable Permanent Lock
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span> <span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span> </span>
</label> </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}} {{/equal}}
{{#equal code "UPGRADE_FIRMWARE"}} {{#equal code "UPGRADE_FIRMWARE"}}
{{#equal type "android"}} {{#equal deviceType "android"}}
Enter firmware upgrade scheduling information. Enter firmware upgrade scheduling information.
<br><br> <br><br>
<label class="wr-input-control checkbox"> <label class="wr-input-control checkbox">

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

@ -5,7 +5,7 @@
{{#zone "content"}} {{#zone "content"}}
{{#if deviceFound}} {{#if deviceFound}}
{{#if isAuthorized}} {{#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}} Device {{device.name}}
{{#if device.viewModel.model}} {{#if device.viewModel.model}}
<span class="lbl-device"> <span class="lbl-device">
@ -101,7 +101,7 @@
{{/defineZone}} {{/defineZone}}
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Operations</div> <div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Operations</div>
<div class="add-margin-top-4x"> <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> </div>
</div> </div>

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

Loading…
Cancel
Save