This is an automated email from the ASF dual-hosted git repository.

mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 459ef24  [NIFI-6606] disable PC for which the user does not have read 
permissions when configuring a PG. Also, sort the list of PCs for the combo 
dropdown in the PG configuration
459ef24 is described below

commit 459ef24e99dc6fcdea53e6b264adba048b7c0592
Author: Scott Aslan <[email protected]>
AuthorDate: Tue Sep 3 12:54:10 2019 -0400

    [NIFI-6606] disable PC for which the user does not have read permissions 
when configuring a PG. Also, sort the list of PCs for the combo dropdown in the 
PG configuration
    
    This closes #3690
---
 .../js/nf/canvas/nf-process-group-configuration.js | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js
index 8bf333d..43e84f2 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js
@@ -284,7 +284,40 @@
                 text: 'No parameter context',
                 value: null
             }];
-            parameterContexts.forEach(function (parameterContext) {
+
+            var authorizedParameterContexts = 
parameterContexts.filter(function (parameterContext) {
+                return parameterContext.permissions.canRead;
+            });
+
+            var unauthorizedParameterContexts = 
parameterContexts.filter(function (parameterContext) {
+                return !parameterContext.permissions.canRead;
+            });
+
+            //sort alphabetically
+            var sortedAuthorizedParameterContexts = 
authorizedParameterContexts.sort(function (a, b) {
+                if (a.component.name < b.component.name) {
+                    return -1;
+                }
+                if (a.component.name > b.component.name) {
+                    return 1;
+                }
+                return 0;
+            });
+
+            //sort alphabetically
+            var sortedUnauthorizedParameterContexts = 
unauthorizedParameterContexts.sort(function (a, b) {
+                if (a.id < b.id) {
+                    return -1;
+                }
+                if (a.id > b.id) {
+                    return 1;
+                }
+                return 0;
+            });
+
+            var sortedParameterContexts = 
sortedAuthorizedParameterContexts.concat(sortedUnauthorizedParameterContexts);
+
+            sortedParameterContexts.forEach(function (parameterContext) {
                 var option;
                 if (parameterContext.permissions.canRead) {
                     option = {
@@ -294,6 +327,7 @@
                     };
                 } else {
                     option = {
+                        'disabled': true,
                         'text': parameterContext.id,
                         'value': parameterContext.id
                     }

Reply via email to