|
|
@ -23,9 +23,10 @@
|
|
|
|
var payload = [deviceIdentifier];
|
|
|
|
var payload = [deviceIdentifier];
|
|
|
|
var operationTable;
|
|
|
|
var operationTable;
|
|
|
|
if (deviceType == "ios") {
|
|
|
|
if (deviceType == "ios") {
|
|
|
|
var serviceUrl = "/ios/operation/deviceinfo";
|
|
|
|
serviceUrl = "/ios/operation/deviceinfo";
|
|
|
|
} else if (deviceType == "android") {
|
|
|
|
} else if (deviceType == "android") {
|
|
|
|
var serviceUrl = "/mdm-android-agent/operation/device-info";
|
|
|
|
//var serviceUrl = "/mdm-android-agent/operation/device-info";
|
|
|
|
|
|
|
|
serviceUrl = "/api/device-mgt/android/v1.0/admin/devices/info";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (serviceUrl) {
|
|
|
|
if (serviceUrl) {
|
|
|
|
invokerUtil.post(serviceUrl, payload,
|
|
|
|
invokerUtil.post(serviceUrl, payload,
|
|
|
@ -61,137 +62,224 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function loadOperationsLog(update) {
|
|
|
|
function loadOperationsLog(update) {
|
|
|
|
var operationsLog = $("#operations-log");
|
|
|
|
var operationsLogTable = "#operations-log-table";
|
|
|
|
var deviceListingSrc = operationsLog.attr("src");
|
|
|
|
if (update) {
|
|
|
|
var deviceId = operationsLog.data("device-id");
|
|
|
|
operationTable = $(operationsLogTable).DataTable();
|
|
|
|
var deviceType = operationsLog.data("device-type");
|
|
|
|
operationTable.ajax.reload(false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
$.template("operations-log", deviceListingSrc, function (template) {
|
|
|
|
|
|
|
|
var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
$('#operations-spinner').addClass('hidden');
|
|
|
|
|
|
|
|
var viewModel = {};
|
|
|
|
|
|
|
|
viewModel.operations = data;
|
|
|
|
|
|
|
|
if (data.length > 0) {
|
|
|
|
|
|
|
|
var content = template(viewModel);
|
|
|
|
|
|
|
|
if (!update) {
|
|
|
|
|
|
|
|
$("#operations-log-container").html(content);
|
|
|
|
|
|
|
|
operationTable = $('#operations-log-table').datatables_extended();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$('#operations-log-table').dataTable().fnClearTable();
|
|
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
var status;
|
|
|
|
|
|
|
|
if (data[i].status == "COMPLETED") {
|
|
|
|
|
|
|
|
status = "<span><i class='fw fw-ok icon-success'></i> Completed</span>";
|
|
|
|
|
|
|
|
} else if (data[i].status == "PENDING") {
|
|
|
|
|
|
|
|
status = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
|
|
|
|
|
|
|
|
} else if (data[i].status == "ERROR") {
|
|
|
|
|
|
|
|
status = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
|
|
|
|
|
|
|
|
} else if (data[i].status == "IN_PROGRESS") {
|
|
|
|
|
|
|
|
status = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
operationTable = $(operationsLogTable)
|
|
|
|
$('#operations-log-table').dataTable().fnAddData([
|
|
|
|
.datatables_extended({
|
|
|
|
data[i].code,
|
|
|
|
serverSide: true,
|
|
|
|
status,
|
|
|
|
processing: false,
|
|
|
|
data[i].createdTimeStamp
|
|
|
|
searching: false,
|
|
|
|
]);
|
|
|
|
ordering: false,
|
|
|
|
|
|
|
|
pageLength: 10,
|
|
|
|
|
|
|
|
order: [],
|
|
|
|
|
|
|
|
ajax: {
|
|
|
|
|
|
|
|
url: context + "/api/operation/paginate",
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
deviceId: deviceIdentifier,
|
|
|
|
|
|
|
|
deviceType: deviceType
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
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-ok 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-ok icon-warning'></i> In Progress</span>";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "REPEATED" :
|
|
|
|
|
|
|
|
html =
|
|
|
|
|
|
|
|
"<span><i class='fw fw-ok 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
invokerUtil.get(serviceURL,
|
|
|
|
|
|
|
|
successCallback, function (message) {
|
|
|
|
|
|
|
|
console.log(message);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadApplicationsList() {
|
|
|
|
function loadApplicationsList() {
|
|
|
|
var applicationsList = $("#applications-list");
|
|
|
|
var applicationsList = $("#applications-list");
|
|
|
|
var deviceListingSrc = applicationsList.attr("src");
|
|
|
|
var applicationListingTemplate = applicationsList.attr("src");
|
|
|
|
var deviceId = applicationsList.data("device-id");
|
|
|
|
var deviceId = applicationsList.data("device-id");
|
|
|
|
var deviceType = applicationsList.data("device-type");
|
|
|
|
var deviceType = applicationsList.data("device-type");
|
|
|
|
|
|
|
|
|
|
|
|
$.template("application-list", deviceListingSrc, function (template) {
|
|
|
|
$.template("application-list", applicationListingTemplate, function (template) {
|
|
|
|
var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId + "/apps";
|
|
|
|
var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/applications";
|
|
|
|
|
|
|
|
invokerUtil.get(
|
|
|
|
var successCallback = function (data) {
|
|
|
|
serviceURL,
|
|
|
|
|
|
|
|
// success-callback
|
|
|
|
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200 && data) {
|
|
|
|
data = JSON.parse(data);
|
|
|
|
data = JSON.parse(data);
|
|
|
|
$('#apps-spinner').addClass('hidden');
|
|
|
|
$("#apps-spinner").addClass("hidden");
|
|
|
|
var viewModel = {};
|
|
|
|
if (data.length > 0) {
|
|
|
|
if (data != null && data.length > 0) {
|
|
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
data[i].name = data[i].name.replace(/[^\w\s]/gi, ' ');
|
|
|
|
data[i]["name"] = decodeURIComponent(data[i]["name"]);
|
|
|
|
data[i].name = data[i].name.replace(/[0-9]/g, ' ');
|
|
|
|
data[i]["platform"] = deviceType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
viewModel.applications = data;
|
|
|
|
var viewModel = {};
|
|
|
|
viewModel.deviceType = deviceType;
|
|
|
|
viewModel["applications"] = data;
|
|
|
|
if (data.length > 0) {
|
|
|
|
viewModel["deviceType"] = deviceType;
|
|
|
|
var content = template(viewModel);
|
|
|
|
var content = template(viewModel);
|
|
|
|
$("#applications-list-container").html(content);
|
|
|
|
$("#applications-list-container").html(content);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$("#applications-list-container").
|
|
|
|
|
|
|
|
html("<div class='message message-info'><h4><i class='icon fw fw-info'></i>No applications found.</h4>" +
|
|
|
|
|
|
|
|
"<p>Please try refreshing the list in a while.</p></div>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
invokerUtil.get(serviceURL,
|
|
|
|
// error-callback
|
|
|
|
successCallback, function (message) {
|
|
|
|
function () {
|
|
|
|
console.log(message);
|
|
|
|
$("#applications-list-container").
|
|
|
|
|
|
|
|
html("<div class='panel-body'><br><p class='fw-warning'> Loading application list " +
|
|
|
|
|
|
|
|
"was not successful. please try refreshing the list in a while.<p></div>");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadPolicyCompliance() {
|
|
|
|
function loadPolicyCompliance() {
|
|
|
|
var policyCompliance = $("#policy-view");
|
|
|
|
var policyCompliance = $("#policy-view");
|
|
|
|
var policySrc = policyCompliance.attr("src");
|
|
|
|
var policyComplianceTemplate = policyCompliance.attr("src");
|
|
|
|
var deviceId = policyCompliance.data("device-id");
|
|
|
|
var deviceId = policyCompliance.data("device-id");
|
|
|
|
var deviceType = policyCompliance.data("device-type");
|
|
|
|
var deviceType = policyCompliance.data("device-type");
|
|
|
|
var activePolicy = null;
|
|
|
|
var activePolicy = null;
|
|
|
|
|
|
|
|
|
|
|
|
$.template("policy-view", policySrc, function (template) {
|
|
|
|
$.template(
|
|
|
|
var serviceURLPolicy = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId + "/active-policy"
|
|
|
|
"policy-view",
|
|
|
|
var serviceURLCompliance = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId;
|
|
|
|
policyComplianceTemplate,
|
|
|
|
|
|
|
|
function (template) {
|
|
|
|
|
|
|
|
var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy";
|
|
|
|
|
|
|
|
var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data";
|
|
|
|
|
|
|
|
|
|
|
|
var successCallbackCompliance = function (data) {
|
|
|
|
invokerUtil.get(
|
|
|
|
|
|
|
|
getEffectivePolicyURL,
|
|
|
|
|
|
|
|
// success-callback
|
|
|
|
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200 && data) {
|
|
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
$("#policy-spinner").addClass("hidden");
|
|
|
|
|
|
|
|
if (data["active"] == true) {
|
|
|
|
|
|
|
|
activePolicy = data;
|
|
|
|
|
|
|
|
invokerUtil.get(
|
|
|
|
|
|
|
|
getDeviceComplianceURL,
|
|
|
|
|
|
|
|
// success-callback
|
|
|
|
|
|
|
|
function (data, textStatus, jqXHR) {
|
|
|
|
|
|
|
|
if (jqXHR.status == 200 && data) {
|
|
|
|
var viewModel = {};
|
|
|
|
var viewModel = {};
|
|
|
|
viewModel.policy = activePolicy;
|
|
|
|
viewModel["policy"] = activePolicy;
|
|
|
|
viewModel.deviceType = deviceType;
|
|
|
|
viewModel["deviceType"] = deviceType;
|
|
|
|
if (data != null && data.complianceFeatures != null && data.complianceFeatures != undefined && data.complianceFeatures.length > 0) {
|
|
|
|
data = JSON.parse(data);
|
|
|
|
viewModel.compliance = "NON-COMPLIANT";
|
|
|
|
var content;
|
|
|
|
viewModel.complianceFeatures = data.complianceFeatures;
|
|
|
|
if (data["complianceData"]) {
|
|
|
|
var content = template(viewModel);
|
|
|
|
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);
|
|
|
|
$("#policy-list-container").html(content);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel.compliance = "COMPLIANT";
|
|
|
|
viewModel["compliance"] = "COMPLIANT";
|
|
|
|
var content = template(viewModel);
|
|
|
|
content = template(viewModel);
|
|
|
|
$("#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 " +
|
|
|
|
var successCallbackPolicy = function (data) {
|
|
|
|
"has no policy applied.<p></div>");
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
$('#policy-spinner').addClass('hidden');
|
|
|
|
|
|
|
|
if (data != null && data.active == true) {
|
|
|
|
|
|
|
|
activePolicy = data;
|
|
|
|
|
|
|
|
invokerUtil.get(serviceURLCompliance,
|
|
|
|
|
|
|
|
successCallbackCompliance, function (message) {
|
|
|
|
|
|
|
|
console.log(message);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.get(serviceURLPolicy,
|
|
|
|
|
|
|
|
successCallbackPolicy, function (message) {
|
|
|
|
|
|
|
|
console.log(message);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 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>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}());
|
|
|
|
}());
|
|
|
|