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/11/10 13:41:08 UTC

nifi git commit: NIFI-4591: - Ensuring View Details button is visible if the user has read access and the service is defined in the current Process Group.

Repository: nifi
Updated Branches:
  refs/heads/master f11e03886 -> 387dce5ad


NIFI-4591:
- Ensuring View Details button is visible if the user has read access and the service is defined in the current Process Group.

This closes #2262

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/387dce5a
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/387dce5a
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/387dce5a

Branch: refs/heads/master
Commit: 387dce5ad09c3902983a1d4a74660d24d69d34d4
Parents: f11e038
Author: Matt Gilman <ma...@gmail.com>
Authored: Thu Nov 9 12:48:42 2017 -0500
Committer: Scott Aslan <sc...@gmail.com>
Committed: Thu Nov 9 16:41:45 2017 -0500

----------------------------------------------------------------------
 .../js/nf/canvas/nf-controller-services.js      | 47 ++++++++++++--------
 1 file changed, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/387dce5a/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 59041c4..30f6530 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
@@ -844,7 +844,7 @@
         var controllerServiceActionFormatter = function (row, cell, value, columnDef, dataContext) {
             var markup = '';
 
-            if (dataContext.permissions.canRead && dataContext.permissions.canWrite) {
+            if (dataContext.permissions.canRead) {
                 var definedByCurrentGroup = false;
                 if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) {
                     // when opened in the process group context, the current group is store in #process-group-id
@@ -857,30 +857,39 @@
                 }
 
                 if (definedByCurrentGroup === true) {
-                    if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') {
-                        markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>';
-                        markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>';
-                    } else if (dataContext.component.state === 'DISABLED') {
-                        markup += '<div class="pointer edit-controller-service fa fa-gear" title="Configure" style="margin-top: 2px; margin-right: 3px;" ></div>';
-
-                        // if there are no validation errors allow enabling
-                        if (nfCommon.isEmpty(dataContext.component.validationErrors)) {
-                            markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
-                        }
+                    if (dataContext.permissions.canWrite) {
+                        // write permission... allow actions based on the current state of the service
+                        if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') {
+                            markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                            markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                        } else if (dataContext.component.state === 'DISABLED') {
+                            markup += '<div class="pointer edit-controller-service fa fa-gear" title="Configure" style="margin-top: 2px; margin-right: 3px;" ></div>';
+
+                            // if there are no validation errors allow enabling
+                            if (nfCommon.isEmpty(dataContext.component.validationErrors)) {
+                                markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>';
+                            }
 
-                        if (dataContext.component.multipleVersionsAvailable === true) {
-                            markup += '<div title="Change Version" class="pointer change-version-controller-service fa fa-exchange" style="margin-top: 2px; margin-right: 3px;" ></div>';
-                        }
+                            if (dataContext.component.multipleVersionsAvailable === true) {
+                                markup += '<div title="Change Version" class="pointer change-version-controller-service fa fa-exchange" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                            }
 
-                        if (canWriteControllerServiceParent(dataContext)) {
-                            markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                            if (canWriteControllerServiceParent(dataContext)) {
+                                markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                            }
                         }
-                    }
 
-                    if (dataContext.component.persistsState === true) {
-                        markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                        if (dataContext.component.persistsState === true) {
+                            markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                        }
+                    } else {
+                        // no write permission... allow viewing configuration if in current group
+                        if (definedByCurrentGroup === true) {
+                            markup += '<div class="pointer view-controller-service fa fa-gear" title="View Configuration" style="margin-top: 2px; margin-right: 3px;" ></div>';
+                        }
                     }
                 } else {
+                    // not defined in current group... show go to arrow
                     markup += '<div class="pointer go-to-controller-service fa fa-long-arrow-right" title="Go To" style="margin-top: 2px; margin-right: 3px;" ></div>';
                 }
             }