From commits-return-44719-archive-asf-public=cust-asf.ponee.io@nifi.apache.org Wed Jun 2 16:22:50 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 0B213180638 for ; Wed, 2 Jun 2021 18:22:50 +0200 (CEST) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id 37B06401E4 for ; Wed, 2 Jun 2021 16:22:49 +0000 (UTC) Received: (qmail 10846 invoked by uid 500); 2 Jun 2021 16:22:48 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 10837 invoked by uid 99); 2 Jun 2021 16:22:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2021 16:22:48 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A711381A86; Wed, 2 Jun 2021 16:22:48 +0000 (UTC) Date: Wed, 02 Jun 2021 16:22:48 +0000 To: "commits@nifi.apache.org" Subject: [nifi] branch main updated: NIFI-8471 Parameter Contexts - show referencing process groups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <162265096793.25471.3344668516969472431@gitbox.apache.org> From: pvillard@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: nifi X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Oldrev: f23dcb05f6d6c869fab453634bf094a01b42d121 X-Git-Newrev: 66f0f902525fe8303389c316f3b63029e96a565f X-Git-Rev: 66f0f902525fe8303389c316f3b63029e96a565f X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. pvillard pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git The following commit(s) were added to refs/heads/main by this push: new 66f0f90 NIFI-8471 Parameter Contexts - show referencing process groups 66f0f90 is described below commit 66f0f902525fe8303389c316f3b63029e96a565f Author: s9514171 AuthorDate: Mon May 3 08:39:07 2021 +0000 NIFI-8471 Parameter Contexts - show referencing process groups Signed-off-by: Pierre Villard This closes #5048. --- .../canvas/new-parameter-context-dialog.jsp | 9 ++ .../webapp/js/nf/canvas/nf-parameter-contexts.js | 96 ++++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp index e308faa..d1e10a5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/new-parameter-context-dialog.jsp @@ -46,6 +46,15 @@
 
+
+
+ Referencing Components +
+
+
+
+
+
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js index 2f9ffc6..d7e9c64 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-parameter-contexts.js @@ -195,6 +195,8 @@ $('#parameter-context-description-field').val(''); $('#parameter-context-description-read-only').text(''); + $('#parameter-context-referencing-components').empty(); + $('#parameter-table, #add-parameter').show(); $('#parameter-context-tabs').show(); $('#parameter-context-tabs').find('.tab')[0].click(); @@ -1345,6 +1347,90 @@ var parameterIndex = 0; /** + * Loads the reference for this parameter context. + * + * @param {jQuery} referencingProcessGroupsContainer + * @param {object} parameterContext + */ + var loadReferencingProcessGroups = function (referencingProcessGroupsContainer, parameterContext) { + if (parameterContext.permissions.canRead === false) { + referencingProcessGroupsContainer.append('
Unauthorized
'); + return; + } + var referencingProcessGroups = parameterContext.component.boundProcessGroups; + if (nfCommon.isEmpty(referencingProcessGroups)) { + referencingProcessGroupsContainer.append('
No referencing components.
'); + return; + } + + // toggles the visibility of a container + var toggle = function (twist, container) { + if (twist.hasClass('expanded')) { + twist.removeClass('expanded').addClass('collapsed'); + container.hide(); + } else { + twist.removeClass('collapsed').addClass('expanded'); + container.show(); + } + }; + + var processGroups = $('
    '); + var unauthorized = $('
      '); + $.each(referencingProcessGroups, function (_, referencingProcessGroupsEntity) { + // check the access policy for this referencing component + if (referencingProcessGroupsEntity.permissions.canRead === false) { + var unauthorizedReferencingComponent = $('
      ').text(referencingProcessGroupsEntity.id); + unauthorized.append(unauthorizedReferencingComponent); + } else { + var referencingComponent = referencingProcessGroupsEntity.component; + + var processGroupLink = $('').text(referencingComponent.name).on('click', function () { + // show the component + if (nfCommon.isDefinedAndNotNull(referencingComponent.parentGroupId)) { + nfCanvasUtils.showComponent(referencingComponent.parentGroupId, referencingComponent.id); + } else { + nfProcessGroup.enterGroup(referencingComponent.id); + } + + // close the dialog and shell + referencingProcessGroupsContainer.closest('.dialog').modal('hide'); + $('#shell-close-button').click(); + }); + var processGroupItem = $('
    • ').append(processGroupLink); + processGroups.append(processGroupItem); + } + }); + + // create the collapsable listing for each type + var createReferenceBlock = function (titleText, list) { + if (list.is(':empty')) { + list.remove(); + return; + } + + var twist = $('
      '); + var title = $('').text(titleText); + var count = $('').text('(' + list.children().length + ')'); + + // create the reference block + $('
      ').on('click', function () { + // toggle this block + toggle(twist, list); + + // update the border if necessary + updateReferencingComponentsBorder(referencingProcessGroupsContainer); + }).append(twist).append(title).append(count).appendTo(referencingProcessGroupsContainer); + + // add the listing + list.appendTo(referencingProcessGroupsContainer); + }; + + // create blocks for each type of component + createReferenceBlock('Process Groups', processGroups); + createReferenceBlock('Unauthorized', unauthorized); + }; + + /** * Loads the specified parameter registry. * * @param {object} parameterContext @@ -2439,6 +2525,12 @@ .prop('title', parameterContextEntity.id) .text(parameterContextEntity.id); + // get the reference container + var referencingComponentsContainer = $('#parameter-context-referencing-components'); + + // load the controller referencing components list + loadReferencingProcessGroups(referencingComponentsContainer, parameterContextEntity); + loadParameters(parameterContextEntity, parameterToSelect, readOnly || !canWrite); var editModeButtonModel = [{ @@ -2501,6 +2593,10 @@ // check if border is necessary updateReferencingComponentsBorder($('#parameter-referencing-components-container')); + + // show the border if necessary + updateReferencingComponentsBorder(referencingComponentsContainer); + }).fail(nfErrorHandler.handleAjaxError); },