You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2016/10/12 13:19:32 UTC

nifi git commit: NIFI-2837: - Immediately hiding the template dialog after clicking the Upload button to prevent an accidental re-submission.

Repository: nifi
Updated Branches:
  refs/heads/master af2717932 -> a25b651da


NIFI-2837: - Immediately hiding the template dialog after clicking the Upload button to prevent an accidental re-submission.

This closes #1086.

Signed-off-by: Bryan Bende <bb...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/a25b651d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/a25b651d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/a25b651d

Branch: refs/heads/master
Commit: a25b651da9da57a20431b9eedcd8a8860aaa4242
Parents: af27179
Author: Matt Gilman <ma...@gmail.com>
Authored: Thu Sep 29 14:57:07 2016 -0400
Committer: Bryan Bende <bb...@apache.org>
Committed: Wed Oct 12 09:18:58 2016 -0400

----------------------------------------------------------------------
 .../nf-ng-canvas-operate-controller.js          | 28 +++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/a25b651d/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-operate-controller.js
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-operate-controller.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-operate-controller.js
index 5832332..c74ca48 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-operate-controller.js
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/controllers/nf-ng-canvas-operate-controller.js
@@ -121,34 +121,39 @@ nf.ng.Canvas.OperateCtrl = function () {
                             options.url += (encodeURIComponent(nf.Canvas.getGroupId()) + '/templates/upload');
                         },
                         success: function (response, statusText, xhr, form) {
-                            // see if the import was successful
+                            // see if the import was successful and inform the user
                             if (response.documentElement.tagName === 'templateEntity') {
-                                // close the dialog
-                                $('#upload-template-dialog').modal('hide');
-
-                                // close the settings dialog
                                 nf.Dialog.showOkDialog({
                                     headerText: 'Success',
                                     dialogContent: 'Template successfully imported.'
                                 });
                             } else {
                                 // import failed
-                                var status = 'Unable to import template. Please check the log for errors.';
+                                var statusText = 'Unable to import template. Please check the log for errors.';
                                 if (response.documentElement.tagName === 'errorResponse') {
                                     // if a more specific error was given, use it
                                     var errorMessage = response.documentElement.getAttribute('statusText');
                                     if (!nf.Common.isBlank(errorMessage)) {
-                                        status = errorMessage;
+                                        statusText = errorMessage;
                                     }
                                 }
-                                $('#upload-template-status').text(status);
+
+                                // show reason
+                                nf.Dialog.showOkDialog({
+                                    headerText: 'Unable to Upload',
+                                    dialogContent: nf.Common.escapeHtml(statusText)
+                                });
                             }
                         },
                         error: function (xhr, statusText, error) {
-                            $('#upload-template-status').text(xhr.responseText);
+                            // request failed
+                            nf.Dialog.showOkDialog({
+                                headerText: 'Unable to Upload',
+                                dialogContent: nf.Common.escapeHtml(xhr.responseText)
+                            });
                         }
                     });
-                    
+
                     // configure the upload template dialog
                     this.getElement().modal({
                         headerText: 'Upload Template',
@@ -168,6 +173,9 @@ nf.ng.Canvas.OperateCtrl = function () {
                                         $('#upload-template-status').text('No template selected. Please browse to select a template.');
                                     } else {
                                         templateForm.submit();
+
+                                        // hide the dialog
+                                        $('#upload-template-dialog').modal('hide');
                                     }
                                 }
                             }