|
|
@ -27,6 +27,11 @@ function operationSelect(selection) {
|
|
|
|
showPopup();
|
|
|
|
showPopup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var resetLoader = function () {
|
|
|
|
|
|
|
|
$("#btnSend").removeClass("hidden");
|
|
|
|
|
|
|
|
$('#lbl-execution').addClass("hidden");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function submitForm(formId) {
|
|
|
|
function submitForm(formId) {
|
|
|
|
$("#btnSend").addClass("hidden");
|
|
|
|
$("#btnSend").addClass("hidden");
|
|
|
|
$("#lbl-execution").removeClass("hidden");
|
|
|
|
$("#lbl-execution").removeClass("hidden");
|
|
|
@ -58,6 +63,9 @@ function submitForm(formId) {
|
|
|
|
uri += uriencodedQueryStr;
|
|
|
|
uri += uriencodedQueryStr;
|
|
|
|
var httpMethod = form.attr("method").toUpperCase();
|
|
|
|
var httpMethod = form.attr("method").toUpperCase();
|
|
|
|
//var contentType = form.attr("enctype");
|
|
|
|
//var contentType = form.attr("enctype");
|
|
|
|
|
|
|
|
var validaterString = validatePayload(operationCode, payload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (validaterString == "OK") {
|
|
|
|
|
|
|
|
|
|
|
|
if (contentType == undefined || contentType == "") {
|
|
|
|
if (contentType == undefined || contentType == "") {
|
|
|
|
contentType = "application/x-www-form-urlencoded";
|
|
|
|
contentType = "application/x-www-form-urlencoded";
|
|
|
@ -72,11 +80,6 @@ function submitForm(formId) {
|
|
|
|
var description = content.find("#description");
|
|
|
|
var description = content.find("#description");
|
|
|
|
description.html("");
|
|
|
|
description.html("");
|
|
|
|
|
|
|
|
|
|
|
|
var resetLoader = function () {
|
|
|
|
|
|
|
|
$("#btnSend").removeClass("hidden");
|
|
|
|
|
|
|
|
$('#lbl-execution').addClass("hidden");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var successCallBack = function (response) {
|
|
|
|
var successCallBack = function (response) {
|
|
|
|
var res = response;
|
|
|
|
var res = response;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -124,6 +127,11 @@ function submitForm(formId) {
|
|
|
|
resetLoader();
|
|
|
|
resetLoader();
|
|
|
|
$(modalPopupContent).html(content.html());
|
|
|
|
$(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) {
|
|
|
|
$(document).on('submit', 'form', function (e) {
|
|
|
@ -161,6 +169,21 @@ var operationTypeConstants = {
|
|
|
|
"COMMAND": "command"
|
|
|
|
"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 generatePayload = function (operationCode, operationData, deviceList) {
|
|
|
|
var payload;
|
|
|
|
var payload;
|
|
|
@ -228,8 +251,8 @@ var generatePayload = function (operationCode, operationData, deviceList) {
|
|
|
|
payload = {
|
|
|
|
payload = {
|
|
|
|
"operation": {
|
|
|
|
"operation": {
|
|
|
|
//"message" : operationData["message"]
|
|
|
|
//"message" : operationData["message"]
|
|
|
|
"messageText": operationData["messageText"],
|
|
|
|
"messageTitle": operationData["messageTitle"],
|
|
|
|
"messageTitle": operationData["messageTitle"]
|
|
|
|
"messageText": operationData["messageText"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|