ijokarumawak commented on a change in pull request #3401: NIFI-6160 NIFI-6170
Apply config error handling convention
URL: https://github.com/apache/nifi/pull/3401#discussion_r274266145
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/nf-error-handler.js
##########
@@ -142,6 +142,36 @@
// show the error pane
$('#message-pane').show();
}
+ },
+
+ /**
+ * Method for handling ajax errors when submitting configuration
update (PUT/POST) requests.
+ * In addition to what handleAjaxError does, this function splits
+ * the error message text to display them as an unordered list.
+ *
+ * @argument {object} xhr The XmlHttpRequest
+ * @argument {string} status The status of the request
+ * @argument {string} error The error
+ */
+ handleConfigurationUpdateAjaxError: function (xhr, status, error) {
+ if (xhr.status === 400) {
+ var errors = xhr.responseText.split('\n');
+
+ var content;
+ if (errors.length === 1) {
+ content = $('<span></span>').text(errors[0]);
+ } else {
+ content = nfCommon.formatUnorderedList(errors);
+ }
+
+ nfDialog.showOkDialog({
+ dialogContent: content,
+ headerText: 'Configuration Error'
+ });
+ } else {
+ self.handleAjaxError(xhr, status, error);
Review comment:
@mcgilman That's probably true. But I didn't see any logic that closes the
canvas in the Javascript sources that I researched while I'm working on this
PR, if I didn't oversight (that I do often though ... ><)
I named the function as `handleConfigurationUpdateAjaxError` to express that
the function is expected to be used to handle errors while configuration
updates.
Is there any situation that NiFi UI closes the canvas when configuration
update fails?
Or would you share some specific code which closes the canvas?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services