diff --git a/WebContent/WEB-INF/jsp/eventHandlers.jsp b/WebContent/WEB-INF/jsp/eventHandlers.jsp index 5ec85f2a31..3ba3805d14 100644 --- a/WebContent/WEB-INF/jsp/eventHandlers.jsp +++ b/WebContent/WEB-INF/jsp/eventHandlers.jsp @@ -456,7 +456,13 @@ var xid = $get("xid"); var alias = $get("alias"); var disabled = $get("disabled"); - if (handlerType == ) { + if (isEmpty(xid) && handlerId !== ${NEW_ID}){ + let message = createValidationMessage("xid", ""); + $set("xid", selectedHandlerNode.object.xid); + stopImageFader("saveImg"); + showDwrMessages([message]); + } else { + if (handlerType == ) { var emailList = emailRecipients.createRecipientArray(); var escalList = escalRecipients.createRecipientArray(); var inactiveList = inactiveRecipients.createRecipientArray(); @@ -464,28 +470,25 @@ selectedEventTypeNode.object.typeRef1, selectedEventTypeNode.object.typeRef2, handlerId, xid, alias, disabled, emailList, $get("sendEscalation"), $get("escalationDelayType"), $get("escalationDelay"), escalList, $get("sendInactive"), $get("inactiveOverride"), inactiveList, saveEventHandlerCB); - } - else if (handlerType == ) { + } else if (handlerType == ) { var smsList = smsRecipients.createRecipientArray(); EventHandlersDwr.saveSmsEventHandler(selectedEventTypeNode.object.typeId, selectedEventTypeNode.object.typeRef1, selectedEventTypeNode.object.typeRef2, handlerId, xid, alias, disabled, smsList, saveEventHandlerCB); - } - else if (handlerType == ) { + } else if (handlerType == ) { EventHandlersDwr.saveSetPointEventHandler(selectedEventTypeNode.object.typeId, selectedEventTypeNode.object.typeRef1, selectedEventTypeNode.object.typeRef2, handlerId, xid, alias, disabled, $get("targetPointSelect"), $get("activeAction"), $get("setPointValueActive"), $get("activePointId"), $get("inactiveAction"), $get("setPointValueInactive"), $get("inactivePointId"), saveEventHandlerCB); - } - else if (handlerType == ) { + } else if (handlerType == ) { EventHandlersDwr.saveProcessEventHandler(selectedEventTypeNode.object.typeId, selectedEventTypeNode.object.typeRef1, selectedEventTypeNode.object.typeRef2, handlerId, xid, alias, disabled, $get("activeProcessCommand"), $get("inactiveProcessCommand"), saveEventHandlerCB); - } - else if (handlerType == ) { + } else if (handlerType == ) { EventHandlersDwr.saveScriptEventHandler(selectedEventTypeNode.object.typeId, selectedEventTypeNode.object.typeRef1, selectedEventTypeNode.object.typeRef2, handlerId, xid, alias, disabled, $get("activeScriptCommand"), $get("inactiveScriptCommand"), saveEventHandlerCB); + } } } @@ -496,7 +499,6 @@ showDwrMessages(response.messages, $("genericMessages")); else { var handler = response.data.handler; - setUserMessage(""); if (!selectedHandlerNode) { selectedHandlerNode = createHandlerNode(handler); selectedEventTypeNode.addChild(selectedHandlerNode); @@ -506,6 +508,7 @@ else $set(handler.id +"Msg", handler.message); + setUserMessage(""); selectedHandlerNode.object = handler; } } diff --git a/WebContent/resources/common.js b/WebContent/resources/common.js index fc081d2df5..dd839b02e6 100644 --- a/WebContent/resources/common.js +++ b/WebContent/resources/common.js @@ -1260,3 +1260,7 @@ function OnListWebsocketStats() { console.log("message[/app/websocketStats]:\n" + message.body); } ); } + +function isEmpty(value) { + return !value || (typeof value === "string" && value.trim() === ""); +} \ No newline at end of file diff --git a/src/com/serotonin/mango/web/dwr/EventHandlersDwr.java b/src/com/serotonin/mango/web/dwr/EventHandlersDwr.java index 6607677274..cd1fc8f625 100644 --- a/src/com/serotonin/mango/web/dwr/EventHandlersDwr.java +++ b/src/com/serotonin/mango/web/dwr/EventHandlersDwr.java @@ -325,7 +325,7 @@ private DwrResponseI18n save(int eventSourceId, int eventTypeRef1, EventService eventService = new EventService(); vo.setId(handlerId); - vo.setXid(StringUtils.isEmpty(xid) ? eventService.generateUniqueXid() : xid); + vo.setXid(StringUtils.isEmpty(xid) && handlerId == Common.NEW_ID ? eventService.generateUniqueXid() : xid); vo.setAlias(alias); vo.setDisabled(disabled); diff --git a/webapp-resources/messages_de.properties b/webapp-resources/messages_de.properties index 69655cf330..e813b7bf69 100644 --- a/webapp-resources/messages_de.properties +++ b/webapp-resources/messages_de.properties @@ -3341,4 +3341,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored \ No newline at end of file diff --git a/webapp-resources/messages_en.properties b/webapp-resources/messages_en.properties index e26b8d6edd..df9f025d0f 100644 --- a/webapp-resources/messages_en.properties +++ b/webapp-resources/messages_en.properties @@ -3344,4 +3344,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored \ No newline at end of file diff --git a/webapp-resources/messages_es.properties b/webapp-resources/messages_es.properties index 12d31628bd..fffdd22248 100644 --- a/webapp-resources/messages_es.properties +++ b/webapp-resources/messages_es.properties @@ -3384,4 +3384,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_fi.properties b/webapp-resources/messages_fi.properties index c484b2341a..6c53d2094f 100644 --- a/webapp-resources/messages_fi.properties +++ b/webapp-resources/messages_fi.properties @@ -3470,4 +3470,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_fr.properties b/webapp-resources/messages_fr.properties index f47047eb31..fa91d2892e 100644 --- a/webapp-resources/messages_fr.properties +++ b/webapp-resources/messages_fr.properties @@ -3338,4 +3338,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_lu.properties b/webapp-resources/messages_lu.properties index e4db6550cd..cf05199ed1 100644 --- a/webapp-resources/messages_lu.properties +++ b/webapp-resources/messages_lu.properties @@ -3357,4 +3357,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_nl.properties b/webapp-resources/messages_nl.properties index b3d75e2951..48429f081d 100644 --- a/webapp-resources/messages_nl.properties +++ b/webapp-resources/messages_nl.properties @@ -3460,4 +3460,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_pl.properties b/webapp-resources/messages_pl.properties index a699b8f785..bb985f8e95 100644 --- a/webapp-resources/messages_pl.properties +++ b/webapp-resources/messages_pl.properties @@ -3483,3 +3483,4 @@ event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_pt.properties b/webapp-resources/messages_pt.properties index 31c3f5cb20..2af8dc5541 100644 --- a/webapp-resources/messages_pt.properties +++ b/webapp-resources/messages_pt.properties @@ -3496,4 +3496,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_ru.properties b/webapp-resources/messages_ru.properties index d1676af0d6..0cf0f2e056 100644 --- a/webapp-resources/messages_ru.properties +++ b/webapp-resources/messages_ru.properties @@ -3492,4 +3492,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored diff --git a/webapp-resources/messages_zh.properties b/webapp-resources/messages_zh.properties index 0ca322fc93..43b3f4c1e1 100644 --- a/webapp-resources/messages_zh.properties +++ b/webapp-resources/messages_zh.properties @@ -3445,4 +3445,5 @@ dsEdit.sql.statementLimit.warning=Setting the value 0 in the Statement limit fie event.sms.failure=Failed to send sms titled "{0}" to "{1}". Message: "{2}" event.script.failure=Failed execute script: "{0}", Message: "{1}" event.system.sms=Sms send failure -event.system.script=Script event handler failure \ No newline at end of file +event.system.script=Script event handler failure +validate.valueRestored=Previous value restored