Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


mcgilman merged PR #8401:
URL: https://github.com/apache/nifi/pull/8401


-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


scottyaslan commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1492604164


##
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:
##
@@ -359,6 +363,70 @@ export class FlowEffects {
 { dispatch: false }
 );
 
+startRemoteProcessGroupPolling$ = createEffect(() =>
+this.actions$.pipe(
+ofType(FlowActions.startRemoteProcessGroupPolling),
+switchMap(() => {
+return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+);
+}),
+switchMap(() => {
+return of(FlowActions.refreshRemoteProcessGroup());
+})
+)
+);
+
+requestRemoteProcessGroup$ = createEffect(() =>

Review Comment:
   That's what I get for trying to use the IDE refactor/rename feature! LOL!



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-16 Thread via GitHub


mcgilman commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1491549684


##
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:
##
@@ -113,7 +116,8 @@ export class FlowEffects {
 private router: Router,
 private dialog: MatDialog,
 private propertyTableHelperService: PropertyTableHelperService,
-private parameterHelperService: ParameterHelperService
+private parameterHelperService: ParameterHelperService,
+private errorHelper: ErrorHelper

Review Comment:
   This is unused.



##
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:
##
@@ -359,6 +363,70 @@ export class FlowEffects {
 { dispatch: false }
 );
 
+startRemoteProcessGroupPolling$ = createEffect(() =>
+this.actions$.pipe(
+ofType(FlowActions.startRemoteProcessGroupPolling),
+switchMap(() => {
+return interval(3000, asyncScheduler).pipe(
+
takeUntil(this.actions$.pipe(ofType(FlowActions.stopRemoteProcessGroupPolling)))
+);
+}),
+switchMap(() => {
+return of(FlowActions.refreshRemoteProcessGroup());
+})
+)
+);
+
+requestRemoteProcessGroup$ = createEffect(() =>

Review Comment:
   ```suggestion
   requestRefreshRemoteProcessGroup$ = createEffect(() =>
   ```



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-13 Thread via GitHub


scottyaslan commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1488041318


##
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:
   I think this is a copy past error...



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-13 Thread via GitHub


scottyaslan commented on code in PR #8401:
URL: https://github.com/apache/nifi/pull/8401#discussion_r1488040708


##
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:
   Ok... does this mean that the 'Manage Remote Ports' action will need to 
check  `this.canvasUtils.canRead(selection) && 
this.canvasUtils.canModify(selection)`?



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-13 Thread via GitHub


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 

Re: [PR] [NIFI-12761] refresh RPG [nifi]

2024-02-13 Thread via GitHub


mcgilman commented on PR #8401:
URL: https://github.com/apache/nifi/pull/8401#issuecomment-1941597842

   Will review...


-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org