|
|
@ -16,195 +16,322 @@
|
|
|
|
* under the License.
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
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 deviceOwner = deviceId.data("owner");
|
|
|
|
var deviceOwner = deviceId.data("owner");
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
$(document).ready(function() {
|
|
|
|
$(".panel-body").removeClass("hidden");
|
|
|
|
$(".panel-body").removeClass("hidden");
|
|
|
|
$("#loading-content").remove();
|
|
|
|
$("#loading-content").remove();
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#event_log').length) {
|
|
|
|
if ($('#event_log').length) {
|
|
|
|
loadOperationsLog();
|
|
|
|
loadOperationsLog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#policy_compliance').length) {
|
|
|
|
|
|
|
|
loadPolicyCompliance();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($('#policy_compliance').length) {
|
|
|
|
|
|
|
|
loadPolicyCompliance();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$("#refresh-policy").click(function () {
|
|
|
|
|
|
|
|
$('#policy-spinner').removeClass('hidden');
|
|
|
|
|
|
|
|
loadPolicyCompliance();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#refresh-operations").click(function () {
|
|
|
|
$("#refresh-policy").click(function() {
|
|
|
|
$('#operations-spinner').removeClass('hidden');
|
|
|
|
$('#policy-spinner').removeClass('hidden');
|
|
|
|
loadOperationsLog(true);
|
|
|
|
loadPolicyCompliance();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#refresh-operations").click(function() {
|
|
|
|
|
|
|
|
$('#operations-spinner').removeClass('hidden');
|
|
|
|
|
|
|
|
loadOperationsLog(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function loadOperationsLog(update) {
|
|
|
|
});
|
|
|
|
var operationsLogTable = "#operations-log-table";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update) {
|
|
|
|
function loadOperationsLog() {
|
|
|
|
operationTable = $(operationsLogTable).DataTable();
|
|
|
|
var table = $('#operation-log').DataTable({
|
|
|
|
$("#operations-spinner").removeClass("hidden");
|
|
|
|
serverSide: true,
|
|
|
|
operationTable.ajax.reload(function ( json ) {
|
|
|
|
processing: false,
|
|
|
|
|
|
|
|
searching: false,
|
|
|
|
|
|
|
|
ordering: false,
|
|
|
|
|
|
|
|
pageLength: 10,
|
|
|
|
|
|
|
|
order: [],
|
|
|
|
|
|
|
|
autoWidth: false,
|
|
|
|
|
|
|
|
ajax: {
|
|
|
|
|
|
|
|
url: "/devicemgt/api/operation/paginate",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
deviceId: deviceIdentifier,
|
|
|
|
|
|
|
|
deviceType: deviceType,
|
|
|
|
|
|
|
|
owner: deviceOwner
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
dataSrc: function(json) {
|
|
|
|
$("#operations-spinner").addClass("hidden");
|
|
|
|
$("#operations-spinner").addClass("hidden");
|
|
|
|
}, false);
|
|
|
|
$("#operations-log-container").empty();
|
|
|
|
return;
|
|
|
|
return json.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operationTable = $(operationsLogTable).datatables_extended({
|
|
|
|
},
|
|
|
|
serverSide: true,
|
|
|
|
columnDefs: [{
|
|
|
|
processing: false,
|
|
|
|
targets: 0,
|
|
|
|
searching: false,
|
|
|
|
data: "code",
|
|
|
|
ordering: false,
|
|
|
|
class: "icon-only content-fill"
|
|
|
|
pageLength : 10,
|
|
|
|
},
|
|
|
|
order: [],
|
|
|
|
{
|
|
|
|
ajax: {
|
|
|
|
targets: 1,
|
|
|
|
|
|
|
|
data: "createdTimeStamp",
|
|
|
|
url: "/devicemgt/api/operation/paginate",
|
|
|
|
class: "text-right",
|
|
|
|
data: {deviceId : deviceIdentifier, deviceType: deviceType, owner: deviceOwner},
|
|
|
|
render: function(date) {
|
|
|
|
dataSrc: function (json) {
|
|
|
|
var value = String(date);
|
|
|
|
$("#operations-spinner").addClass("hidden");
|
|
|
|
return value.slice(0, 16);
|
|
|
|
$("#operations-log-container").empty();
|
|
|
|
|
|
|
|
return json.data;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
columnDefs: [
|
|
|
|
{
|
|
|
|
{targets: 0, data: "code" },
|
|
|
|
targets: 2,
|
|
|
|
{targets: 1, data: "status", render:
|
|
|
|
data: "status",
|
|
|
|
function (status) {
|
|
|
|
class: "text-right extended-log-data log-record-status",
|
|
|
|
var html;
|
|
|
|
render: function(data, type, full, meta) {
|
|
|
|
switch (status) {
|
|
|
|
return '<i class="icon fw fw-success"></i><span> ' + data + ' </span><i class="icon fw fw-down"></i>';
|
|
|
|
case "COMPLETED" :
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-success'></i> Completed</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "PENDING" :
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "ERROR" :
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IN_PROGRESS" :
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-warning'></i> In Progress</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "REPEATED" :
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-warning'></i> Repeated</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{targets: 2, data: "createdTimeStamp", render:
|
|
|
|
width: "100%"
|
|
|
|
function (date) {
|
|
|
|
}
|
|
|
|
var value = String(date);
|
|
|
|
],
|
|
|
|
return value.slice(0, 16);
|
|
|
|
fnCreatedRow: function(nRow, aData, iDataIndex) {
|
|
|
|
|
|
|
|
$('td:eq(0)', nRow)
|
|
|
|
|
|
|
|
.attr('data-search', aData.Device_Type)
|
|
|
|
|
|
|
|
.attr('data-display', aData.Device_Type)
|
|
|
|
|
|
|
|
.addClass(' icon-only content-fill');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('td:eq(1), td:eq(2)', nRow).addClass('text-right');
|
|
|
|
|
|
|
|
$('td:eq(2)', nRow).addClass('log-record-status')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#operation-log tbody').on('click', 'td.extended-log-data', function() {
|
|
|
|
|
|
|
|
var tr = $(this).closest('tr');
|
|
|
|
|
|
|
|
var row = table.row(tr);
|
|
|
|
|
|
|
|
var rowData = row.data()
|
|
|
|
|
|
|
|
var deviceid = $('.device-id').data('deviceid');
|
|
|
|
|
|
|
|
var deviceType = $('.device-id').data('type');
|
|
|
|
|
|
|
|
var uri = "/api/device-mgt/v1.0/activities/" + rowData.activityId + "/" + deviceType + "/" + deviceid;
|
|
|
|
|
|
|
|
var contentType = "application/json";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (row.child.isShown()) {
|
|
|
|
|
|
|
|
row.child.hide();
|
|
|
|
|
|
|
|
$(row.child()).removeClass('log-data-row');
|
|
|
|
|
|
|
|
tr.removeClass('shown');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
invokerUtil.get(uri,(payload) => {
|
|
|
|
|
|
|
|
row.child(renderLogDetails(row.data(),payload)).show();
|
|
|
|
|
|
|
|
$(row.child()).addClass('log-data-row');
|
|
|
|
|
|
|
|
tr.addClass('shown');
|
|
|
|
|
|
|
|
},(error) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},contentType);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renderLogDetails(obj,data) {
|
|
|
|
|
|
|
|
var payload = JSON.parse(data);
|
|
|
|
|
|
|
|
var logStream = '<div class="log-data">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.entries(payload.activityStatus).forEach(
|
|
|
|
|
|
|
|
([key, entry]) => {
|
|
|
|
|
|
|
|
logStream += '<div class="row log-entry">' +
|
|
|
|
|
|
|
|
'<div class="col-lg-8">' +
|
|
|
|
|
|
|
|
'<div class="log-status"><i class="icon fw ' + getLogStatusIcon(entry.status) + ' "></i>' +
|
|
|
|
|
|
|
|
'<span>' + entry.status + '</span></div>' +
|
|
|
|
|
|
|
|
'</div>' +
|
|
|
|
|
|
|
|
'<div class="col-lg-4">' +
|
|
|
|
|
|
|
|
'<div class="log-time text-right"><span>' + entry.updatedTimestamp + '</span></div>' +
|
|
|
|
|
|
|
|
'</div>' +
|
|
|
|
|
|
|
|
'</div>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
logStream += '</div></div>';
|
|
|
|
|
|
|
|
return logStream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getLogStatusIcon(entry) {
|
|
|
|
|
|
|
|
switch (entry) {
|
|
|
|
|
|
|
|
case 'COMPLETED':
|
|
|
|
|
|
|
|
return 'fw-success'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'PENDING':
|
|
|
|
|
|
|
|
return 'fw-pending'
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return 'fw-info'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadOperationsLog2(update) {
|
|
|
|
|
|
|
|
var operationsLogTable = "#operations-log-table";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (update) {
|
|
|
|
|
|
|
|
operationTable = $(operationsLogTable).DataTable();
|
|
|
|
|
|
|
|
$("#operations-spinner").removeClass("hidden");
|
|
|
|
|
|
|
|
operationTable.ajax.reload(function(json) {
|
|
|
|
|
|
|
|
$("#operations-spinner").addClass("hidden");
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
operationTable = $(operationsLogTable).datatables_extended({
|
|
|
|
|
|
|
|
serverSide: true,
|
|
|
|
|
|
|
|
processing: false,
|
|
|
|
|
|
|
|
searching: false,
|
|
|
|
|
|
|
|
ordering: false,
|
|
|
|
|
|
|
|
pageLength: 10,
|
|
|
|
|
|
|
|
order: [],
|
|
|
|
|
|
|
|
ajax: {
|
|
|
|
|
|
|
|
url: "/devicemgt/api/operation/paginate",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
deviceId: deviceIdentifier,
|
|
|
|
|
|
|
|
deviceType: deviceType,
|
|
|
|
|
|
|
|
owner: deviceOwner
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
dataSrc: function(json) {
|
|
|
|
|
|
|
|
$("#operations-spinner").addClass("hidden");
|
|
|
|
|
|
|
|
$("#operations-log-container").empty();
|
|
|
|
|
|
|
|
return json.data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
columnDefs: [{
|
|
|
|
|
|
|
|
targets: 0,
|
|
|
|
|
|
|
|
data: "code"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
targets: 1,
|
|
|
|
|
|
|
|
data: "status",
|
|
|
|
|
|
|
|
render: function(status) {
|
|
|
|
|
|
|
|
var html;
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
|
|
|
|
case "COMPLETED":
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-success'></i> Completed</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "PENDING":
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "ERROR":
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "IN_PROGRESS":
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-warning'></i> In Progress</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "REPEATED":
|
|
|
|
|
|
|
|
html = "<span><i class='fw fw-success icon-warning'></i> Repeated</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
targets: 2,
|
|
|
|
|
|
|
|
data: "createdTimeStamp",
|
|
|
|
|
|
|
|
render: function(date) {
|
|
|
|
|
|
|
|
var value = String(date);
|
|
|
|
|
|
|
|
return value.slice(0, 16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
|
|
|
|
"createdRow": function(row, data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(row).attr("data-type", "selectable");
|
|
|
|
|
|
|
|
$(row).attr("data-id", data["id"]);
|
|
|
|
|
|
|
|
$.each($("td", row),
|
|
|
|
|
|
|
|
function(colIndex) {
|
|
|
|
|
|
|
|
switch(colIndex) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Code");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["code"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Status");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["status"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Created Timestamp");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["createdTimeStamp"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
],
|
|
|
|
}
|
|
|
|
"createdRow": function(row, data) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(row).attr("data-type", "selectable");
|
|
|
|
|
|
|
|
$(row).attr("data-id", data["id"]);
|
|
|
|
|
|
|
|
$.each($("td", row),
|
|
|
|
|
|
|
|
function(colIndex) {
|
|
|
|
|
|
|
|
switch (colIndex) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Code");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["code"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Status");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["status"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
$(this).attr("data-grid-label", "Created Timestamp");
|
|
|
|
|
|
|
|
$(this).attr("data-display", data["createdTimeStamp"]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadPolicyCompliance() {
|
|
|
|
|
|
|
|
var policyCompliance = $("#policy-view");
|
|
|
|
|
|
|
|
var policyComplianceTemplate = policyCompliance.attr("src");
|
|
|
|
|
|
|
|
var deviceId = policyCompliance.data("device-id");
|
|
|
|
|
|
|
|
var deviceType = policyCompliance.data("device-type");
|
|
|
|
|
|
|
|
var activePolicy = null;
|
|
|
|
|
|
|
|
|
|
|
|
function loadPolicyCompliance() {
|
|
|
|
$.template(
|
|
|
|
var policyCompliance = $("#policy-view");
|
|
|
|
"policy-view",
|
|
|
|
var policyComplianceTemplate = policyCompliance.attr("src");
|
|
|
|
policyComplianceTemplate,
|
|
|
|
var deviceId = policyCompliance.data("device-id");
|
|
|
|
function(template) {
|
|
|
|
var deviceType = policyCompliance.data("device-type");
|
|
|
|
var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy";
|
|
|
|
var activePolicy = null;
|
|
|
|
var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data";
|
|
|
|
|
|
|
|
invokerUtil.get(
|
|
|
|
$.template(
|
|
|
|
getEffectivePolicyURL,
|
|
|
|
"policy-view",
|
|
|
|
// success-callback
|
|
|
|
policyComplianceTemplate,
|
|
|
|
function(data, textStatus, jqXHR) {
|
|
|
|
function (template) {
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy";
|
|
|
|
$("#policy-spinner").addClass("hidden");
|
|
|
|
var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data";
|
|
|
|
if (data) {
|
|
|
|
invokerUtil.get(
|
|
|
|
data = JSON.parse(data);
|
|
|
|
getEffectivePolicyURL,
|
|
|
|
if (data["active"] == true) {
|
|
|
|
// success-callback
|
|
|
|
activePolicy = data;
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
invokerUtil.get(
|
|
|
|
if (jqXHR.status == 200) {
|
|
|
|
getDeviceComplianceURL,
|
|
|
|
$("#policy-spinner").addClass("hidden");
|
|
|
|
// success-callback
|
|
|
|
if(data){
|
|
|
|
function(data, textStatus, jqXHR) {
|
|
|
|
data = JSON.parse(data);
|
|
|
|
if (jqXHR.status == 200 && data) {
|
|
|
|
if (data["active"] == true) {
|
|
|
|
var viewModel = {};
|
|
|
|
activePolicy = data;
|
|
|
|
viewModel["policy"] = activePolicy;
|
|
|
|
invokerUtil.get(
|
|
|
|
viewModel["deviceType"] = deviceType;
|
|
|
|
getDeviceComplianceURL,
|
|
|
|
viewModel["deviceId"] = deviceId;
|
|
|
|
// success-callback
|
|
|
|
viewModel["appContext"] = context;
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
data = JSON.parse(data);
|
|
|
|
if (jqXHR.status == 200 && data) {
|
|
|
|
var content;
|
|
|
|
var viewModel = {};
|
|
|
|
if (data["complianceData"]) {
|
|
|
|
viewModel["policy"] = activePolicy;
|
|
|
|
if (data["complianceData"]["complianceFeatures"] &&
|
|
|
|
viewModel["deviceType"] = deviceType;
|
|
|
|
data["complianceData"]["complianceFeatures"].length > 0) {
|
|
|
|
viewModel["deviceId"] = deviceId;
|
|
|
|
viewModel["compliance"] = "NON-COMPLIANT";
|
|
|
|
viewModel["appContext"] = context;
|
|
|
|
viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"];
|
|
|
|
data = JSON.parse(data);
|
|
|
|
content = template(viewModel);
|
|
|
|
var content;
|
|
|
|
$("#policy-list-container").html(content);
|
|
|
|
if (data["complianceData"]) {
|
|
|
|
|
|
|
|
if (data["complianceData"]["complianceFeatures"] &&
|
|
|
|
|
|
|
|
data["complianceData"]["complianceFeatures"].length > 0) {
|
|
|
|
|
|
|
|
viewModel["compliance"] = "NON-COMPLIANT";
|
|
|
|
|
|
|
|
viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"];
|
|
|
|
|
|
|
|
content = template(viewModel);
|
|
|
|
|
|
|
|
$("#policy-list-container").html(content);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
viewModel["compliance"] = "COMPLIANT";
|
|
|
|
|
|
|
|
content = template(viewModel);
|
|
|
|
|
|
|
|
$("#policy-list-container").html(content);
|
|
|
|
|
|
|
|
$("#policy-compliance-table").addClass("hidden");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$("#policy-list-container").
|
|
|
|
viewModel["compliance"] = "COMPLIANT";
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> This device " +
|
|
|
|
content = template(viewModel);
|
|
|
|
"has no policy applied.<p></div>");
|
|
|
|
$("#policy-list-container").html(content);
|
|
|
|
|
|
|
|
$("#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
|
|
|
|
|
|
|
|
function () {
|
|
|
|
|
|
|
|
$("#policy-list-container").
|
|
|
|
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
|
|
|
|
|
|
|
|
"was not successful. please try refreshing data in a while.<p></div>");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// error-callback
|
|
|
|
|
|
|
|
function() {
|
|
|
|
|
|
|
|
$("#policy-list-container").
|
|
|
|
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
|
|
|
|
|
|
|
|
"was not successful. please try refreshing data in a while.<p></div>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// error-callback
|
|
|
|
|
|
|
|
function () {
|
|
|
|
|
|
|
|
$("#policy-list-container").
|
|
|
|
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
|
|
|
|
|
|
|
|
"was not successful. please try refreshing data in a while.<p></div>");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// error-callback
|
|
|
|
);
|
|
|
|
function() {
|
|
|
|
}
|
|
|
|
$("#policy-list-container").
|
|
|
|
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
|
|
|
|
|
|
|
|
"was not successful. please try refreshing data in a while.<p></div>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|