You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mcgilman (via GitHub)" <gi...@apache.org> on 2026/10/12 13:31:06 UTC
[PR] NIFI-16449: Promote canvas create dialogs to reusable output-driven c… [nifi]
mcgilman opened a new pull request, #11798:
URL: https://github.com/apache/nifi/pull/11798
…omponents
Move the flow-designer create, group, and import dialogs into ui/common so they emit typed requests instead of dispatching page NgRx. Flow-designer effects still own persistence, and the shared request types live in flow-shared.
# Summary
[NIFI-16449](https://issues.apache.org/jira/browse/NIFI-16449)
Move the flow-designer create, group, and import dialogs into `ui/common/component-dialogs` so they can be reused without dispatching flow-designer NgRx actions.
- Create Processor, Create Port, Create Process Group, Create Remote Process Group, Create Connection, Group Components, and Import From Registry emit typed requests. They do not inject `Store`.
- Flow-designer effects still assign inputs and dispatch the existing actions, including persistence, error banners, temporary-edge cleanup, and `setDragging(false)`.
- Shared request types live in `state/flow-shared`. The flow-designer page state does not re-export them.
- Create Process Group accepts `supportsParameters`, defaulting to true. When a host sets it to false, the parameter-context selector is hidden and submit sends no parameter context id. The flow designer leaves the default, so unreadable contexts remain disabled options and the current context is selected only when that option is readable.
- `CanvasUtils.getConnectableTypeForSource` delegates to the shared helper, matching `getConnectableTypeForDestination`.
The existing edit dialogs were already in `ui/common/component-dialogs` and are unchanged.
Verified with `npx nx test nifi` (3097 tests), `npx nx run nifi:lint`, and `npx tsc -p apps/nifi/tsconfig.app.json --noEmit`.
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
### Pull Request Tracking
- Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
- Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
- Pull request contains [commits signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) with a registered key indicating `Verified` status
### Pull Request Formatting
- Pull Request based on current revision of the `main` branch
- Pull Request refers to a feature branch with one commit containing changes
# Verification
Please indicate the verification steps performed prior to pull request creation.
### Build
- [ ] Build completed using `./mvnw clean install -P contrib-check`
- [ ] JDK 21
- [ ] JDK 25
### Licensing
- [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
### Documentation
- [ ] Documentation formatting appears as expected in rendered files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-16449: Promote canvas create dialogs to reusable output-driven c… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on code in PR #11798:
URL: https://github.com/apache/nifi/pull/11798#discussion_r4251382984
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/flow-shared/index.ts:
##########
@@ -231,3 +238,306 @@ export interface SnippetDeleteRequest {
id: string;
options: SnippetDeleteOptions;
}
+
+/*
+ * Requests shared by the flow designer and the reusable component dialogs.
+ */
+
+export interface SelectedComponent {
+ id: string;
+ componentType: ComponentType;
+ entity?: any;
+}
+
+export interface CreateComponentRequest {
+ type: ComponentType;
+ position: Position;
+ revision: any;
+}
+
+export interface CreateLabelRequest extends CreateComponentRequest {
+ zIndex: number;
+}
+
+export interface CreateConnectionRequest {
+ source: SelectedComponent;
+ destination: SelectedComponent;
+ bends?: Position[];
+}
+
+export interface CreateConnectionDialogRequest {
+ request: CreateConnectionRequest;
+ defaults: {
+ flowfileExpiration: string;
+ objectThreshold: number;
+ dataSizeThreshold: string;
+ };
+}
+
+export interface CreateConnection {
+ payload: any;
+}
+
+export interface CreateProcessGroupDialogRequest {
+ request: CreateComponentRequest;
+ currentParameterContextId?: string;
+ parameterContexts: ParameterContextEntity[];
+}
+
+export interface NoRegistryClientsDialogRequest {
+ controllerPermissions: Permissions;
+}
+
+export interface ImportFromRegistryDialogRequest {
+ request: CreateComponentRequest;
+ registryClients: RegistryClientEntity[];
+}
+
+export interface ImportFromRegistryRequest {
+ payload: any;
+ keepExistingParameterContext: boolean;
+}
+
+export interface SaveToVersionControlRequest {
+ processGroupId: string;
+ versionedFlow: SparseVersionedFlow;
+ processGroupRevision: Revision;
+}
+
+export interface StopVersionControlRequest {
+ revision: Revision;
+ processGroupId: string;
+}
+
+export interface VersionControlInformationEntity {
+ processGroupRevision: Revision;
+ versionControlInformation?: VersionControlInformation;
+ disconnectedNodeAcknowledged?: boolean;
+}
+
+export interface OpenGroupComponentsDialogRequest {
+ position: Position;
+ moveComponents: MoveComponentRequest[];
+}
+
+export interface GroupComponentsDialogRequest {
+ request: OpenGroupComponentsDialogRequest;
+ currentParameterContextId?: string;
+ parameterContexts: ParameterContextEntity[];
+}
+
+export interface GroupComponentsRequest extends CreateProcessGroupRequest {
+ components: MoveComponentRequest[];
+}
+
+export interface GroupComponentsSuccess extends CreateComponentResponse {
+ components: MoveComponentRequest[];
+}
+
+export interface CreateProcessorDialogRequest {
+ request: CreateComponentRequest;
+}
+
+export interface GoToRemoteProcessGroupRequest {
+ uri: string;
+}
+
+export interface CreateProcessorRequest extends CreateComponentRequest {
+ processorType: string;
+ processorBundle: Bundle;
+}
+
+export interface CreateProcessGroupRequest extends CreateComponentRequest {
+ name: string;
+ parameterContextId: string;
Review Comment:
Both Create Process Group and Group Components intentionally emit `null` for the valid “no parameter context” state and when `supportsParameters` is false, but this contract excludes `null`. Please change this to `string | null` and type the corresponding form controls accordingly so the reusable output accurately represents every valid intent.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/flow-shared/index.ts:
##########
@@ -231,3 +238,306 @@ export interface SnippetDeleteRequest {
id: string;
options: SnippetDeleteOptions;
}
+
+/*
+ * Requests shared by the flow designer and the reusable component dialogs.
+ */
+
+export interface SelectedComponent {
+ id: string;
+ componentType: ComponentType;
+ entity?: any;
+}
+
+export interface CreateComponentRequest {
+ type: ComponentType;
+ position: Position;
+ revision: any;
Review Comment:
Please replace the permissive types in the promoted dialog boundary with canonical request/entity types before merging. At minimum, `revision` should use `CreateRevisionRequest`, `SnippetComponentRequest.entity` should use `CanvasComponentEntity`, and the connection/import payloads should use DTO-derived create-request shapes. These are now reusable typed outputs; retaining `any` allows malformed requests to compile and does not meet NIFI-16449's canonical request-contract requirement.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/component-dialogs/create-port/create-port.component.ts:
##########
@@ -83,38 +79,24 @@ export class CreatePort extends CloseOnEscapeDialog {
constructor() {
super();
- // set the port type name
if (ComponentType.InputPort == this.request.type) {
this.portTypeLabel = 'Input Port';
} else {
this.portTypeLabel = 'Output Port';
}
- // build the form
this.createPortForm = this.formBuilder.group({
newPortName: new FormControl('', Validators.required),
newPortAllowRemoteAccess: new FormControl(this.allowRemoteAccessOptions[0].value, Validators.required)
});
-
- // listen for changes to the parent process group id
- this.store
- .select(selectParentProcessGroupId)
- .pipe(takeUntilDestroyed())
- .subscribe((parentProcessGroupId) => {
- this.isRootProcessGroup = parentProcessGroupId == null;
- });
}
- createPort() {
- this.store.dispatch(
- createPort({
- request: {
- ...this.request,
- name: this.createPortForm.get('newPortName')?.value,
- allowRemoteAccess: this.createPortForm.get('newPortAllowRemoteAccess')?.value
- }
- })
- );
+ submitCreatePort() {
+ this.createPort.emit({
+ ...this.request,
+ name: this.createPortForm.get('newPortName')?.value,
+ allowRemoteAccess: this.createPortForm.get('newPortAllowRemoteAccess')?.value
Review Comment:
`allowRemoteAccessOptions` stores `'true'` / `'false'` strings, so this emits a string even though `CreatePortRequest` and the API DTO require a boolean. The service forwards the value unchanged, and both strings are truthy in JavaScript. Please make the option/control values boolean (or explicitly convert here) and update the test to assert boolean `true` / `false`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-16449: Promote canvas create dialogs to reusable output-driven c… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows commented on code in PR #11798:
URL: https://github.com/apache/nifi/pull/11798#discussion_r4260448204
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/flow-shared/index.ts:
##########
@@ -231,3 +245,306 @@ export interface SnippetDeleteRequest {
id: string;
options: SnippetDeleteOptions;
}
+
+/*
+ * Requests shared by the flow designer and the reusable component dialogs.
+ */
+
+export interface SelectedComponent {
+ id: string;
+ componentType: ComponentType;
+ entity?: any;
Review Comment:
This is still part of the promoted Create Connection dialog boundary, and the dialog later dereferences `entity.id` and component-specific fields without narrowing. With `any`, malformed endpoint inputs compile and then fail at runtime. Please introduce a dialog-specific endpoint contract backed by `CanvasConnectableEntity`—ideally a discriminated type that requires an entity for direct endpoints and separately models process-group/remote-group child-port selection.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/component-dialogs/create-connection/create-connection.component.ts:
##########
@@ -89,11 +91,14 @@ import { ContextErrorBanner } from '../../../../../../../ui/common/context-error
export class CreateConnection extends CloseOnEscapeDialog {
private dialogRequest = inject<CreateConnectionDialogRequest>(MAT_DIALOG_DATA);
private formBuilder = inject(FormBuilder);
- private store = inject<Store<NiFiState>>(Store);
- private canvasUtils = inject(CanvasUtils);
private clusterConnectionService = inject(ClusterConnectionService);
private client = inject(Client);
+ @Input() saving$: Observable<boolean> = of(false);
+ @Input() availablePrioritizers$: Observable<DocumentedType[]> = of([]);
+ @Input() breadcrumbs$: Observable<BreadcrumbEntity | null> = of(null);
+ @Output() createConnection = new EventEmitter<CreateConnectionPayload>();
+
@Input() set getChildOutputPorts(getChildOutputPorts: (groupId: string) => Observable<any>) {
Review Comment:
Please type this callback as `Observable<PortEntity[]>` and apply the same type to the input-port callback and `childInputPorts$` / `childOutputPorts$`. The dialog relies on array semantics and each item’s `id`; keeping `any` here allows invalid reusable-host callbacks to compile and leaves the promoted input boundary only partially typed.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.spec.ts:
##########
@@ -1901,4 +1932,413 @@ describe('FlowEffects', () => {
});
});
});
+
+ describe('openNewConnectionDialog$', () => {
+ const request = {
+ source: { id: 'src', componentType: ComponentType.Processor },
+ destination: { id: 'dst', componentType: ComponentType.Processor }
+ };
+
+ it('assigns dialog inputs and dispatches createConnection from the dialog output', async () => {
+ const afterClosed = new Subject<void>();
+ const createConnection = new EventEmitter<CreateConnection>();
+ const componentInstance: {
+ createConnection: EventEmitter<CreateConnection>;
+ saving$: Observable<boolean>;
+ breadcrumbs$: Observable<unknown>;
+ availablePrioritizers$: Observable<DocumentedType[]>;
+ getChildOutputPorts: (groupId: string) => Observable<unknown>;
+ getChildInputPorts: (groupId: string) => Observable<unknown>;
+ } = {
+ createConnection,
+ saving$: of(true),
+ breadcrumbs$: of(null),
+ availablePrioritizers$: of([]),
+ getChildOutputPorts: () => of([]),
+ getChildInputPorts: () => of([])
+ };
+ vi.spyOn(dialog, 'open').mockReturnValue({
+ componentInstance,
+ afterClosed: () => afterClosed.asObservable()
+ } as unknown as MatDialogRef<unknown>);
+ vi.spyOn(flowService, 'getProcessGroup').mockReturnValue(
+ of({
+ component: {
+ defaultFlowFileExpiration: '0 sec',
+ defaultBackPressureObjectThreshold: 10000,
+ defaultBackPressureDataSizeThreshold: '1 GB'
+ }
+ })
+ );
+ const outputPorts = [{ id: 'out-1' }];
+ const inputPorts = [{ id: 'in-1' }];
+ vi.spyOn(flowService, 'getFlow').mockReturnValue(
+ of({
+ processGroupFlow: {
+ flow: {
+ outputPorts,
+ inputPorts
+ }
+ }
+ })
+ );
+ const prioritizers = [{ type: 'org.apache.nifi.prioritizer.FirstInFirstOutPrioritizer' } as DocumentedType];
+ store.overrideSelector(selectCurrentProcessGroupId, 'pg-1');
+ store.overrideSelector(selectPrioritizerTypes, prioritizers);
+ store.refreshState();
+
+ effects.openNewConnectionDialog$.subscribe();
+ action$.next(FlowActions.openNewConnectionDialog({ request }));
+
+ expect(await firstValueFrom(componentInstance.saving$)).toBe(false);
+ expect(await firstValueFrom(componentInstance.breadcrumbs$)).toEqual(
+ fromFlow.initialState.flow.processGroupFlow.breadcrumb
+ );
+ expect(await firstValueFrom(componentInstance.availablePrioritizers$)).toEqual(prioritizers);
+ expect(await firstValueFrom(componentInstance.getChildOutputPorts('child-1'))).toEqual(outputPorts);
+ expect(await firstValueFrom(componentInstance.getChildInputPorts('child-1'))).toEqual(inputPorts);
+ expect(flowService.getFlow).toHaveBeenCalledWith('child-1');
+
+ const payload: CreateConnection = {
+ payload: { revision: { version: 0, clientId: 'client-1' }, component: { name: '' } }
+ };
+ createConnection.emit(payload);
+
+ expect(store.dispatch).toHaveBeenCalledWith(FlowActions.createConnection({ request: payload }));
+ });
+
+ it('removes the temporary edge when the dialog closes', () => {
+ const afterClosed = new Subject<void>();
+ vi.spyOn(dialog, 'open').mockReturnValue({
+ componentInstance: { createConnection: new EventEmitter<CreateConnection>() },
+ afterClosed: () => afterClosed.asObservable()
+ } as unknown as MatDialogRef<unknown>);
+ vi.spyOn(flowService, 'getProcessGroup').mockReturnValue(
+ of({
+ component: {
+ defaultFlowFileExpiration: '0 sec',
+ defaultBackPressureObjectThreshold: 10000,
+ defaultBackPressureDataSizeThreshold: '1 GB'
+ }
+ })
+ );
+ const canvasUtils = TestBed.inject(CanvasUtils);
+ vi.spyOn(canvasUtils, 'removeTempEdge');
+
+ effects.openNewConnectionDialog$.subscribe();
+ action$.next(FlowActions.openNewConnectionDialog({ request }));
+ afterClosed.next();
+
+ expect(canvasUtils.removeTempEdge).toHaveBeenCalled();
+ });
+
+ it('removes the temporary edge when process group defaults fail to load', () => {
+ vi.spyOn(flowService, 'getProcessGroup').mockReturnValue(
+ throwError(() => new HttpErrorResponse({ status: 500 }))
+ );
+ const canvasUtils = TestBed.inject(CanvasUtils);
+ vi.spyOn(canvasUtils, 'removeTempEdge');
+
+ effects.openNewConnectionDialog$.subscribe({ error: () => undefined });
+ action$.next(FlowActions.openNewConnectionDialog({ request }));
+
+ expect(canvasUtils.removeTempEdge).toHaveBeenCalled();
+ });
+ });
+
+ describe('create dialog outputs', () => {
+ const componentRequest: CreateComponentRequest = {
+ type: ComponentType.Processor,
+ position: { x: 0, y: 0 },
+ revision: { version: 0, clientId: 'client-1' }
+ };
+
Review Comment:
This helper does not type-check with `EventEmitter<CreateProcessorRequest>`, `EventEmitter<CreatePortRequest>`, and the other typed emitters because `EventEmitter<T>` cannot be widened to `EventEmitter<unknown>`. `npx tsc -p apps/nifi/tsconfig.spec.json --noEmit` also reports new changed-file errors for the empty/incomplete connection fixtures and the incomplete registry-import payload. Please make this helper generic (or otherwise preserve each emitter type) and update all modified fixtures to satisfy the tightened contracts. Vitest transpilation passing does not validate these TypeScript contracts.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/component-dialogs/create-process-group/create-process-group.component.spec.ts:
##########
@@ -129,6 +120,27 @@ describe('CreateProcessGroup', () => {
fixture.detectChanges();
expect(component.parameterContextsOptions.length).toEqual(2);
});
+
+ it('hides the parameter context selector when supportsParameters is false', () => {
+ component.supportsParameters = false;
+ fixture.detectChanges();
+
+ const select = fixture.debugElement.query(
+ By.css('mat-select[formcontrolname="newProcessGroupParameterContext"]')
+ );
+ expect(select).toBeNull();
+ });
+
+ it('emits a null parameter context id when supportsParameters is false', () => {
+ component.supportsParameters = false;
+ component.createProcessGroupForm.get('newProcessGroupName')?.setValue('child');
+ const emitted: CreateProcessGroupRequest[] = [];
+ component.createProcessGroup.subscribe((request) => emitted.push(request));
+
+ component.submitCreateProcessGroup();
+
+ expect(emitted[0].parameterContextId).toBeNull();
Review Comment:
This verifies `null` only when parameter contexts are unsupported. The normal supported flow also has a valid “No parameter context” selection and should emit `parameterContextId: null`; that path currently has no regression assertion. Please add that case and a corresponding submit/output test in `group-components.component.spec.ts`, which currently only verifies component construction for its default null selection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-16449: Promote canvas create dialogs to reusable output-driven c… [nifi]
Posted by "rfellows (via GitHub)" <gi...@apache.org>.
rfellows merged PR #11798:
URL: https://github.com/apache/nifi/pull/11798
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org