Repository: nifi
Updated Branches:
  refs/heads/master bba675a11 -> 64bb55ef3


NIFI-2839 Add a confirmation dialog when deleting a Controller Service or 
Reporting Task. This closes #1384


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

Branch: refs/heads/master
Commit: 64bb55ef3c240ea11940757a96d92c609c1edc41
Parents: bba675a
Author: Pierre Villard <[email protected]>
Authored: Tue Jan 3 17:24:12 2017 +0100
Committer: Matt Gilman <[email protected]>
Committed: Thu Jan 5 09:07:35 2017 -0500

----------------------------------------------------------------------
 .../webapp/js/nf/canvas/nf-controller-service.js   | 17 +++++++++++++++++
 .../webapp/js/nf/canvas/nf-controller-services.js  |  2 +-
 .../main/webapp/js/nf/canvas/nf-reporting-task.js  | 16 ++++++++++++++++
 .../src/main/webapp/js/nf/canvas/nf-settings.js    |  2 +-
 4 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/64bb55ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
index 0350a16..aee3622 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.js
@@ -2063,6 +2063,23 @@ nf.ControllerService = (function () {
                 reloadControllerService(serviceTable, referencedServiceId);
             });
         },
+        
+        /**
+         * Prompts the user before attempting to delete the specified 
controller service.
+         *
+         * @param {jQuery} serviceTable
+         * @param {object} controllerServiceEntity
+         */
+        promptToDeleteController: function (serviceTable, 
controllerServiceEntity) {
+            // prompt for deletion
+            nf.Dialog.showYesNoDialog({
+                headerText: 'Delete Controller Service',
+                dialogContent: 'Delete controller service \'' + 
nf.Common.escapeHtml(controllerServiceEntity.component.name) + '\'?',
+                yesHandler: function () {
+                       nf.ControllerService.remove(serviceTable, 
controllerServiceEntity);
+                }
+            });
+        },
 
         /**
          * Deletes the specified controller service.

http://git-wip-us.apache.org/repos/asf/nifi/blob/64bb55ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
index 2d378bd..5fdc8c9 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js
@@ -701,7 +701,7 @@ nf.ControllerServices = (function () {
                 } else if (target.hasClass('disable-controller-service')) {
                     nf.ControllerService.disable(serviceTable, 
controllerServiceEntity);
                 } else if (target.hasClass('delete-controller-service')) {
-                    nf.ControllerService.remove(serviceTable, 
controllerServiceEntity);
+                    
nf.ControllerService.promptToDeleteController(serviceTable, 
controllerServiceEntity);
                 } else if (target.hasClass('view-state-controller-service')) {
                     nf.ComponentState.showState(controllerServiceEntity, 
controllerServiceEntity.state === 'DISABLED');
                 } else if (target.hasClass('edit-access-policies')) {

http://git-wip-us.apache.org/repos/asf/nifi/blob/64bb55ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
index 681019a..f134b69 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js
@@ -735,6 +735,22 @@ nf.ReportingTask = (function () {
                 renderReportingTask(response);
             }).fail(nf.Common.handleAjaxError);
         },
+        
+        /**
+         * Prompts the user before attempting to delete the specified 
reporting task.
+         *
+         * @param {object} reportingTaskEntity
+         */
+        promptToDeleteReportingTask: function (reportingTaskEntity) {
+            // prompt for deletion
+            nf.Dialog.showYesNoDialog({
+                headerText: 'Delete Reporting Task',
+                dialogContent: 'Delete reporting task \'' + 
nf.Common.escapeHtml(reportingTaskEntity.component.name) + '\'?',
+                yesHandler: function () {
+                       nf.ReportingTask.remove(reportingTaskEntity);
+                }
+            });
+        },
 
         /**
          * Deletes the specified reporting task.

http://git-wip-us.apache.org/repos/asf/nifi/blob/64bb55ef/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
index 4ef836d..295c428 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
@@ -804,7 +804,7 @@ nf.Settings = (function () {
                 } else if (target.hasClass('stop-reporting-task')) {
                     nf.ReportingTask.stop(reportingTaskEntity);
                 } else if (target.hasClass('delete-reporting-task')) {
-                    nf.ReportingTask.remove(reportingTaskEntity);
+                    
nf.ReportingTask.promptToDeleteReportingTask(reportingTaskEntity);
                 } else if (target.hasClass('view-state-reporting-task')) {
                     var canClear = reportingTaskEntity.component.state === 
'STOPPED' && reportingTaskEntity.component.activeThreadCount === 0;
                     nf.ComponentState.showState(reportingTaskEntity, canClear);

Reply via email to