dilanua 8 years ago
parent 8bd20911fe
commit f85e28c902

@ -22,39 +22,37 @@ 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 payload = [deviceIdentifier];
var operationTable; var operationTable;
var serviceUrl; // var payload = [deviceIdentifier];
// 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 (serviceUrl) {
invokerUtil.post(
serviceUrl,
payload,
// success-callback
function () {
$(".panel-body").show();
},
// error-callback
function () {
var defaultInnerHTML =
"<br><p class='small'><i class='fw-warning'></i>&nbsp;Device data may not have been updated. Please refresh to try again.<p>";
$(".panel-body").append(defaultInnerHTML);
}
);
}
// 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 (serviceUrl) {
// invokerUtil.post(
// serviceUrl,
// payload,
// // success-callback
// function () {
// $(".panel-body").show();
// },
// // error-callback
// function () {
// var defaultInnerHTML =
// "<br><p class='small'><i class='fw-warning'></i>&nbsp;Device data may not have been updated. Please refresh to try again.<p>";
// $(".panel-body").append(defaultInnerHTML);
// }
// );
// }
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {
var activeTabPane = $(e.target).attr("href"); var activeTabPane = $(e.target).attr("href");
var activeListGroupItem = $(".media .list-group-item.active"); var activeListGroupItem = $(".media .list-group-item.active");
$(activeTabPane).removeClass("visible-xs-block"); $(activeTabPane).removeClass("visible-xs-block");
$(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block"); $(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block");
positionArrow(activeListGroupItem); positionArrow(activeListGroupItem);
@ -62,17 +60,14 @@ var InitiateViewOption = null;
$(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) {
var thisParent = $(e.target).parent(); var thisParent = $(e.target).parent();
var activeTabPaneCaret = thisParent.find('.caret-updown'); var activeTabPaneCaret = thisParent.find(".caret-updown");
var activeTabPaneCaretSiblings = thisParent.siblings().find('.caret-updown'); var activeTabPaneCaretSiblings = thisParent.siblings().find(".caret-updown");
activeTabPaneCaret.removeClass("fw-up").addClass("fw-down"); activeTabPaneCaret.removeClass("fw-up").addClass("fw-down");
activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up"); activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up");
}); });
$(".media.tab-responsive a[data-toggle='collapse']").on("click", function () {
$('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){
var clickedPanel = $(this).attr('href'); var clickedPanel = $(this).attr('href');
if ($(clickedPanel).hasClass('in')) { if ($(clickedPanel).hasClass('in')) {
$(clickedPanel).collapse('hide'); $(clickedPanel).collapse('hide');
} else { } else {
@ -80,7 +75,6 @@ var InitiateViewOption = null;
} }
}); });
function positionArrow(selectedTab) { function positionArrow(selectedTab) {
var selectedTabHeight = $(selectedTab).innerHeight(); var selectedTabHeight = $(selectedTab).innerHeight();
var arrowPosition = 0; var arrowPosition = 0;
@ -108,30 +102,6 @@ var InitiateViewOption = null;
$(arrow).css("top", arrowPosition - 10); $(arrow).css("top", arrowPosition - 10);
} }
$(document).ready(function() {
$(".device-detail-body").removeClass("hidden");
$("#loading-content").remove();
loadOperationBar(deviceType);
loadOperationsLog(false);
loadApplicationsList();
loadPolicyCompliance();
$("#refresh-policy").click(function () {
$("#policy-spinner").removeClass("hidden");
loadPolicyCompliance();
});
$("#refresh-apps").click(function () {
$("#apps-spinner").removeClass("hidden");
loadApplicationsList();
});
$("#refresh-operations").click(function () {
$("#operations-spinner").removeClass("hidden");
loadOperationsLog(true);
});
});
function loadOperationsLog(update) { function loadOperationsLog(update) {
var operationsLogTable = "#operations-log-table"; var operationsLogTable = "#operations-log-table";
if (update) { if (update) {
@ -273,8 +243,8 @@ var InitiateViewOption = null;
// success-callback // success-callback
function (data, textStatus, jqXHR) { function (data, textStatus, jqXHR) {
if (jqXHR.status == 200 && data) { if (jqXHR.status == 200 && data) {
data = JSON.parse(data);
$("#policy-spinner").addClass("hidden"); $("#policy-spinner").addClass("hidden");
data = JSON.parse(data);
if (data["active"] == true) { if (data["active"] == true) {
activePolicy = data; activePolicy = data;
invokerUtil.get( invokerUtil.get(
@ -300,32 +270,72 @@ var InitiateViewOption = null;
$("#policy-list-container").html(content); $("#policy-list-container").html(content);
$("#policy-compliance-table").addClass("hidden"); $("#policy-compliance-table").addClass("hidden");
} }
} else {
$("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> This device " +
"has no policy applied.<p></div>");
} }
} }
}, },
// error-callback // error-callback
function () { function () {
$("#policy-list-container"). $("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " + html("<div class='message message-warning'>" +
"was not successful. please try refreshing data in a while.<p></div>"); "<h4 class='remove-margin'>" +
"<i class='icon fw fw-warning'></i>" +
"Loading policy compliance related data " +
"was not successful. please try refreshing in a while." +
"</h4>" +
"</div>");
} }
); );
} }
} else if ((jqXHR.status == 200 && !data)) {
//$("#policy-spinner").addClass("hidden");
$("#policy-list-container").
html("<div class='message message-info'>" +
"<h4 class='remove-margin'>" +
"<i class='icon fw fw-info'></i>" +
"There is currently no effective policy applied for this device." +
"</h4>" +
"</div>");
} }
}, },
// error-callback // error-callback
function () { function () {
$("#policy-spinner").addClass("hidden");
$("#policy-list-container"). $("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " + html("<div class='message message-warning'>" +
"was not successful. please try refreshing data in a while.<p></div>"); "<h4 class='remove-margin'>" +
"<i class='icon fw fw-warning'></i>" +
"Loading policy compliance related data " +
"was not successful. please try refreshing in a while." +
"</h4>" +
"</div>");
} }
); );
} }
); );
} }
$(document).ready(function () {
$(".device-detail-body").removeClass("hidden");
$("#loading-content").remove();
loadOperationBar(deviceType);
loadOperationsLog(false);
loadApplicationsList();
loadPolicyCompliance();
$("#refresh-policy").click(function () {
$("#policy-spinner").removeClass("hidden");
loadPolicyCompliance();
});
$("#refresh-apps").click(function () {
$("#apps-spinner").removeClass("hidden");
loadApplicationsList();
});
$("#refresh-operations").click(function () {
$("#operations-spinner").removeClass("hidden");
loadOperationsLog(true);
});
});
}()); }());

