[NIFI-12694] - Fix console errors when starting/stopping process groups (#8317)

This closes #8317
This commit is contained in:
Rob Fellows 2024-01-31 09:36:45 -05:00 committed by GitHub
parent 3116576494
commit 4620afdbc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 10 deletions

View File

@ -68,7 +68,9 @@ import {
UpdateConnectionSuccess,
UpdatePositionsRequest,
UploadProcessGroupRequest,
NavigateToQueueListing
NavigateToQueueListing,
StartProcessGroupResponse,
StopProcessGroupResponse
} from './index';
import { StatusHistoryRequest } from '../../../../state/status-history';
@ -495,6 +497,11 @@ export const startComponentSuccess = createAction(
props<{ response: StartComponentResponse }>()
);
export const startProcessGroupSuccess = createAction(
`${CANVAS_PREFIX} Start Process Group Success`,
props<{ response: StartProcessGroupResponse }>()
);
export const stopComponent = createAction(
`${CANVAS_PREFIX} Stop Component`,
props<{ request: StopComponentRequest | StopProcessGroupRequest }>()
@ -510,6 +517,11 @@ export const stopComponentSuccess = createAction(
props<{ response: StopComponentResponse }>()
);
export const stopProcessGroupSuccess = createAction(
`${CANVAS_PREFIX} Stop Process Group Success`,
props<{ response: StopProcessGroupResponse }>()
);
export const startCurrentProcessGroup = createAction(`${CANVAS_PREFIX} Start Current Process Group`);
export const stopCurrentProcessGroup = createAction(`${CANVAS_PREFIX} Stop Current Process Group`);

View File

@ -2039,7 +2039,7 @@ export class FlowEffects {
this.flowService.startRemoteProcessGroupsInProcessGroup(request)
]).pipe(
map(([startPgResponse]) => {
return FlowActions.startComponentSuccess({
return FlowActions.startProcessGroupSuccess({
response: {
type: request.type,
component: startPgResponse
@ -2061,7 +2061,7 @@ export class FlowEffects {
*/
startCurrentProcessGroupSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowActions.startComponentSuccess),
ofType(FlowActions.startProcessGroupSuccess),
map((action) => action.response),
concatLatestFrom(() => this.store.select(selectCurrentProcessGroupId)),
filter(([response, currentPg]) => response.component.id === currentPg),
@ -2074,10 +2074,9 @@ export class FlowEffects {
*/
startProcessGroupSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowActions.startComponentSuccess),
ofType(FlowActions.startProcessGroupSuccess),
map((action) => action.response),
concatLatestFrom(() => this.store.select(selectCurrentProcessGroupId)),
filter(([response]) => response.type === ComponentType.ProcessGroup),
filter(([response, currentPg]) => response.component.id !== currentPg),
switchMap(([response]) =>
of(
@ -2156,7 +2155,7 @@ export class FlowEffects {
this.flowService.stopRemoteProcessGroupsInProcessGroup(request)
]).pipe(
map(([stopPgResponse]) => {
return FlowActions.stopComponentSuccess({
return FlowActions.stopProcessGroupSuccess({
response: {
type: request.type,
component: stopPgResponse
@ -2178,7 +2177,7 @@ export class FlowEffects {
*/
stopCurrentProcessGroupSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowActions.stopComponentSuccess),
ofType(FlowActions.stopProcessGroupSuccess),
map((action) => action.response),
concatLatestFrom(() => this.store.select(selectCurrentProcessGroupId)),
filter(([response, currentPg]) => response.component.id === currentPg),
@ -2191,10 +2190,9 @@ export class FlowEffects {
*/
stopProcessGroupSuccess$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowActions.stopComponentSuccess),
ofType(FlowActions.stopProcessGroupSuccess),
map((action) => action.response),
concatLatestFrom(() => this.store.select(selectCurrentProcessGroupId)),
filter(([response]) => response.type === ComponentType.ProcessGroup),
filter(([response, currentPg]) => response.component.id !== currentPg),
switchMap(([response]) =>
of(

View File

@ -30,6 +30,7 @@ import {
flowApiError,
groupComponents,
groupComponentsSuccess,
loadChildProcessGroupSuccess,
loadConnectionSuccess,
loadInputPortSuccess,
loadProcessGroup,
@ -37,7 +38,6 @@ import {
loadProcessorSuccess,
loadRemoteProcessGroupSuccess,
navigateWithoutTransform,
loadChildProcessGroupSuccess,
resetFlowState,
runOnce,
runOnceSuccess,
@ -333,6 +333,7 @@ export const flowReducer = createReducer(
draftState.saving = false;
});
}),
on(runOnceSuccess, (state, { response }) => {
return produce(state, (draftState) => {
const collection: any[] | null = getComponentCollection(draftState, ComponentType.Processor);

View File

@ -510,6 +510,22 @@ export interface StartComponentResponse {
component: ComponentEntity;
}
export interface StartProcessGroupResponse {
type: ComponentType;
component: {
id: string;
state: string;
};
}
export interface StopProcessGroupResponse {
type: ComponentType;
component: {
id: string;
state: string;
};
}
export interface StartComponentsResponse {
components: StartComponentsResponse[];
}