Repository navigation
NIFI-14777 Restore capability from NiFi 1.x to view upstream/downstre… #11582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
03bf725
NIFI-14777 Restore capability from NiFi 1.x to view upstream/downstre…
markobean 3af61e5
NIFI-14777 update arrow direction on upstream/downstream context menu…
markobean 4c75971
fix 1: remove <button> in favor of <a>
markobean 3a35876
make current process group non-navigable
markobean 46afca4
NIFI-14777 refactor PG ID/name selection to include possible peer PG …
markobean e01ca90
NIFI-14777 refactored component-connections-dialog.copmonent.spec.ts …
markobean 2428f5c
NIFI-14777 updated functionality in dialog to remove the clickable fe…
markobean 7670301
NIFI-14777 fine tune presentation format of text in table
markobean 0f22a6c
NIFI-14777 updated link for remote process group vs. process group
markobean eb141af
NIFI-14777 Added functionality for context referring to the current p…
markobean cd97d9e
NIFI-14777 removed extra whitespace before link text
markobean 85023a9
NIFI-14777 make dialog table columns sortable including test spec
markobean 0219c10
NIFI-14777 implemented suggestion to re-use existing component-contex…
markobean f130be3
NIFI-14777 update to handle permissions properly
markobean bb57d48
NIFI-14777 updated a couple UI display/formatting options
markobean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
170 changes: 170 additions & 0 deletions
170
...tend/apps/nifi/src/app/pages/flow-designer/state/flow/component-connections.utils.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import { buildComponentIdToNameMap, collectEndpointGroupIds } from './component-connections.utils'; | ||
| import { ComponentEntity, ConnectionEntity, ProcessGroupFlowEntity } from './index'; | ||
|
|
||
| const DEFINING_GROUP_ID = 'defining-group-id'; | ||
| const CHILD_GROUP_ID = 'child-group-id'; | ||
| const OTHER_CHILD_GROUP_ID = 'other-child-group-id'; | ||
| const REMOTE_GROUP_ID = 'remote-process-group-id'; | ||
|
|
||
| interface EndpointOptions { | ||
| sourceGroupId?: string; | ||
| sourceType?: string; | ||
| destinationGroupId?: string; | ||
| destinationType?: string; | ||
| } | ||
|
|
||
| function connection(options: EndpointOptions = {}): ConnectionEntity { | ||
| return { | ||
| id: 'connection-id', | ||
| permissions: { canRead: false, canWrite: false }, | ||
| position: { x: 0, y: 0 }, | ||
| revision: { version: 0 }, | ||
| sourceId: 'source-id', | ||
| sourceGroupId: options.sourceGroupId ?? DEFINING_GROUP_ID, | ||
| sourceType: options.sourceType ?? 'PROCESSOR', | ||
| destinationId: 'destination-id', | ||
| destinationGroupId: options.destinationGroupId ?? DEFINING_GROUP_ID, | ||
| destinationType: options.destinationType ?? 'PROCESSOR', | ||
| component: null | ||
| }; | ||
| } | ||
|
|
||
| function component(id: string, name: string | undefined, canRead: boolean): ComponentEntity { | ||
| return { | ||
| id, | ||
| permissions: { canRead, canWrite: false }, | ||
| position: { x: 0, y: 0 }, | ||
| revision: { version: 0 }, | ||
| component: { id, name } | ||
| }; | ||
| } | ||
|
|
||
| function flowEntity(flow: Partial<ProcessGroupFlowEntity['processGroupFlow']['flow']>): ProcessGroupFlowEntity { | ||
| return { | ||
| permissions: { canRead: true, canWrite: true }, | ||
| processGroupFlow: { | ||
| id: DEFINING_GROUP_ID, | ||
| uri: '', | ||
| parentGroupId: null, | ||
| breadcrumb: { | ||
| id: DEFINING_GROUP_ID, | ||
| permissions: { canRead: true, canWrite: true }, | ||
| versionedFlowState: '', | ||
| breadcrumb: { id: DEFINING_GROUP_ID, name: 'Defining Process Group' } | ||
| }, | ||
| flow: { | ||
| processGroups: [], | ||
| remoteProcessGroups: [], | ||
| processors: [], | ||
| inputPorts: [], | ||
| outputPorts: [], | ||
| connections: [], | ||
| labels: [], | ||
| funnels: [], | ||
| ...flow | ||
| } | ||
| } | ||
| } as unknown as ProcessGroupFlowEntity; | ||
| } | ||
|
|
||
| describe('collectEndpointGroupIds', () => { | ||
| it('collects nothing when both ends are in the group that defines the connections', () => { | ||
| expect(collectEndpointGroupIds([connection()], DEFINING_GROUP_ID)).toEqual([]); | ||
| }); | ||
|
|
||
| it('collects the group behind a port an end reaches into', () => { | ||
| const connections = [ | ||
| connection({ destinationGroupId: CHILD_GROUP_ID, destinationType: 'INPUT_PORT' }), | ||
| connection({ sourceGroupId: OTHER_CHILD_GROUP_ID, sourceType: 'OUTPUT_PORT' }) | ||
| ]; | ||
|
|
||
| expect(collectEndpointGroupIds(connections, DEFINING_GROUP_ID)).toEqual([CHILD_GROUP_ID, OTHER_CHILD_GROUP_ID]); | ||
| }); | ||
|
|
||
| it('collects a group reached by several connections once', () => { | ||
| const connections = [ | ||
| connection({ destinationGroupId: CHILD_GROUP_ID, destinationType: 'INPUT_PORT' }), | ||
| connection({ destinationGroupId: CHILD_GROUP_ID, destinationType: 'INPUT_PORT' }), | ||
| connection({ sourceGroupId: CHILD_GROUP_ID, sourceType: 'OUTPUT_PORT' }) | ||
| ]; | ||
|
|
||
| expect(collectEndpointGroupIds(connections, DEFINING_GROUP_ID)).toEqual([CHILD_GROUP_ID]); | ||
| }); | ||
|
|
||
| it('leaves out a Remote Process Group, which has no flow of its own to load', () => { | ||
| const connections = [ | ||
| connection({ sourceGroupId: REMOTE_GROUP_ID, sourceType: 'REMOTE_OUTPUT_PORT' }), | ||
| connection({ destinationGroupId: REMOTE_GROUP_ID, destinationType: 'REMOTE_INPUT_PORT' }) | ||
| ]; | ||
|
|
||
| expect(collectEndpointGroupIds(connections, DEFINING_GROUP_ID)).toEqual([]); | ||
| }); | ||
| }); | ||
|
|
||
| describe('buildComponentIdToNameMap', () => { | ||
| it('names only the components the current user can read', () => { | ||
| const flow = flowEntity({ | ||
| processors: [ | ||
| component('readable-processor-id', 'Readable Processor', true), | ||
| component('hidden-processor-id', 'Hidden Processor', false) | ||
| ] | ||
| }); | ||
|
|
||
| const idToName = buildComponentIdToNameMap([flow]); | ||
|
|
||
| expect(idToName.get('readable-processor-id')).toBe('Readable Processor'); | ||
| expect(idToName.has('hidden-processor-id')).toBeFalsy(); | ||
| }); | ||
|
|
||
| it('names components of every group it is given, which is what separates the two ends', () => { | ||
| const definingFlow = flowEntity({ | ||
| processors: [component('hidden-processor-id', 'Hidden Processor', false)] | ||
| }); | ||
| const childFlow = flowEntity({ | ||
| inputPorts: [component('input-port-id', 'Input Port A', true)] | ||
| }); | ||
|
|
||
| const idToName = buildComponentIdToNameMap([definingFlow, childFlow]); | ||
|
|
||
| expect(idToName.has('hidden-processor-id')).toBeFalsy(); | ||
| expect(idToName.get('input-port-id')).toBe('Input Port A'); | ||
| }); | ||
|
|
||
| it('names every kind of component a connection can be attached to', () => { | ||
| const flow = flowEntity({ | ||
| processors: [component('processor-id', 'Processor', true)], | ||
| inputPorts: [component('input-port-id', 'Input Port', true)], | ||
| outputPorts: [component('output-port-id', 'Output Port', true)], | ||
| funnels: [component('funnel-id', undefined, true)] | ||
| }); | ||
|
|
||
| const idToName = buildComponentIdToNameMap([flow]); | ||
|
|
||
| expect(idToName.get('processor-id')).toBe('Processor'); | ||
| expect(idToName.get('input-port-id')).toBe('Input Port'); | ||
| expect(idToName.get('output-port-id')).toBe('Output Port'); | ||
| // a funnel has no name of its own, and is still reported as readable | ||
| expect(idToName.get('funnel-id')).toBe(''); | ||
| }); | ||
|
|
||
| it('builds an empty map when no flow could be loaded', () => { | ||
| expect(buildComponentIdToNameMap([]).size).toBe(0); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.