|
|
|
@ -27,6 +27,11 @@ function operationSelect(selection) {
|
|
|
|
|
showPopup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var resetLoader = function () {
|
|
|
|
|
$("#btnSend").removeClass("hidden");
|
|
|
|
|
$('#lbl-execution').addClass("hidden");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function submitForm(formId) {
|
|
|
|
|
$("#btnSend").addClass("hidden");
|
|
|
|
|
$("#lbl-execution").removeClass("hidden");
|
|
|
|
@ -58,6 +63,9 @@ function submitForm(formId) {
|
|
|
|
|
uri += uriencodedQueryStr;
|
|
|
|
|
var httpMethod = form.attr("method").toUpperCase();
|
|
|
|
|
//var contentType = form.attr("enctype");
|
|
|
|
|
var validaterString = validatePayload(operationCode, payload);
|
|
|
|
|
|
|
|
|
|
if (validaterString == "OK") {
|
|
|
|
|
|
|
|
|
|
if (contentType == undefined || contentType == "") {
|
|
|
|
|
contentType = "application/x-www-form-urlencoded";
|
|
|
|
@ -72,11 +80,6 @@ function submitForm(formId) {
|
|
|
|
|
var description = content.find("#description");
|
|
|
|
|
description.html("");
|
|
|
|
|
|
|
|
|
|
var resetLoader = function () {
|
|
|
|
|
$("#btnSend").removeClass("hidden");
|
|
|
|
|
$('#lbl-execution').addClass("hidden");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var successCallBack = function (response) {
|
|
|
|
|
var res = response;
|
|
|
|
|
try {
|
|
|
|
@ -124,6 +127,11 @@ function submitForm(formId) {
|
|
|
|
|
resetLoader();
|
|
|
|
|
$(modalPopupContent).html(content.html());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
resetLoader();
|
|
|
|
|
$(".modal #operation-error-msg span").text(validaterString);
|
|
|
|
|
$(".modal #operation-error-msg").removeClass("hidden");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('submit', 'form', function (e) {
|
|
|
|
@ -161,6 +169,21 @@ var operationTypeConstants = {
|
|
|
|
|
"COMMAND": "command"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function validatePayload(operationCode, payload) {
|
|
|
|
|
console.log(payload);
|
|
|
|
|
var returnVal = "OK";
|
|
|
|
|
switch (operationCode) {
|
|
|
|
|
case "NOTIFICATION":
|
|
|
|
|
if (!payload.messageText) {
|
|
|
|
|
returnVal = "Message Body Can't be empty !";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return returnVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var generatePayload = function (operationCode, operationData, deviceList) {
|
|
|
|
|
var payload;
|
|
|
|
@ -228,8 +251,8 @@ var generatePayload = function (operationCode, operationData, deviceList) {
|
|
|
|
|
payload = {
|
|
|
|
|
"operation": {
|
|
|
|
|
//"message" : operationData["message"]
|
|
|
|
|
"messageText": operationData["messageText"],
|
|
|
|
|
"messageTitle": operationData["messageTitle"]
|
|
|
|
|
"messageTitle": operationData["messageTitle"],
|
|
|
|
|
"messageText": operationData["messageText"]
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|