mcgilman commented on code in PR #8965:
URL: https://github.com/apache/nifi/pull/8965#discussion_r2019489992
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts:
##########
@@ -658,6 +659,98 @@ export class ControllerServicesEffects {
{ dispatch: false }
);
+ openMoveControllerServiceDialog$ = createEffect(
+ () =>
+ this.actions$.pipe(
+
ofType(ControllerServicesActions.openMoveControllerServiceDialog),
+ map((action) => action.request),
+ switchMap((request) =>
+
from(this.controllerServiceService.getMoveOptions(request.controllerService.id)).pipe(
+ map((response: SelectOption[]) => {
+ const moveDialogReference =
this.dialog.open(MoveControllerService, {
+ ...LARGE_DIALOG,
+ data: {
+ controllerService:
request.controllerService,
+ options: response
+ }
+ });
+
+
moveDialogReference.componentInstance.goToReferencingComponent = (
+ component:
ControllerServiceReferencingComponent
+ ) => {
+ const route: string[] =
this.getRouteForReference(component);
+ this.router.navigate(route);
+ };
+
+
moveDialogReference.afterClosed().subscribe((response) => {
+ if (response != 'ROUTED') {
+ this.store.dispatch(
+
ControllerServicesActions.loadControllerServices({
+ request: {
+ processGroupId:
request.controllerService.parentGroupId!
+ }
+ })
+ );
+ }
+ });
+ }),
+ tap({
+ error: (errorResponse: HttpErrorResponse) => {
+ this.dialog.closeAll();
+ this.store.dispatch(
+ ErrorActions.snackBarError({
+ error:
this.errorHelper.getErrorString(errorResponse)
+ })
+ );
+ }
+ })
+ )
+ )
+ ),
+ { dispatch: false }
+ );
Review Comment:
```suggestion
openMoveControllerServiceDialog$ = createEffect(
() =>
this.actions$.pipe(
ofType(ControllerServicesActions.openMoveControllerServiceDialog),
map((action) => action.request),
switchMap((request) =>
from(this.controllerServiceService.getMoveOptions(request.controllerService.id)).pipe(
map((options: SelectOption[]) => {
return { request, options };
}),
tap({
error: (errorResponse: HttpErrorResponse) => {
this.store.dispatch(
ErrorActions.snackBarError({
error:
this.errorHelper.getErrorString(errorResponse)
})
);
}
})
)
),
tap(({ request, options }) => {
const moveDialogReference =
this.dialog.open(MoveControllerService, {
...LARGE_DIALOG,
data: {
controllerService: request.controllerService,
options
}
});
moveDialogReference.componentInstance.goToReferencingComponent = (
component: ControllerServiceReferencingComponent
) => {
const route: string[] =
this.getRouteForReference(component);
this.router.navigate(route);
};
moveDialogReference.afterClosed().subscribe((response)
=> {
if (response != 'ROUTED') {
this.store.dispatch(
ControllerServicesActions.loadControllerServices({
request: {
processGroupId:
request.controllerService.parentGroupId!
}
})
);
}
});
})
),
{ dispatch: false }
);
```
Here's a suggestion for the effect for querying for the available options
prior to opening the dialog.
--
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]