rfellows opened a new pull request, #11946: URL: https://github.com/apache/nifi/pull/11946
# Summary [NIFI-16576](https://issues.apache.org/jira/browse/NIFI-16576) > [!IMPORTANT] > **Do not merge until [NIFI-16575 / apache/nifi#11914](https://github.com/apache/nifi/pull/11914) is merged.** > > This PR is the frontend for Process Group drain. It depends on #11914 for: > - the drain-request REST endpoints (`/process-groups/{id}/drain-requests`) > - the entity-level `drainSummary` (`ProcessGroupDrainSummaryDTO` on `ProcessGroupEntity` and `ProcessGroupFlowDTO`) > > The frontend compiles and its tests pass without #11914, because the DTOs are TypeScript copies in `libs/shared`. The feature does not work at runtime without it, so you need the #11914 backend running to test. The `@nifi-revision` / `@vetted` headers on the new entity type files will be finalized after #11914 merges. This PR adds a UI to drain a Process Group. A drain stops the group's sources and lets the queued FlowFiles finish processing. Users can start a drain, watch its progress, and see what is blocking it. Drain state shows on the canvas and in the Operate panels, even for groups the user cannot read. ## Changes All changes are under `nifi-frontend/src/main/frontend` (Nx projects `nifi` and `shared`). **Drain dialog and state** - New `ui/common/drain-process-group-dialog`. It shows: a progress bar, indeterminate until the drain is prepared; the number of FlowFiles left; blocking components, with tooltips and go-to links; failure messages; **Cancel Drain** while the drain runs, and **Close** once it has ended. - New `process-group-drain` NgRx slice (actions, reducer, effects, selectors) that polls the drain request. - New `ProcessGroupDrainService` in `app/service`. Every dynamic path segment goes through `safeApiPath`. - Drain DTO types live in `libs/shared` (`process-group-drain-summary.ts`, `process-group-drain-request-entity.ts`). - Shared drain copy and progress math live in `ui/common/drain/drain-summary.utils.ts`. **Context menu** - Adds **Drain** and **View Drain** to the flow designer context menu. - ⚠️ **Drain replaces the old Stop Sources menu action.** **Drain state on the canvas and in the Operate panels** - Drain state comes from the entity-level `drainSummary`, so it shows even without read permission on the group. - Process group tiles show an SVG **Draining** badge (flow designer `ProcessGroupManager` and reusable `ProcessGroupRenderer`). - Hovering the badge opens a new `DrainSummaryTip` tooltip with a title, a static progress bar, and a status line. - Both Operate panels show a **Draining** status badge with a text tooltip. - The connector canvas shows the badges and the current group's drain in its Operate panel. It cannot start a drain, because the backend rejects connector-managed groups. **Canvas tooltip infrastructure (affects all canvas tooltips)** - `CanvasUtils` and `CanvasComponentUtils` now share `canvas-tooltip-overlay.ts`, one session per element (`WeakMap`). An open canvas tooltip now updates in place on poll re-render, opens with the latest data, and is cleaned up on reset. - ⚠️ Applies to every canvas overlay tooltip: bulletins, validation errors, comments, version control, connection tips. Please check these still behave as before. **`libs/shared` status-badge** - Info icon is now `fa-info-circle`, sized with `--mat-sys-body-small-size`; renders only when `message` is set. **Tests** - Unit tests cover the drain dialog, NgRx slice, service, summary utils, context menu, canvas badges, and tooltip overlay. - Drain test fixtures live in one place, `apps/nifi/src/app/testing/process-group-drain-fixture.ts`; the drain selectors spec builds its state inline. ## How to test These steps require a NiFi instance running the #11914 backend. 1. Create a Process Group with a source processor feeding a downstream connection, and let FlowFiles queue up. 2. Right-click the group and choose **Drain**. The dialog shows an indeterminate progress bar until the drain is prepared, then the FlowFiles remaining, any blocking components (with tooltips and go-to links), and **Cancel Drain**. 3. Close the dialog. The group tile shows a **Draining** badge. Hover it: the tooltip shows a title, progress bar, and status line, and it refreshes in place while open. 4. Right-click the group and choose **View Drain**. The dialog reopens on the active drain. 5. Select the group and open the Operate panel. It shows a **Draining** status badge with a tooltip. Do the same from inside the group to check the current-group Operate panel. 6. Click **Cancel Drain**. The dialog shows the ended state with **Close**, and the canvas and Operate panel badges clear. 7. As a user without read permission on the group, start or keep a drain running and confirm the badge still shows. 8. On a connector canvas with a draining group, confirm the badge and Operate panel status show, and that **Drain** is not offered. 9. Spot-check other canvas tooltips (bulletins, validation errors, comments, version control, connection tips) and confirm they behave as before. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
