This is an automated email from the ASF dual-hosted git repository. scottyaslan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 710c02c673570d09a7e61ea6f95015b6c36382cd Author: Rob Fellows <[email protected]> AuthorDate: Thu Sep 5 14:10:24 2019 -0400 NIFI-6623 - Support linking to unauthorized components from referencing components --- .../web/api/entity/AffectedComponentEntity.java | 13 ++++++++++ .../org/apache/nifi/web/api/dto/EntityFactory.java | 1 + .../webapp/js/nf/canvas/nf-parameter-contexts.js | 30 ++++++++++++++-------- .../webapp/js/nf/canvas/nf-variable-registry.js | 21 ++++++++++++++- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java index 737d9c0..7ef93a7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/AffectedComponentEntity.java @@ -31,6 +31,7 @@ public class AffectedComponentEntity extends ComponentEntity implements Permissi private AffectedComponentDTO component; private ProcessGroupNameDTO processGroup; + private String referenceType; /** * @return variable referencing components that is being serialized @@ -54,6 +55,18 @@ public class AffectedComponentEntity extends ComponentEntity implements Permissi this.processGroup = processGroup; } + @ApiModelProperty(value="The type of component referenced", + allowableValues = AffectedComponentDTO.COMPONENT_TYPE_PROCESSOR + "," + AffectedComponentDTO.COMPONENT_TYPE_CONTROLLER_SERVICE + ", " + + AffectedComponentDTO.COMPONENT_TYPE_INPUT_PORT + ", " + AffectedComponentDTO.COMPONENT_TYPE_OUTPUT_PORT + ", " + + AffectedComponentDTO.COMPONENT_TYPE_REMOTE_INPUT_PORT + ", " + AffectedComponentDTO.COMPONENT_TYPE_REMOTE_OUTPUT_PORT) + public String getReferenceType() { + return referenceType; + } + + public void setReferenceType(String referenceType) { + this.referenceType = referenceType; + } + @Override public String toString() { return component == null ? "AffectedComponent[No Component]" : component.toString(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java index 20de5e5..08c28d1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/EntityFactory.java @@ -370,6 +370,7 @@ public final class EntityFactory { if (dto != null) { entity.setPermissions(permissions); entity.setId(dto.getId()); + entity.setReferenceType(dto.getReferenceType()); if (permissions != null && permissions.getCanRead()) { entity.setComponent(dto); 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 161bb64..79c3bef 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 @@ -692,16 +692,26 @@ } } else { var referencingUnauthorizedComponentContainer = $('<li class="referencing-component-container"></li>').appendTo(unauthorizedComponentsContainer); - $('<span class="parameter-context-referencing-component-name link ellipsis"></span>').prop('title', unauthorizedReferencingComponentEntity.id).text(unauthorizedReferencingComponentEntity.id).on('click', function () { - // check if there are outstanding changes - handleOutstandingChanges().done(function () { - // close the shell - $('#shell-dialog').modal('hide'); - - // show the component in question - nfCanvasUtils.showComponent(unauthorizedReferencingComponentEntity.processGroup.id, unauthorizedReferencingComponentEntity.id); - }); - }).appendTo(referencingUnauthorizedComponentContainer); + $('<span class="parameter-context-referencing-component-name link ellipsis"></span>') + .prop('title', unauthorizedReferencingComponentEntity.id) + .text(unauthorizedReferencingComponentEntity.id) + .on('click', function () { + // check if there are outstanding changes + handleOutstandingChanges().done(function () { + // close the shell + $('#shell-dialog').modal('hide'); + + // show the component in question + if (unauthorizedReferencingComponentEntity.referenceType === 'PROCESSOR') { + nfCanvasUtils.showComponent(unauthorizedReferencingComponentEntity.processGroup.id, unauthorizedReferencingComponentEntity.id); + } else if (unauthorizedReferencingComponentEntity.referenceType === 'CONTROLLER_SERVICE') { + nfProcessGroupConfiguration.showConfiguration(unauthorizedReferencingComponentEntity.processGroup.id).done(function () { + nfProcessGroupConfiguration.selectControllerService(unauthorizedReferencingComponentEntity.id); + }); + } + }); + }) + .appendTo(referencingUnauthorizedComponentContainer); } }); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js index cfd18f5..f84537e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-variable-registry.js @@ -912,7 +912,26 @@ } } else { var affectedUnauthorizedComponentContainer = $('<li class="affected-component-container"></li>').appendTo(unauthorizedComponentsContainer); - $('<span class="unset"></span>').text(unauthorizedAffectedComponentEntity.id).appendTo(affectedUnauthorizedComponentContainer); + $('<span class="referencing-component-name link ellipsis"></span>') + .prop('title', unauthorizedAffectedComponentEntity.id) + .text(unauthorizedAffectedComponentEntity.id) + .on('click', function () { + // check if there are outstanding changes + handleOutstandingChanges().done(function () { + // close the shell + $('#shell-dialog').modal('hide'); + + // show the component in question + if (unauthorizedAffectedComponentEntity.referenceType === 'PROCESSOR') { + nfCanvasUtils.showComponent(unauthorizedAffectedComponentEntity.processGroup.id, unauthorizedAffectedComponentEntity.id); + } else if (unauthorizedAffectedComponentEntity.referenceType === 'CONTROLLER_SERVICE') { + nfProcessGroupConfiguration.showConfiguration(unauthorizedAffectedComponentEntity.processGroup.id).done(function () { + nfProcessGroupConfiguration.selectControllerService(unauthorizedAffectedComponentEntity.id); + }); + } + }); + }) + .appendTo(affectedUnauthorizedComponentContainer); } }); }
