-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2824 Fixed event handlers new xid not displaying after saving edit form #2959
#2824 Fixed event handlers new xid not displaying after saving edit form #2959
Conversation
Java Script Mocha Unit Test Results268 tests 268 ✅ 4s ⏱️ Results for commit dbd759d. ♻️ This comment has been updated with latest results. |
Java JUnit Test Results2 089 tests 2 089 ✅ 27s ⏱️ Results for commit dbd759d. ♻️ This comment has been updated with latest results. |
@@ -508,6 +508,7 @@ | |||
|
|||
selectedHandlerNode.object = handler; | |||
} | |||
$set("xid", handler.xid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the definition of the handler variable?
What is defined in the else block is not available outside this block.
If the xid has not been completed when editing the handler, it should not save the newly generated xid and return the old xid. Otherwise, this is counterintuitive behavior and the user may unknowingly change the xid of the handler.
- Added isNotEmpty() to common.js - Moved validateValue() to common.js - Added restoring previous XID value for Event Handlers when XID field is left empty when saving Event Handler
This reverts commit fa04fe7.
- Added isNotEmpty() to common.js - Moved validateValue() to common.js - Added restoring previous XID value for Event Handlers when XID field is left empty when saving Event Handler
var messages = []; | ||
if (!(isNotEmpty(xid)) && handlerId !== ${NEW_ID}){ | ||
validateValue("xid", "<fmt:message key='validate.valueRestored'/>", isNotEmpty, xid, messages) | ||
$set("xid", selectedHandlerNode.object.xid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added lines:
stopImageFader("saveImg");
showDwrMessages(message);
return;
validateValue("xid", "<fmt:message key='validate.valueRestored'/>", isNotEmpty, xid, messages) | ||
$set("xid", selectedHandlerNode.object.xid); | ||
} | ||
if(messages.length > 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if to delete
@@ -2989,6 +2989,7 @@ validate.required=Required value | |||
validate.text.incompatible=Text renderer is incompatible with data type | |||
validate.event.incompatible=Event text renderer is incompatible with data type | |||
validate.xidUsed=This XID is already in use | |||
validate.valueRestored=Previous value restored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
Need to update for each translation files.
@@ -456,36 +456,43 @@ | |||
var xid = $get("xid"); | |||
var alias = $get("alias"); | |||
var disabled = $get("disabled"); | |||
if (handlerType == <c:out value="<%= EventHandlerVO.TYPE_EMAIL %>"/>) { | |||
var messages = []; | |||
if (!(isNotEmpty(xid)) && handlerId !== ${NEW_ID}){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!(isNotEmpty(xid))
- Instead of so many negations, it is worth creating the isEmpty method.
if (handlerType == <c:out value="<%= EventHandlerVO.TYPE_EMAIL %>"/>) { | ||
var messages = []; | ||
if (!(isNotEmpty(xid)) && handlerId !== ${NEW_ID}){ | ||
validateValue("xid", "<fmt:message key='validate.valueRestored'/>", isNotEmpty, xid, messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove use validateValue:
let message = createValidationMessage("xid", "<fmt:message key='validate.valueRestored'/>");
@@ -456,36 +456,43 @@ | |||
var xid = $get("xid"); | |||
var alias = $get("alias"); | |||
var disabled = $get("disabled"); | |||
if (handlerType == <c:out value="<%= EventHandlerVO.TYPE_EMAIL %>"/>) { | |||
var messages = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
messages to delete
@@ -325,7 +325,12 @@ private DwrResponseI18n save(int eventSourceId, int eventTypeRef1, | |||
EventService eventService = new EventService(); | |||
|
|||
vo.setId(handlerId); | |||
vo.setXid(StringUtils.isEmpty(xid) ? eventService.generateUniqueXid() : xid); | |||
if (StringUtils.isEmpty(xid) && handlerId == Common.NEW_ID) { | |||
vo.setXid(StringUtils.isEmpty(xid) ? eventService.generateUniqueXid() : xid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vo.setXid(eventService.generateUniqueXid());
@@ -2948,6 +2948,7 @@ validate.required=Se requiere un valor | |||
validate.text.incompatible=El generador de Texto es incompatibles con el tipo de dato | |||
validate.event.incompatible=Event text renderer is incompatible with data type | |||
validate.xidUsed=Este XID ya est\u00e1 en uso | |||
validate.valueRestored=Previous value restored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add this at the end of the file, not in the middle.
let message = createValidationMessage("xid", "<fmt:message key='validate.valueRestored'/>"); | ||
$set("xid", selectedHandlerNode.object.xid); | ||
stopImageFader("saveImg"); | ||
showDwrMessages([message]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add line:
return;
stopImageFader("saveImg"); | ||
showDwrMessages([message]); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What comes after ifa needs to be restored.
You only add a new if at the end of return, we do not make any other changes.
- Code formatting adjustments
- Adjusted code formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we create a new handler and leave the xid field empty, a new handler is created with the generated xid, if we try to save an existing event handler with an empty xid field, we get the currently saved xid with information 'Previous value restored' -> ok.
No description provided.