|
|
@ -51,9 +51,9 @@ function getSelectedDeviceIds() {
|
|
|
|
var deviceId = device.data('deviceid');
|
|
|
|
var deviceId = device.data('deviceid');
|
|
|
|
var deviceType = device.data('type');
|
|
|
|
var deviceType = device.data('type');
|
|
|
|
deviceIdentifierList.push({
|
|
|
|
deviceIdentifierList.push({
|
|
|
|
"id": deviceId,
|
|
|
|
"id": deviceId,
|
|
|
|
"type": deviceType
|
|
|
|
"type": deviceType
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (deviceIdentifierList.length == 0) {
|
|
|
|
if (deviceIdentifierList.length == 0) {
|
|
|
|
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
|
|
|
|
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
|
|
|
@ -62,9 +62,9 @@ function getSelectedDeviceIds() {
|
|
|
|
var deviceId = $(thisTable.api().row(this).node()).data('deviceid');
|
|
|
|
var deviceId = $(thisTable.api().row(this).node()).data('deviceid');
|
|
|
|
var deviceType = $(thisTable.api().row(this).node()).data('devicetype');
|
|
|
|
var deviceType = $(thisTable.api().row(this).node()).data('devicetype');
|
|
|
|
deviceIdentifierList.push({
|
|
|
|
deviceIdentifierList.push({
|
|
|
|
"id": deviceId,
|
|
|
|
"id": deviceId,
|
|
|
|
"type": deviceType
|
|
|
|
"type": deviceType
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -102,11 +102,6 @@ function getDevicesByTypes(deviceList) {
|
|
|
|
return deviceTypes;
|
|
|
|
return deviceTypes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//function unloadOperationBar() {
|
|
|
|
|
|
|
|
// $("#showOperationsBtn").addClass("hidden");
|
|
|
|
|
|
|
|
// $(".wr-operations").html("");
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadOperationBar(deviceType, ownership, mode) {
|
|
|
|
function loadOperationBar(deviceType, ownership, mode) {
|
|
|
|
var operationBar = $("#operations-bar");
|
|
|
|
var operationBar = $("#operations-bar");
|
|
|
|
var operationBarSrc = operationBar.attr("src");
|
|
|
|
var operationBarSrc = operationBar.attr("src");
|
|
|
@ -166,7 +161,7 @@ function loadOperationBar(deviceType, ownership, mode) {
|
|
|
|
/* adding ownership in addition to device-type
|
|
|
|
/* adding ownership in addition to device-type
|
|
|
|
as it's vital in cases where UI for the same feature should change
|
|
|
|
as it's vital in cases where UI for the same feature should change
|
|
|
|
according to ownership
|
|
|
|
according to ownership
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (ownership) {
|
|
|
|
if (ownership) {
|
|
|
|
current.ownership = ownership;
|
|
|
|
current.ownership = ownership;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -190,22 +185,21 @@ function loadOperationBar(deviceType, ownership, mode) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function runOperation(operationName) {
|
|
|
|
function runOperation(operationName) {
|
|
|
|
|
|
|
|
if (operationName == "NOTIFICATION") {
|
|
|
|
|
|
|
|
var messageTitle = $("#messageTitle").val();
|
|
|
|
|
|
|
|
var messageText = $("#messageText").val();
|
|
|
|
|
|
|
|
if (!messageTitle || !messageText) {
|
|
|
|
|
|
|
|
var errorMsg = "#notification-error-msg span";
|
|
|
|
|
|
|
|
var errorMsgWrapper = "#notification-error-msg";
|
|
|
|
|
|
|
|
$(errorMsg).text("Either the message title / message text or both are empty.");
|
|
|
|
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var deviceIdList = getSelectedDeviceIds();
|
|
|
|
var deviceIdList = getSelectedDeviceIds();
|
|
|
|
var list = getDevicesByTypes(deviceIdList);
|
|
|
|
var list = getDevicesByTypes(deviceIdList);
|
|
|
|
|
|
|
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
|
|
|
if (operationName == "NOTIFICATION") {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($("#messageSuccess").html());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($("#operationSuccess").html());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var errorCallback = function (data) {
|
|
|
|
|
|
|
|
$(modalPopupContent).html($("#errorOperationUnexpected").html());
|
|
|
|
|
|
|
|
showPopup();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var payload, serviceEndPoint;
|
|
|
|
var payload, serviceEndPoint;
|
|
|
|
if (list[platformTypeConstants.IOS]) {
|
|
|
|
if (list[platformTypeConstants.IOS]) {
|
|
|
|
payload =
|
|
|
|
payload =
|
|
|
@ -217,27 +211,22 @@ function runOperation(operationName) {
|
|
|
|
serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName);
|
|
|
|
serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName);
|
|
|
|
} else if (list[platformTypeConstants.WINDOWS]) {
|
|
|
|
} else if (list[platformTypeConstants.WINDOWS]) {
|
|
|
|
payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName,
|
|
|
|
payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName,
|
|
|
|
list[platformTypeConstants.WINDOWS]);
|
|
|
|
list[platformTypeConstants.WINDOWS]);
|
|
|
|
serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName);
|
|
|
|
serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (operationName == "NOTIFICATION") {
|
|
|
|
|
|
|
|
var errorMsgWrapper = "#notification-error-msg";
|
|
|
|
var successCallback = function () {
|
|
|
|
var errorMsg = "#notification-error-msg span";
|
|
|
|
if (operationName == "NOTIFICATION") {
|
|
|
|
var messageTitle = $("#messageTitle").val();
|
|
|
|
$(modalPopupContent).html($("#messageSuccess").html());
|
|
|
|
var messageText = $("#messageText").val();
|
|
|
|
|
|
|
|
if (!(messageTitle && messageText)) {
|
|
|
|
|
|
|
|
$(errorMsg).text("Enter a message. It cannot be empty.");
|
|
|
|
|
|
|
|
$(errorMsgWrapper).removeClass("hidden");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
|
|
|
|
$(modalPopupContent).html($("#operationSuccess").html());
|
|
|
|
$(modalPopupContent).removeData();
|
|
|
|
|
|
|
|
hidePopup();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
};
|
|
|
|
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
|
|
|
|
var errorCallback = function () {
|
|
|
|
$(modalPopupContent).removeData();
|
|
|
|
$(modalPopupContent).html($("#errorOperationUnexpected").html());
|
|
|
|
hidePopup();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|