mcgilman commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1487935809
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts:
##########
@@ -740,8 +741,15 @@ export class CanvasContextMenu implements
ContextMenuDefinitionProvider {
},
clazz: 'fa fa-refresh',
text: 'Refresh remote',
- action: () => {
- // TODO - refreshRemoteFlow
+ action: (selection: any) => {
+ const d = selection.datum();
Review Comment:
The condition for both this action and the condition for `Go To` need to be
updated to also check `this.canvasUtils.canRead(selection)`.
##########
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:
##########
@@ -348,14 +352,78 @@ export class FlowEffects {
this.flowService.goToRemoteProcessGroup(request);
} else {
this.store.dispatch(
- showOkDialog({ title: 'Remote Process Group',
message: 'No target URI defined.' })
+ FlowActions.showOkDialog({
+ title: 'Remote Process Group',
+ message: 'No target URI defined.'
+ })
);
}
})
),
{ dispatch: false }
);
+ startRemoteProcessGroupPolling$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startRemoteProcessGroupPolling),
+ switchMap((request) => {
+ return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+ );
+ }),
+ switchMap(() => {
+ return of(FlowActions.refreshRemoteProcessGroup());
+ })
+ )
+ );
+
+ requestRemoteProcessGroupPolling$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.requestRemoteProcessGroupPolling),
+ switchMap(() => {
+ return of(FlowActions.startRemoteProcessGroupPolling());
+ })
+ )
+ );
+
+ refreshRemoteProcessGroup$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.refreshRemoteProcessGroup),
+ concatLatestFrom(() => this.store.select(selectRpgToPoll)),
+ map(([, rpgToPoll]) => {
+ return rpgToPoll;
+ }),
+ isDefinedAndNotNull(),
+ switchMap((rpgToPoll) =>
+ from(
+ this.flowService.getRemoteProcessGroup(rpgToPoll.id).pipe(
+ map((response: any) => {
+ const entity = response;
+
+ if (rpgToPoll.refreshTimestamp !==
response.component.flowRefreshed) {
+
this.store.dispatch(FlowActions.stopRemoteProcessGroupPolling());
+ } else {
+ entity.component.flowRefreshed =
'Refreshing...';
+ }
+
+ return FlowActions.loadRemoteProcessGroupSuccess({
+ response: {
+ id: entity.id,
+ remoteProcessGroup: entity
+ }
+ });
+ }),
+ catchError((errorResponse: HttpErrorResponse) => {
+
this.store.dispatch(FlowActions.stopRemoteProcessGroupPolling());
+
+ return
of(this.errorHelper.handleLoadingError(status, errorResponse));
Review Comment:
`status` isn't defined here. I understand that error handling has not been
introduced in this `FlowEffects` yet (there is a line item for it in
NIFI-12400). But the `hanldingLoadingError` method was meant to handle errors
loading the initial state. In addition to stopping polling, I suspect that here
we would want to check if the error is one that should be shown in context and
let that drive whether we want a snackbar or full screen error.
##########
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:
##########
@@ -348,14 +352,78 @@ export class FlowEffects {
this.flowService.goToRemoteProcessGroup(request);
} else {
this.store.dispatch(
- showOkDialog({ title: 'Remote Process Group',
message: 'No target URI defined.' })
+ FlowActions.showOkDialog({
+ title: 'Remote Process Group',
+ message: 'No target URI defined.'
+ })
);
}
})
),
{ dispatch: false }
);
+ startRemoteProcessGroupPolling$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.startRemoteProcessGroupPolling),
+ switchMap((request) => {
+ return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+ );
+ }),
+ switchMap(() => {
+ return of(FlowActions.refreshRemoteProcessGroup());
+ })
+ )
+ );
+
+ requestRemoteProcessGroupPolling$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.requestRemoteProcessGroupPolling),
+ switchMap(() => {
+ return of(FlowActions.startRemoteProcessGroupPolling());
+ })
+ )
+ );
+
+ refreshRemoteProcessGroup$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowActions.refreshRemoteProcessGroup),
+ concatLatestFrom(() => this.store.select(selectRpgToPoll)),
+ map(([, rpgToPoll]) => {
+ return rpgToPoll;
+ }),
+ isDefinedAndNotNull(),
Review Comment:
I think this can be replaced with
`concatLatestFrom(() =>
this.store.select(selectRpgToPoll).pipe(isDefinedAndNotNull()),`
--
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]