@ -25,27 +25,27 @@
<tbody> <tbody>
{{#if device.viewModel.deviceIdentifier}} {{#if device.viewModel.deviceIdentifier}}
<tr role="row" class="odd"> <tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Device ID</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Device ID</td>
<td style="padding:10px 15px;">{{device.viewModel.deviceIdentifier}}</td> <td style="padding:10px 15px;">{{device.viewModel.deviceIdentifier}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.deviceName}} {{#if device.viewModel.deviceName}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Name</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Name</td>
<td style="padding:10px 15px;">{{device.viewModel.deviceName}}</td> <td style="padding:10px 15px;">{{device.viewModel.deviceName}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.vendor}} {{#if device.viewModel.vendor}}
{{#if device.viewModel.model}} {{#if device.viewModel.model}}
<tr role="row" class="odd"> <tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Model</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Model</td>
<td style="padding:10px 15px;">{{device.viewModel.vendor}} {{device.viewModel.model}}</td> <td style="padding:10px 15px;">{{device.viewModel.vendor}} {{device.viewModel.model}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if device.status}} {{#if device.status}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Status</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Status</td>
<td style="padding:10px 15px;"> <td style="padding:10px 15px;">
{{#equal device.status "ACTIVE"}}<span><i class="fw fw-ok icon-success"></i>&nbsp;&nbsp;Active</span>{{/equal}} {{#equal device.status "ACTIVE"}}<span><i class="fw fw-ok icon-success"></i>&nbsp;&nbsp;Active</span>{{/equal}}
{{#equal device.status "INACTIVE"}}<span><i class="fw fw-warning icon-warning"></i>&nbsp;&nbsp;Inactive</span>{{/equal}} {{#equal device.status "INACTIVE"}}<span><i class="fw fw-warning icon-warning"></i>&nbsp;&nbsp;Inactive</span>{{/equal}}
@ -56,43 +56,43 @@
{{/if}} {{/if}}
{{#if device.viewModel.owner}} {{#if device.viewModel.owner}}
<tr role="row" class="odd"> <tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Owner</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Owner</td>
<td style="padding:10px 15px;">{{device.viewModel.owner}}</td> <td style="padding:10px 15px;">{{device.viewModel.owner}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.ownership}} {{#if device.viewModel.ownership}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Ownership</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Ownership</td>
<td style="padding:10px 15px;">{{device.viewModel.ownership}}</td> <td style="padding:10px 15px;">{{device.viewModel.ownership}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.imei}} {{#if device.viewModel.imei}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">IMEI</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">IMEI</td>
<td style="padding:10px 15px;">{{device.viewModel.imei}}</td> <td style="padding:10px 15px;">{{device.viewModel.imei}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.udid}} {{#if device.viewModel.udid}}
<tr role="row" class="odd"> <tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">UDID</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">UDID</td>
<td style="padding:10px 15px;">{{device.viewModel.udid}}</td> <td style="padding:10px 15px;">{{device.viewModel.udid}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.os_build_date}} {{#if device.viewModel.os_build_date}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Firmware Build Date</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Firmware Build Date</td>
<td style="padding:10px 15px;">{{device.viewModel.os_build_date}}</td> <td style="padding:10px 15px;">{{device.viewModel.os_build_date}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.phoneNumber}} {{#if device.viewModel.phoneNumber}}
<tr role="row" class="odd"> <tr role="row" class="odd">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Phone Number</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Phone Number</td>
<td style="padding:10px 15px;">{{device.viewModel.phoneNumber}}</td> <td style="padding:10px 15px;">{{device.viewModel.phoneNumber}}</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if device.viewModel.lastUpdatedTime}} {{#if device.viewModel.lastUpdatedTime}}
<tr role="row" class="even"> <tr role="row" class="even">
<td class="sorting_1" style="padding:10px 15px; width: 10%;">Last Update</td> <td class="sorting_1" style="padding:10px 15px; width: 15%;">Last Update</td>
<td style="padding:10px 15px;">{{device.viewModel.lastUpdatedTime}}</td> <td style="padding:10px 15px;">{{device.viewModel.lastUpdatedTime}}</td>
</tr> </tr>
{{/if}} {{/if}}
@ -260,7 +260,8 @@
<div class="panel panel-default visible-xs-block" role="tabpanel" id="policy_compliance_tab"> <div class="panel panel-default visible-xs-block" role="tabpanel" id="policy_compliance_tab">
<div class="panel-heading visible-xs collapsed" id="policy_compliance"> <div class="panel-heading visible-xs collapsed" id="policy_compliance">
<h4 class="panel-title"> <h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> <a role="button"
data-toggle="collapse" data-parent="#tabs" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
<i class="fw fw-policy fw-2x"></i> <i class="fw fw-policy fw-2x"></i>
Policy Compliance Policy Compliance
<i class="caret-updown fw fw-down"></i> <i class="caret-updown fw fw-down"></i>
@ -269,6 +270,7 @@
</div> </div>
<div class="panel-heading display-none-xs"> <div class="panel-heading display-none-xs">
Policy Compliance Policy Compliance
&nbsp;&nbsp;
<span> <span>
<a href="javascript:void(0);" id="refresh-policy"> <a href="javascript:void(0);" id="refresh-policy">
<i class="fw fw-refresh"></i> <i class="fw fw-refresh"></i>
@ -287,7 +289,10 @@
</div> </div>
<div id="policy-list-container"> <div id="policy-list-container">
<div class="message message-info"> <div class="message message-info">
<h4 class="remove-margin"><i class="icon fw fw-info"></i>There is no active policy for this device.</h4> <h4 class="remove-margin">
<i class="icon fw fw-info"></i>
There is currently no effective policy applied for this device.
</h4>
</div> </div>
</div> </div>
</div> </div>
@ -359,13 +364,14 @@
<h4 class="panel-title"> <h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseFive" aria-expanded="true" aria-controls="collapseFive"> <a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseFive" aria-expanded="true" aria-controls="collapseFive">
<i class="fw fw-text fw-2x"></i> <i class="fw fw-text fw-2x"></i>
Operations Logs Operations Log
<i class="caret-updown fw fw-down"></i> <i class="caret-updown fw fw-down"></i>
</a> </a>
</h4> </h4>
</div> </div>
<div class="panel-heading display-none-xs"> <div class="panel-heading display-none-xs">
Operations Logs Operations Log
&nbsp;&nbsp;
<span> <span>
<a href="javascript:void(0);" id="refresh-operations"> <a href="javascript:void(0);" id="refresh-operations">
<i class="fw fw-refresh"></i> <i class="fw fw-refresh"></i>

Loading…
Cancel
Save