mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Fixing Notification validation issue
;
This commit is contained in:
parent
08992be99d
commit
e39c2a1d8d
@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
<div class="operation" data-operation-code="{{operation}}">
|
<div class="operation" data-operation-code="{{operation}}">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-5 col-md-6 col-centered">
|
<div class="col-lg-5 col-md-6 col-centered">
|
||||||
<h3>
|
<h3>
|
||||||
@ -65,6 +66,11 @@
|
|||||||
{{description}}
|
{{description}}
|
||||||
<br>
|
<br>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
<div id="operation-error-msg" class="alert alert-danger hidden" role="alert">
|
||||||
|
<i class="icon fw fw-error"></i><span></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="operation-form">
|
<div id="operation-form">
|
||||||
<form action="{{params.0.uri}}" method="{{params.0.method}}"
|
<form action="{{params.0.uri}}" method="{{params.0.method}}"
|
||||||
style="padding-bottom: 20px;"
|
style="padding-bottom: 20px;"
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -106,13 +106,13 @@
|
|||||||
"formParams": [
|
"formParams": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"id": "messageText",
|
"id": "messageTitle",
|
||||||
"optional": false,
|
"optional": false,
|
||||||
"label": "Title Here..."
|
"label": "Title Here..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"id": "messageTitle",
|
"id": "messageText",
|
||||||
"optional": false,
|
"optional": false,
|
||||||
"label": "Message Here..."
|
"label": "Message Here..."
|
||||||
}
|
}
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@ -1142,7 +1142,7 @@
|
|||||||
<javax.ws.rs.version>1.1.1</javax.ws.rs.version>
|
<javax.ws.rs.version>1.1.1</javax.ws.rs.version>
|
||||||
|
|
||||||
<!-- Carbon Device Management -->
|
<!-- Carbon Device Management -->
|
||||||
<carbon.devicemgt.version>3.0.6</carbon.devicemgt.version>
|
<carbon.devicemgt.version>3.0.8-SNAPSHOT</carbon.devicemgt.version>
|
||||||
<carbon.devicemgt.version.range>[3.0.0, 4.0.0)</carbon.devicemgt.version.range>
|
<carbon.devicemgt.version.range>[3.0.0, 4.0.0)</carbon.devicemgt.version.range>
|
||||||
|
|
||||||
<!-- Carbon App Management -->
|
<!-- Carbon App Management -->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user