You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sc...@apache.org on 2017/03/13 16:37:03 UTC

nifi git commit: NIFI-3244: - Updating Controller Service scope header. - Rendering the name of the parent when possible. - Fixing the check if the parent Process Group is write-able when the parent is selected on the current canvas.

Repository: nifi
Updated Branches:
  refs/heads/master a61f35305 -> 620c57270


NIFI-3244:
- Updating Controller Service scope header.
- Rendering the name of the parent when possible.
- Fixing the check if the parent Process Group is write-able when the parent is selected on the current canvas.

This closes #1590

Signed-off-by: Scott Aslan <sc...@gmail.com>


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

Branch: refs/heads/master
Commit: 620c572703e8cd55ef73e2c869932717ee88a29a
Parents: a61f353
Author: Matt Gilman <ma...@gmail.com>
Authored: Mon Mar 13 11:36:42 2017 -0400
Committer: Scott Aslan <sc...@gmail.com>
Committed: Mon Mar 13 12:35:46 2017 -0400

----------------------------------------------------------------------
 .../js/nf/canvas/nf-controller-services.js      | 41 ++++++++++++++++++--
 1 file changed, 37 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/620c5727/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 cc6f917..5274f79 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
@@ -558,7 +558,31 @@
         }
 
         if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
-            return dataContext.component.parentGroupId;
+            // see if this listing is based off a selected process group
+            var selection = nfCanvasUtils.getSelection();
+            if (selection.empty() === false) {
+                var selectedData = selection.datum();
+                if (selectedData.id === dataContext.component.parentGroupId) {
+                    if (selectedData.permissions.canRead) {
+                        return selectedData.component.name;
+                    } else {
+                        return selectedData.id;
+                    }
+                }
+            }
+
+            // there's either no selection or the service is defined in an ancestor component
+            var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
+
+            var processGroupLabel = dataContext.component.parentGroupId;
+            $.each(breadcrumbs, function (_, breadcrumbEntity) {
+                if (breadcrumbEntity.id === dataContext.component.parentGroupId) {
+                    processGroupLabel = breadcrumbEntity.label;
+                    return false;
+                }
+            });
+
+            return processGroupLabel;
         } else {
             return 'Controller';
         }
@@ -571,9 +595,18 @@
      * @returns {boolean} whether the user has write permissions for the parent of the controller service
      */
     var canWriteControllerServiceParent = function (dataContext) {
-        // we know the process group for this controller service is part
-        // of the current breadcrumb trail
+        // we know the process group for this controller service is part of the current breadcrumb trail
         var canWriteProcessGroupParent = function (processGroupId) {
+            // see if this listing is based off a selected process group
+            var selection = nfCanvasUtils.getSelection();
+            if (selection.empty() === false) {
+                var datum = selection.datum();
+                if (datum.id === processGroupId) {
+                    return datum.permissions.canWrite;
+                }
+            }
+
+            // there's either no selection or the service is defined in an ancestor component
             var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs();
 
             var isAuthorized = false;
@@ -783,7 +816,7 @@
             },
             {
                 id: 'parentGroupId',
-                name: 'Process Group',
+                name: 'Scope',
                 formatter: groupIdFormatter,
                 sortable: true,
                 resizeable: true