mcgilman commented on code in PR #8216:
URL: https://github.com/apache/nifi/pull/8216#discussion_r1445512557
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts:
##########
@@ -2056,4 +2057,207 @@ export class FlowEffects {
),
{ dispatch: false }
);
+
+ startCurrentProcessGroup$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startCurrentProcessGroup),
+ withLatestFrom(this.store.select(selectCurrentProcessGroupId)),
+ switchMap(([, pgId]) => {
+ return of(
+ FlowActions.startComponent({
+ request: {
+ id: pgId,
+ type: ComponentType.ProcessGroup
+ }
+ })
+ );
+ }),
+ catchError((error) => of(FlowActions.flowApiError({ error:
error.error })))
+ )
+ );
+
+ startComponents$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startComponents),
+ map((action) => action.request),
+ mergeMap((request) => [
+ ...request.components.map((component) => {
+ return FlowActions.startComponent({
+ request: component
+ });
+ })
+ ])
+ )
+ );
+
+ startComponent$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startComponent),
+ map((action) => action.request),
+ mergeMap((request) => {
+ switch (request.type) {
+ case ComponentType.InputPort:
+ case ComponentType.OutputPort:
+ case ComponentType.Processor:
+ case ComponentType.RemoteProcessGroup:
+ if ('uri' in request && 'revision' in request) {
+ return
from(this.flowService.startComponent(request)).pipe(
+ map((response) => {
+ return FlowActions.startComponentSuccess({
+ response: {
+ type: request.type,
+ component: response
+ }
+ });
+ })
+ );
+ }
+ return of(
+ FlowActions.flowApiError({
+ error: `Starting ${request.type} requires both
uri and revision properties`
+ })
+ );
+ case ComponentType.ProcessGroup:
+ return combineLatest([
+ this.flowService.startProcessGroup(request),
+
this.flowService.startRemoteProcessGroupsInProcessGroup(request)
+ ]).pipe(
+ map(([startPgResponse]) => {
+ return FlowActions.startComponentSuccess({
+ response: {
+ type: request.type,
+ component: startPgResponse
+ }
+ });
+ })
+ );
+ default:
+ return of(FlowActions.flowApiError({ error:
`${request.type} does not support starting` }));
+ }
+ }),
+ catchError((error) => of(FlowActions.flowApiError({ error:
error.error })))
+ )
+ );
+
+ startComponentSuccess$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startComponentSuccess),
+ debounceTime(200), // may be starting many at a time, debounce to
reduce attempts to reload the flow
Review Comment:
I think your most recent commit makes this entire suggestion unneeded.
--
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]