rfellows commented on code in PR #11946: URL: https://github.com/apache/nifi/pull/11946#discussion_r4741511931
########## nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/tooltips/drain-summary-tip/drain-summary-tip.component.scss: ########## @@ -0,0 +1,20 @@ +/* + * 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. + */ + +.tooltip { + min-width: 240px; Review Comment: Removed; the scss is just the license header now. ########## nifi-frontend/src/main/frontend/libs/shared/src/components/status-badge/status-badge.component.scss: ########## @@ -19,6 +19,7 @@ .status-badge { .fa { + font-size: var(--mat-sys-body-small-size); Review Comment: Agreed it should match the spec, but it changes every status badge in the app, so I've left it out of this PR to keep that change separate and easy to review on its own. ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/process-group-drain/process-group-drain.effects.ts: ########## @@ -0,0 +1,356 @@ +/* + * 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 { Injectable, inject } from '@angular/core'; +import { Actions, createEffect, ofType } from '@ngrx/effects'; +import { concatLatestFrom } from '@ngrx/operators'; +import { Action, Store } from '@ngrx/store'; +import { HttpErrorResponse } from '@angular/common/http'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { NavigationStart, Router } from '@angular/router'; +import { + asyncScheduler, + catchError, + exhaustMap, + filter, + from, + interval, + map, + of, + switchMap, + take, + takeUntil, + tap +} from 'rxjs'; +import { + ComponentType, + DrainBlockingComponentType, + isDefinedAndNotNull, + MEDIUM_DIALOG, + SMALL_DIALOG, + YesNoDialog +} from '@nifi/shared'; +import * as ProcessGroupDrainActions from './process-group-drain.actions'; +import * as FlowActions from '../flow/flow.actions'; +import * as ErrorActions from '../../../../state/error/error.actions'; +import { + selectDrainDialogState, + selectDrainProcessGroupId, + selectDrainRequestId +} from './process-group-drain.selectors'; +import { selectCurrentProcessGroupId } from '../flow/flow.selectors'; +import { ProcessGroupDrainService } from '../../../../service/process-group-drain.service'; +import { ErrorHelper } from '../../../../service/error-helper.service'; +import { DrainProcessGroupDialog } from '../../../../ui/common/drain-process-group-dialog/drain-process-group-dialog'; +import { NiFiState } from '../../../../state'; + +const COMPONENT_TYPES: Record<DrainBlockingComponentType, ComponentType> = { + PROCESSOR: ComponentType.Processor, + INPUT_PORT: ComponentType.InputPort, + OUTPUT_PORT: ComponentType.OutputPort, + REMOTE_INPUT_PORT: ComponentType.RemoteProcessGroup +}; + +const POLLING_STOP_ACTIONS = [ + ProcessGroupDrainActions.drainEnded, + ProcessGroupDrainActions.cancelDrain, + ProcessGroupDrainActions.resetDrainState, + ProcessGroupDrainActions.drainApiError +] as const; + +@Injectable() +export class ProcessGroupDrainEffects { + private actions$ = inject(Actions); + private store = inject<Store<NiFiState>>(Store); + private processGroupDrainService = inject(ProcessGroupDrainService); + private errorHelper = inject(ErrorHelper); + private dialog = inject(MatDialog); + private router = inject(Router); + + private drainDialogRef: MatDialogRef<DrainProcessGroupDialog> | undefined; + private lastPrepared = false; + + promptDrain$ = createEffect( + () => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.promptDrain), + map((action) => action.request), + tap((request) => { + const dialogReference = this.dialog.open(YesNoDialog, { + ...SMALL_DIALOG, + data: { + title: 'Drain Process Group', + message: + 'Drain stops the components that bring data into this Process Group, enables the Controller Services its components reference, and starts the other components so the queued data can flow out. The drain ends when the group is empty or when you cancel it. Components keep their run state afterwards, so sources remain stopped. Are you sure you want to drain this Process Group?' + } + }); + + dialogReference.componentInstance.yes.pipe(take(1)).subscribe(() => { + this.store.dispatch(ProcessGroupDrainActions.beginDrain({ request })); + }); + }) + ), + { dispatch: false } + ); + + beginDrain$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.beginDrain), + map((action) => action.request), + switchMap((request) => + this.processGroupDrainService.beginDrain(request.processGroupId).pipe( + map((response) => + ProcessGroupDrainActions.beginDrainSuccess({ + response: { drainRequestEntity: response } + }) + ), + catchError((errorResponse: HttpErrorResponse) => this.handleDrainApiError(errorResponse)) + ) + ) + ) + ); + + beginDrainSuccess$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.beginDrainSuccess), + concatLatestFrom(() => [ + this.store.select(selectDrainProcessGroupId), + this.store.select(selectCurrentProcessGroupId) + ]), + switchMap(([action, processGroupId, currentProcessGroupId]) => { + this.lastPrepared = action.response.drainRequestEntity.drainRequest?.prepared === true; + const drainRequest = action.response.drainRequestEntity.drainRequest; + // drainEnded$ performs the reload when the drain has already ended, so the group is reloaded once + if (!drainRequest || drainRequest.state !== 'DRAINING') { + return of(ProcessGroupDrainActions.drainEnded()); + } + return from([ + this.reloadProcessGroupAction(processGroupId, currentProcessGroupId), + ProcessGroupDrainActions.startPollingDrain() + ]); + }) + ) + ); + + openDrainDialog$ = createEffect( + () => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.beginDrainSuccess, ProcessGroupDrainActions.viewDrain), + tap(() => { + if (this.drainDialogRef) { + return; + } + + const dialogReference = this.dialog.open(DrainProcessGroupDialog, { + ...MEDIUM_DIALOG, + disableClose: true, + autoFocus: false + }); + this.drainDialogRef = dialogReference; + + dialogReference.componentInstance.drainState$ = this.store.select(selectDrainDialogState); + + dialogReference.componentInstance.cancelDrain + .pipe(takeUntil(dialogReference.afterClosed())) + .subscribe(() => { + this.store.dispatch(ProcessGroupDrainActions.cancelDrain()); + }); + + dialogReference.componentInstance.goToComponent + .pipe(takeUntil(dialogReference.afterClosed())) + .subscribe((component) => { + this.store.dispatch(ProcessGroupDrainActions.goToBlockingComponent({ component })); + }); + + dialogReference.afterClosed().subscribe(() => { + this.drainDialogRef = undefined; + this.lastPrepared = false; + this.store.dispatch(ProcessGroupDrainActions.resetDrainState()); + }); + }) + ), + { dispatch: false } + ); + + viewDrain$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.viewDrain), + map(() => ProcessGroupDrainActions.startPollingDrain()) + ) + ); + + // viewDrain reaches this effect through viewDrain$, which dispatches startPollingDrain. Listening + // for both would still be a single interval because switchMap replaces the previous one, but it + // would restart the timer on every View. + startPollingDrain$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.startPollingDrain), + switchMap(() => + interval(2000, asyncScheduler).pipe(takeUntil(this.actions$.pipe(ofType(...POLLING_STOP_ACTIONS)))) + ), + map(() => ProcessGroupDrainActions.pollDrain()) + ) + ); + + pollDrain$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.pollDrain, ProcessGroupDrainActions.viewDrain), + concatLatestFrom(() => [ + this.store.select(selectDrainProcessGroupId).pipe(isDefinedAndNotNull()), + this.store.select(selectDrainRequestId).pipe(isDefinedAndNotNull()) + ]), + exhaustMap(([, processGroupId, drainRequestId]) => + this.processGroupDrainService.getDrain(processGroupId, drainRequestId).pipe( + map((response) => + ProcessGroupDrainActions.pollDrainSuccess({ + response: { drainRequestEntity: response } + }) + ), + catchError((errorResponse: HttpErrorResponse) => this.handleDrainApiError(errorResponse)), + takeUntil(this.actions$.pipe(ofType(...POLLING_STOP_ACTIONS))) + ) + ) + ) + ); + + pollDrainSuccess$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.pollDrainSuccess), + concatLatestFrom(() => [ + this.store.select(selectDrainProcessGroupId), + this.store.select(selectCurrentProcessGroupId) + ]), + switchMap(([action, processGroupId, currentProcessGroupId]) => { + const drainRequest = action.response.drainRequestEntity.drainRequest; + const actions: Action[] = []; + const isDraining = drainRequest?.state === 'DRAINING'; + const prepared = drainRequest?.prepared === true; + // An ended drain is reloaded by drainEnded$, so the prepared flip only reloads while draining + if (isDraining && prepared && !this.lastPrepared) { + actions.push(this.reloadProcessGroupAction(processGroupId, currentProcessGroupId)); + } + this.lastPrepared = prepared; + if (!isDraining) { + actions.push(ProcessGroupDrainActions.drainEnded()); + } + return from(actions); + }) + ) + ); + + drainEnded$ = createEffect(() => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.drainEnded, ProcessGroupDrainActions.cancelDrainSuccess), + concatLatestFrom(() => [ + this.store.select(selectDrainProcessGroupId), + this.store.select(selectCurrentProcessGroupId) + ]), + map(([, processGroupId, currentProcessGroupId]) => + this.reloadProcessGroupAction(processGroupId, currentProcessGroupId) Review Comment: Done. For the current group, the end-of-drain path now dispatches `loadProcessGroup` directly, so the `reloadFlow` throttle can't drop it. A spec covers a drain ending right after a prepared-flip reload, plus the child-group case. ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/service/flow.service.ts: ########## @@ -403,18 +403,6 @@ export class FlowService implements PropertyDescriptorRetriever { return this.httpClient.put(`${FlowService.API}/flow/process-groups/${request.id}`, stopRequest); } - stopSources(request: StopSourcesRequest): Observable<StopSourcesResponse> { Review Comment: Yes, intentional. Stop Sources was our first take on this and didn't work well as a user-facing action, so Drain replaces it in the context menu. The REST endpoint is unchanged. I've added the reasoning to the PR description. ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/drain-process-group-dialog/drain-process-group-dialog.html: ########## @@ -0,0 +1,101 @@ +<!-- + ~ 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. + --> + +<h2 mat-dialog-title>Drain Process Group</h2> +@if (drainState$ | async; as drainState) { + @if (getFailureMessages(drainState.drainRequest?.failureReason); as failureMessages) { + @if (failureMessages.length > 0) { + <error-banner [messages]="failureMessages" [showErrorIcon]="true" [allowDismiss]="false"></error-banner> + } + } + <div class="drain-process-group"> + <mat-dialog-content> + <div class="flex flex-col gap-y-4"> + <div class="tertiary-color font-medium" data-qa="drain-status-message"> + {{ getStatusMessage(drainState) }} + </div> + @if (drainState.drainRequest; as drainRequest) { + <div class="w-full flex flex-col items-center"> + <mat-progress-bar + [mode]="isProgressIndeterminate(drainRequest) ? 'indeterminate' : 'determinate'" + [value]="getPercentCompleted(drainRequest)"></mat-progress-bar> + <div class="tertiary-color font-medium" data-qa="drain-remaining"> + {{ getRemainingText(drainRequest) }} + </div> + </div> + @if (drainRequest.blockingComponents.length > 0) { + <div class="flex flex-col gap-y-2"> + <status-banner variant="caution" [allowDismiss]="false" data-qa="drain-blocking-banner"> + <div statusBannerTitle>{{ getBlockingBannerTitle(drainState) }}</div> + <div statusBannerDescription> + Queued data cannot leave until the components below are fixed. + </div> + </status-banner> + @for (component of drainRequest.blockingComponents; track component.id) { + <div class="flex items-center gap-x-2" data-qa="drain-blocking-component"> + @if (getBlockingTooltipComponent(component); as tooltipComponent) { + <div + class="fa fa-warning caution-color" + data-qa="drain-blocking-component-warning" + nifiTooltip + [tooltipComponentType]="tooltipComponent" + [tooltipInputData]="getBlockingTooltipData(component)" + [delayClose]="true"></div> + } @else { + <div + class="fa fa-warning caution-color" + data-qa="drain-blocking-component-warning"></div> + } + <div class="flex-1"> + @if (drainState.status === 'ended') { + <a + class="pointer primary-color" + data-qa="drain-go-to" + (click)="goToComponent.next(component)" + >{{ getBlockingComponentLabel(component) }}</a + > Review Comment: Done. The warning icons have `role="img"` and `aria-label="Warning"`. The Go To link has `role="button"` and `tabindex="0"`, and activates on Enter and Space; the dialog spec covers both keys. ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/process-group-drain/process-group-drain.effects.ts: ########## @@ -0,0 +1,356 @@ +/* + * 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 { Injectable, inject } from '@angular/core'; +import { Actions, createEffect, ofType } from '@ngrx/effects'; +import { concatLatestFrom } from '@ngrx/operators'; +import { Action, Store } from '@ngrx/store'; +import { HttpErrorResponse } from '@angular/common/http'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; +import { NavigationStart, Router } from '@angular/router'; +import { + asyncScheduler, + catchError, + exhaustMap, + filter, + from, + interval, + map, + of, + switchMap, + take, + takeUntil, + tap +} from 'rxjs'; +import { + ComponentType, + DrainBlockingComponentType, + isDefinedAndNotNull, + MEDIUM_DIALOG, + SMALL_DIALOG, + YesNoDialog +} from '@nifi/shared'; +import * as ProcessGroupDrainActions from './process-group-drain.actions'; +import * as FlowActions from '../flow/flow.actions'; +import * as ErrorActions from '../../../../state/error/error.actions'; +import { + selectDrainDialogState, + selectDrainProcessGroupId, + selectDrainRequestId +} from './process-group-drain.selectors'; +import { selectCurrentProcessGroupId } from '../flow/flow.selectors'; +import { ProcessGroupDrainService } from '../../../../service/process-group-drain.service'; +import { ErrorHelper } from '../../../../service/error-helper.service'; +import { DrainProcessGroupDialog } from '../../../../ui/common/drain-process-group-dialog/drain-process-group-dialog'; +import { NiFiState } from '../../../../state'; + +const COMPONENT_TYPES: Record<DrainBlockingComponentType, ComponentType> = { + PROCESSOR: ComponentType.Processor, + INPUT_PORT: ComponentType.InputPort, + OUTPUT_PORT: ComponentType.OutputPort, + REMOTE_INPUT_PORT: ComponentType.RemoteProcessGroup +}; + +const POLLING_STOP_ACTIONS = [ + ProcessGroupDrainActions.drainEnded, + ProcessGroupDrainActions.cancelDrain, + ProcessGroupDrainActions.resetDrainState, + ProcessGroupDrainActions.drainApiError +] as const; + +@Injectable() +export class ProcessGroupDrainEffects { + private actions$ = inject(Actions); + private store = inject<Store<NiFiState>>(Store); + private processGroupDrainService = inject(ProcessGroupDrainService); + private errorHelper = inject(ErrorHelper); + private dialog = inject(MatDialog); + private router = inject(Router); + + private drainDialogRef: MatDialogRef<DrainProcessGroupDialog> | undefined; + private lastPrepared = false; + + promptDrain$ = createEffect( + () => + this.actions$.pipe( + ofType(ProcessGroupDrainActions.promptDrain), + map((action) => action.request), + tap((request) => { + const dialogReference = this.dialog.open(YesNoDialog, { + ...SMALL_DIALOG, + data: { + title: 'Drain Process Group', + message: + 'Drain stops the components that bring data into this Process Group, enables the Controller Services its components reference, and starts the other components so the queued data can flow out. The drain ends when the group is empty or when you cancel it. Components keep their run state afterwards, so sources remain stopped. Are you sure you want to drain this Process Group?' Review Comment: Done, split into shorter sentences. I kept one sentence about enabling referenced Controller Services and starting the other components, since that's the part users might not expect: > Drain stops the components that bring data into this Process Group and lets the queued data flow out. Referenced Controller Services are enabled and the other components are started. Components keep their run state afterwards, so sources remain stopped. Are you sure you want to drain this Process Group? ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/testing/process-group-drain-fixture.ts: ########## @@ -0,0 +1,80 @@ +/* + * 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 { + DrainBlockingComponent, + ProcessGroupDrainRequest, + ProcessGroupDrainRequestEntity, + ProcessGroupDrainSummary +} from '@nifi/shared'; + +export function createDrainBlockingComponent(overrides: Partial<DrainBlockingComponent> = {}): DrainBlockingComponent { + return { + id: 'processor-1', + groupId: 'pg-1', + type: 'PROCESSOR', + name: 'GenerateFlowFile', + reason: 'INVALID', + validationErrors: ["'Run Schedule' is invalid"], + queuedCount: 3, + ...overrides + }; +} + +export function createProcessGroupDrainSummary( + overrides: Partial<ProcessGroupDrainSummary> = {} +): ProcessGroupDrainSummary { + return { + id: 'drain-1', + prepared: true, + originalCount: 10, + originalSize: 1024, + currentCount: 4, + currentSize: 400, + ...overrides + }; +} + +export function createProcessGroupDrainRequest( + overrides: Partial<ProcessGroupDrainRequest> = {} +): ProcessGroupDrainRequest { + return { + id: 'drain-1', + processGroupId: 'pg-1', + uri: '../nifi-api/process-groups/pg-1/drain-requests/drain-1', + state: 'DRAINING', + prepared: true, + originalCount: 10, + originalSize: 1024, + currentCount: 4, + currentSize: 400, + blockingComponents: [], + ...overrides + }; +} + +export function createProcessGroupDrainRequestEntity( + drainRequestOverrides: Partial<ProcessGroupDrainRequest> | null = {} +): ProcessGroupDrainRequestEntity { + if (drainRequestOverrides === null) { + return {}; + } Review Comment: Replaced the `null` sentinel with `createEmptyDrainRequestEntity()`. I kept the `testing/` directory, since ten specs share these factories (the drain slice, service, dialog, summary utils, tooltip, both Operate panels and `CanvasUtils`). ########## nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/drain/drain-summary.utils.ts: ########## @@ -0,0 +1,85 @@ +/* + * 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 { NiFiCommon, ProcessGroupDrainSummary } from '@nifi/shared'; + +export const DRAINING_DESCRIPTION = 'This Process Group is being drained.'; + +export const DRAIN_WAITING_FOR_SOURCES = 'Waiting for source components to stop.'; + +export const DRAIN_NO_FLOWFILES_REMAIN = 'No FlowFiles remain.'; + +/** + * Percent of the original queue that has already drained. + */ +export function getDrainPercentCompleted(originalCount: number, currentCount: number): number { + if (originalCount === 0) { + return 100; + } + return Math.min(Math.max(Math.round(((originalCount - currentCount) * 100) / originalCount), 0), 100); +} + +export function getDrainRemainingText( + summary: Pick<ProcessGroupDrainSummary, 'currentCount' | 'currentSize' | 'originalCount'>, + nifiCommon: NiFiCommon +): string { + const currentCount = nifiCommon.formatInteger(summary.currentCount); + const currentSize = nifiCommon.formatDataSize(summary.currentSize); + const originalCount = nifiCommon.formatInteger(summary.originalCount); + return `${currentCount} FlowFiles (${currentSize}) remaining of ${originalCount}`; +} + +/** + * One-sentence progress detail shared by the canvas drain tooltip and the operate panel tooltip. + */ +export function getDrainStatusDetail(summary: ProcessGroupDrainSummary, nifiCommon: NiFiCommon): string { + if (!summary.prepared) { + return DRAIN_WAITING_FOR_SOURCES; + } + if (summary.currentCount === 0) { + return DRAIN_NO_FLOWFILES_REMAIN; + } + return `${getDrainRemainingText(summary, nifiCommon)}.`; +} + +/** + * Text tooltip for the operate panel Draining badge. + */ +export function getDrainingTooltip(summary: ProcessGroupDrainSummary | null, nifiCommon: NiFiCommon): string { + if (!summary) { + return DRAINING_DESCRIPTION; + } + return `${DRAINING_DESCRIPTION} ${getDrainStatusDetail(summary, nifiCommon)}`; +} + +/** + * Drain summary the operate panel reflects: the current group when nothing is selected, the + * selected group when exactly one Process Group is selected, and none otherwise. + */ +export function getOperationDrainSummary( Review Comment: Agreed this would help. It needs the backend to expose the inherited drain, so it's out of scope for this frontend PR. Until then, a user inside a child of the drained group sees the server's rejection message when Start or Stop is refused. -- 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]
