Fixing operation button stuck issue

revert-dabc3590
dilanua 8 years ago
parent 861c5f861e
commit 1cce94cef9

@ -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");
@ -190,21 +185,20 @@ function loadOperationBar(deviceType, ownership, mode) {
} }
function runOperation(operationName) { function runOperation(operationName) {
var deviceIdList = getSelectedDeviceIds();
var list = getDevicesByTypes(deviceIdList);
var successCallback = function (data) {
if (operationName == "NOTIFICATION") { if (operationName == "NOTIFICATION") {
$(modalPopupContent).html($("#messageSuccess").html()); var messageTitle = $("#messageTitle").val();
} else { var messageText = $("#messageText").val();
$(modalPopupContent).html($("#operationSuccess").html()); 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;
}
} }
showPopup();
}; var deviceIdList = getSelectedDeviceIds();
var errorCallback = function (data) { var list = getDevicesByTypes(deviceIdList);
$(modalPopupContent).html($("#errorOperationUnexpected").html());
showPopup();
};
var payload, serviceEndPoint; var payload, serviceEndPoint;
if (list[platformTypeConstants.IOS]) { if (list[platformTypeConstants.IOS]) {
@ -220,24 +214,19 @@ function runOperation(operationName) {
list[platformTypeConstants.WINDOWS]); list[platformTypeConstants.WINDOWS]);
serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName); serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName);
} }
var successCallback = function () {
if (operationName == "NOTIFICATION") { if (operationName == "NOTIFICATION") {
var errorMsgWrapper = "#notification-error-msg"; $(modalPopupContent).html($("#messageSuccess").html());
var errorMsg = "#notification-error-msg span";
var messageTitle = $("#messageTitle").val();
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 { };
var errorCallback = function () {
$(modalPopupContent).html($("#errorOperationUnexpected").html());
};
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback); invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
$(modalPopupContent).removeData();
hidePopup();
}
} }
/* /*

Loading…
Cancel
Save