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


##########
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:
##########
@@ -775,8 +776,16 @@ export class CanvasContextMenu implements 
ContextMenuDefinitionProvider {
                 },
                 clazz: 'fa fa-cloud',
                 text: 'Manage remote ports',
-                action: () => {
-                    // TODO - remotePorts
+                action: (selection: any) => {

Review Comment:
   The condition for this action needs to ensure the user `canRead`.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/manage-remote-ports/manage-remote-ports.component.html:
##########
@@ -0,0 +1,234 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<div class="pb-5 flex flex-col h-screen justify-between gap-y-5">
+    <header class="nifi-header">
+        <navigation></navigation>
+    </header>
+    <div class="px-5 flex-1 flex flex-col">
+        <h3 class="text-xl bold manage-remote-ports-header pb-5">Manage Remote 
Ports</h3>
+        @if (portsState$ | async; as portsState) {
+            <div class="grid-container grid grid-cols-2">
+                <div class="col-span-1 pr-5">
+                    <div class="flex flex-col mb-5">
+                        <div>Name</div>
+                        <div
+                            class="overflow-ellipsis overflow-hidden 
whitespace-nowrap value"
+                            [title]="portsState.rpg?.id">
+                            {{ portsState.rpg?.id }}
+                        </div>
+                    </div>
+                </div>
+                <div class="col-span-1">
+                    <div class="flex flex-col mb-5">
+                        <div>Urls</div>
+                        <div
+                            class="overflow-ellipsis overflow-hidden 
whitespace-nowrap value"
+                            [title]="portsState.rpg?.component?.targetUri">
+                            {{ portsState.rpg?.component?.targetUri }}
+                        </div>
+                    </div>
+                </div>
+            </div>
+            @if (isInitialLoading(portsState)) {
+                <div>
+                    <ngx-skeleton-loader count="3"></ngx-skeleton-loader>
+                </div>
+            } @else {
+                <div class="flex flex-col h-full gap-y-2">
+                    <div class="flex-1">
+                        <div class="relative h-full border">
+                            <div class="manage-remote-ports-table 
listing-table absolute inset-0 overflow-y-auto">
+                                <table
+                                    mat-table
+                                    [dataSource]="dataSource"
+                                    matSort
+                                    matSortDisableClear
+                                    (matSortChange)="sortData($event)"
+                                    [matSortActive]="initialSortColumn"
+                                    [matSortDirection]="initialSortDirection">
+                                    <!-- More Details Column -->
+                                    <ng-container matColumnDef="moreDetails">
+                                        <th mat-header-cell 
*matHeaderCellDef></th>
+                                        <td mat-cell *matCellDef="let item">
+                                            <div class="flex items-center 
gap-x-3">
+                                                @if (hasComments(item)) {
+                                                    <div>
+                                                        <div
+                                                            class="pointer fa 
fa-comment"
+                                                            nifiTooltip
+                                                            
[delayClose]="false"
+                                                            
[tooltipComponentType]="TextTip"
+                                                            
[tooltipInputData]="getCommentsTipData(item)"></div>
+                                                    </div>
+                                                }
+                                            </div>
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Name Column -->
+                                    <ng-container matColumnDef="name">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Name
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatName(item)">
+                                            {{ formatName(item) }}
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Type Column -->
+                                    <ng-container matColumnDef="type">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Type
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatType(item)">
+                                            {{ formatType(item) }}
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Tasks Column -->
+                                    <ng-container matColumnDef="tasks">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Concurrent Tasks
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatTasks(item)">
+                                            <span 
[class.blank]="!item.concurrentlySchedulableTaskCount">
+                                                {{ formatTasks(item) }}
+                                            </span>
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Compression Column -->
+                                    <ng-container matColumnDef="compression">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Compressed
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatCompression(item)">
+                                            {{ formatCompression(item) }}
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Batch Count Column -->
+                                    <ng-container matColumnDef="count">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Batch Count
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatCount(item)">
+                                            <span 
[class.blank]="!item.batchSettings?.count">
+                                                {{ formatCount(item) }}
+                                            </span>
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Batch Size Column -->
+                                    <ng-container matColumnDef="size">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Batch Size
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatSize(item)">
+                                            <span 
[class.blank]="!item.batchSettings?.size">
+                                                {{ formatSize(item) }}
+                                            </span>
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Batch Duration Column -->
+                                    <ng-container matColumnDef="duration">
+                                        <th mat-header-cell *matHeaderCellDef 
mat-sort-header>
+                                            <div class="flex-1 
overflow-ellipsis overflow-hidden whitespace-nowrap">
+                                                Batch Duration
+                                            </div>
+                                        </th>
+                                        <td mat-cell *matCellDef="let item" 
[title]="formatDuration(item)">
+                                            <span 
[class.blank]="!item.batchSettings?.duration">
+                                                {{ formatDuration(item) }}
+                                            </span>
+                                        </td>
+                                    </ng-container>
+
+                                    <!-- Actions Column -->
+                                    <ng-container matColumnDef="actions">
+                                        <th mat-header-cell 
*matHeaderCellDef></th>
+                                        <td mat-cell *matCellDef="let port">
+                                            <div class="flex items-center 
gap-x-3">
+                                                @if (
+                                                    port.exists === true &&
+                                                    port.connected === true &&
+                                                    port.transmitting === false
+                                                ) {
+                                                    <div
+                                                        class="pointer fa 
fa-edit"

Review Comment:
   ```suggestion
                                                           class="pointer fa 
fa-pencil"
   ```



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/manage-remote-ports/manage-remote-ports.reducer.ts:
##########
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { createReducer, on } from '@ngrx/store';
+import {
+    configureRemotePort,
+    configureRemotePortSuccess,
+    loadRemotePorts,
+    loadRemotePortsSuccess,
+    remotePortsBannerApiError,
+    resetRemotePortsState
+} from './manage-remote-ports.actions';
+import { produce } from 'immer';
+import { RemotePortsState } from './index';
+
+export const initialState: RemotePortsState = {
+    ports: [],
+    saving: false,
+    loadedTimestamp: '',
+    rpg: null,
+    status: 'pending'
+};
+
+export const manageRemotePortsReducer = createReducer(
+    initialState,
+    on(resetRemotePortsState, () => ({
+        ...initialState
+    })),
+    on(loadRemotePorts, (state) => ({
+        ...state,
+        status: 'loading' as const
+    })),
+    on(loadRemotePortsSuccess, (state, { response }) => ({
+        ...state,
+        ports: response.ports,
+        loadedTimestamp: response.rpg.component.flowRefreshed || '',

Review Comment:
   If the remote flow isn't current this will prevent the port listing from 
loading as it's used in the condition that shows the skeleton loader.
   
   Also, `flowRefreshed` won't update each time the listing reloads.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/index.ts:
##########
@@ -268,6 +268,15 @@ export interface EditComponentDialogRequest {
     type: ComponentType;
     uri: string;
     entity: any;
+    rpg?: any;

Review Comment:
   I think this field is still present in your latest commit.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/manage-remote-ports/manage-remote-ports.effects.ts:
##########
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Injectable } from '@angular/core';
+import { Actions, concatLatestFrom, createEffect, ofType } from 
'@ngrx/effects';
+import * as ManageRemotePortsActions from './manage-remote-ports.actions';
+import { catchError, from, map, of, switchMap, tap } from 'rxjs';
+import { MatDialog } from '@angular/material/dialog';
+import { Store } from '@ngrx/store';
+import { NiFiState } from '../../../../state';
+import { Router } from '@angular/router';
+import { selectRpg, selectRpgIdFromRoute, selectSaving, selectStatus } from 
'./manage-remote-ports.selectors';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { HttpErrorResponse } from '@angular/common/http';
+import { ManageRemotePortService } from 
'../../service/manage-remote-port.service';
+import { PortSummary } from './index';
+import { EditRemotePortComponent } from 
'../../ui/manage-remote-ports/edit-remote-port/edit-remote-port.component';
+import { EditRemotePortDialogRequest } from '../flow';
+import { ComponentType, isDefinedAndNotNull } from '../../../../state/shared';
+
+@Injectable()
+export class ManageRemotePortsEffects {
+    constructor(
+        private actions$: Actions,
+        private store: Store<NiFiState>,
+        private manageRemotePortService: ManageRemotePortService,
+        private errorHelper: ErrorHelper,
+        private dialog: MatDialog,
+        private router: Router
+    ) {}
+
+    loadRemotePorts$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.loadRemotePorts),
+            map((action) => action.request),
+            concatLatestFrom(() => this.store.select(selectStatus)),
+            switchMap(([request, status]) => {
+                return 
this.manageRemotePortService.getRemotePorts(request.rpgId).pipe(
+                    map((response) => {
+                        const ports: PortSummary[] = [];
+
+                        
response.component.contents.inputPorts.forEach((inputPort: PortSummary) => {
+                            const port = {
+                                ...inputPort,
+                                type: ComponentType.InputPort
+                            } as PortSummary;
+
+                            ports.push(port);
+                        });
+
+                        
response.component.contents.outputPorts.forEach((outputPort: PortSummary) => {
+                            const port = {
+                                ...outputPort,
+                                type: ComponentType.OutputPort
+                            } as PortSummary;
+
+                            ports.push(port);
+                        });
+
+                        return 
ManageRemotePortsActions.loadRemotePortsSuccess({
+                            response: {
+                                ports,
+                                rpg: response
+                            }
+                        });
+                    }),
+                    catchError((errorResponse: HttpErrorResponse) =>
+                        of(this.errorHelper.handleLoadingError(status, 
errorResponse))
+                    )
+                );
+            })
+        )
+    );
+
+    navigateToEditPort$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.navigateToEditPort),
+                map((action) => action.id),
+                concatLatestFrom(() => 
this.store.select(selectRpgIdFromRoute)),
+                tap(([id, rpgId]) => {
+                    this.router.navigate(['/remote-process-group', rpgId, 
'manage-remote-ports', id, 'edit']);
+                })
+            ),
+        { dispatch: false }
+    );
+
+    remotePortsBannerApiError$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.remotePortsBannerApiError),
+            map((action) => action.error),
+            switchMap((error) => of(ErrorActions.addBannerError({ error })))
+        )
+    );
+
+    startRemotePortTransmission$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.startRemotePortTransmission),
+            map((action) => action.request),
+            switchMap((request) => {
+                return this.manageRemotePortService
+                    .updateRemotePortTransmission({
+                        portId: request.port.id,
+                        rpg: request.rpg,
+                        disconnectedNodeAcknowledged: false,
+                        type: request.port.type,
+                        state: 'TRANSMITTING'
+                    })
+                    .pipe(
+                        map((response) => {
+                            return ManageRemotePortsActions.loadRemotePorts({
+                                request: {
+                                    rpgId: 
response.remoteProcessGroupPort.groupId
+                                }
+                            });
+                        }),
+                        catchError((errorResponse: HttpErrorResponse) =>
+                            of(ErrorActions.snackBarError({ error: 
errorResponse.error }))
+                        )
+                    );
+            })
+        )
+    );
+
+    stopRemotePortTransmission$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.stopRemotePortTransmission),
+            map((action) => action.request),
+            switchMap((request) => {
+                return this.manageRemotePortService
+                    .updateRemotePortTransmission({
+                        portId: request.port.id,
+                        rpg: request.rpg,
+                        disconnectedNodeAcknowledged: false,
+                        type: request.port.type,
+                        state: 'STOPPED'
+                    })
+                    .pipe(
+                        map((response) => {
+                            return ManageRemotePortsActions.loadRemotePorts({
+                                request: {
+                                    rpgId: 
response.remoteProcessGroupPort.groupId
+                                }
+                            });
+                        }),
+                        catchError((errorResponse: HttpErrorResponse) =>
+                            of(ErrorActions.snackBarError({ error: 
errorResponse.error }))
+                        )
+                    );
+            })
+        )
+    );
+
+    selectRemotePort$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.selectRemotePort),
+                map((action) => action.request),
+                tap((request) => {
+                    this.router.navigate(['/remote-process-group', 
request.rpgId, 'manage-remote-ports', request.id]);
+                })
+            ),
+        { dispatch: false }
+    );
+
+    openConfigureRemotePortDialog$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.openConfigureRemotePortDialog),
+                map((action) => action.request),
+                concatLatestFrom(() => 
[this.store.select(selectRpg).pipe(isDefinedAndNotNull())]),
+                tap(([request, rpg]) => {
+                    const portId: string = request.id;
+
+                    const editDialogReference = 
this.dialog.open(EditRemotePortComponent, {
+                        data: {
+                            type: request.port.type,
+                            entity: request.port,
+                            rpg
+                        } as EditRemotePortDialogRequest,
+                        id: portId
+                    });
+
+                    editDialogReference.componentInstance.saving$ = 
this.store.select(selectSaving);
+
+                    editDialogReference.afterClosed().subscribe((response) => {

Review Comment:
   When the dialog is closed we need to clear any banner errors.
   
   `this.store.dispatch(ErrorActions.clearBannerErrors());`



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/manage-remote-ports/edit-remote-port/edit-remote-port.component.ts:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators 
} from '@angular/forms';
+import { Store } from '@ngrx/store';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe } from '@angular/common';
+import { ErrorBanner } from 
'../../../../../ui/common/error-banner/error-banner.component';
+import { NifiSpinnerDirective } from 
'../../../../../ui/common/spinner/nifi-spinner.directive';
+import { selectSaving } from 
'../../../state/manage-remote-ports/manage-remote-ports.selectors';
+import { EditComponentDialogRequest } from '../../../state/flow';
+import { Client } from '../../../../../service/client.service';
+import { ComponentType } from '../../../../../state/shared';
+import { PortSummary } from '../../../state/manage-remote-ports';
+import { configureRemotePort } from 
'../../../state/manage-remote-ports/manage-remote-ports.actions';
+
+@Component({
+    standalone: true,
+    templateUrl: './edit-remote-port.component.html',
+    imports: [
+        ReactiveFormsModule,
+        ErrorBanner,
+        MatDialogModule,
+        MatInputModule,
+        MatCheckboxModule,
+        MatButtonModule,
+        AsyncPipe,
+        NifiSpinnerDirective
+    ],
+    styleUrls: ['./edit-remote-port.component.scss']
+})
+export class EditRemotePortComponent {
+    saving$ = this.store.select(selectSaving);
+
+    editPortForm: FormGroup;
+    portTypeLabel: string;
+
+    constructor(
+        @Inject(MAT_DIALOG_DATA) public request: EditComponentDialogRequest,

Review Comment:
   ```suggestion
           @Inject(MAT_DIALOG_DATA) public request: EditRemotePortDialogRequest,
   ```



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/manage-remote-ports/edit-remote-port/edit-remote-port.component.ts:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators 
} from '@angular/forms';
+import { Store } from '@ngrx/store';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe } from '@angular/common';
+import { ErrorBanner } from 
'../../../../../ui/common/error-banner/error-banner.component';
+import { NifiSpinnerDirective } from 
'../../../../../ui/common/spinner/nifi-spinner.directive';
+import { selectSaving } from 
'../../../state/manage-remote-ports/manage-remote-ports.selectors';
+import { EditComponentDialogRequest } from '../../../state/flow';
+import { Client } from '../../../../../service/client.service';
+import { ComponentType } from '../../../../../state/shared';
+import { PortSummary } from '../../../state/manage-remote-ports';
+import { configureRemotePort } from 
'../../../state/manage-remote-ports/manage-remote-ports.actions';
+
+@Component({
+    standalone: true,
+    templateUrl: './edit-remote-port.component.html',
+    imports: [
+        ReactiveFormsModule,
+        ErrorBanner,
+        MatDialogModule,
+        MatInputModule,
+        MatCheckboxModule,
+        MatButtonModule,
+        AsyncPipe,
+        NifiSpinnerDirective
+    ],
+    styleUrls: ['./edit-remote-port.component.scss']
+})
+export class EditRemotePortComponent {
+    saving$ = this.store.select(selectSaving);
+
+    editPortForm: FormGroup;
+    portTypeLabel: string;
+
+    constructor(
+        @Inject(MAT_DIALOG_DATA) public request: EditComponentDialogRequest,
+        private formBuilder: FormBuilder,
+        private store: Store<CanvasState>,
+        private client: Client
+    ) {
+        // set the port type name
+        if (ComponentType.InputPort == this.request.type) {
+            this.portTypeLabel = 'Input Port';
+        } else {
+            this.portTypeLabel = 'Output Port';
+        }
+
+        // build the form
+        this.editPortForm = this.formBuilder.group({
+            concurrentTasks: new 
FormControl(request.entity.concurrentlySchedulableTaskCount, 
Validators.required),
+            compressed: new FormControl(request.entity.useCompression || 
false),
+            count: new FormControl(request.entity.batchSettings.count || ''),
+            size: new FormControl(request.entity.batchSettings.size || ''),
+            duration: new FormControl(request.entity.batchSettings.duration || 
'')

Review Comment:
   We need to use `or` and `null coalescing` carefully. `||` will evaluate to 
the right side if the left side evaluates to falsy. This includes 
`null`/`undefined` and things like `0` or empty string. If any of the settings 
are `0` or empty string it will evaluate to the right side. If we used `??` 
here instead, we would only evaluate to the ride side when the left side is 
`null` or `undefined`.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/manage-remote-ports/manage-remote-ports.effects.ts:
##########
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Injectable } from '@angular/core';
+import { Actions, concatLatestFrom, createEffect, ofType } from 
'@ngrx/effects';
+import * as ManageRemotePortsActions from './manage-remote-ports.actions';
+import { catchError, from, map, of, switchMap, tap } from 'rxjs';
+import { MatDialog } from '@angular/material/dialog';
+import { Store } from '@ngrx/store';
+import { NiFiState } from '../../../../state';
+import { Router } from '@angular/router';
+import { selectRpg, selectRpgIdFromRoute, selectSaving, selectStatus } from 
'./manage-remote-ports.selectors';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { HttpErrorResponse } from '@angular/common/http';
+import { ManageRemotePortService } from 
'../../service/manage-remote-port.service';
+import { PortSummary } from './index';
+import { EditRemotePortComponent } from 
'../../ui/manage-remote-ports/edit-remote-port/edit-remote-port.component';
+import { EditRemotePortDialogRequest } from '../flow';
+import { ComponentType, isDefinedAndNotNull } from '../../../../state/shared';
+
+@Injectable()
+export class ManageRemotePortsEffects {
+    constructor(
+        private actions$: Actions,
+        private store: Store<NiFiState>,
+        private manageRemotePortService: ManageRemotePortService,
+        private errorHelper: ErrorHelper,
+        private dialog: MatDialog,
+        private router: Router
+    ) {}
+
+    loadRemotePorts$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.loadRemotePorts),
+            map((action) => action.request),
+            concatLatestFrom(() => this.store.select(selectStatus)),
+            switchMap(([request, status]) => {
+                return 
this.manageRemotePortService.getRemotePorts(request.rpgId).pipe(
+                    map((response) => {
+                        const ports: PortSummary[] = [];
+
+                        
response.component.contents.inputPorts.forEach((inputPort: PortSummary) => {
+                            const port = {
+                                ...inputPort,
+                                type: ComponentType.InputPort
+                            } as PortSummary;
+
+                            ports.push(port);
+                        });
+
+                        
response.component.contents.outputPorts.forEach((outputPort: PortSummary) => {
+                            const port = {
+                                ...outputPort,
+                                type: ComponentType.OutputPort
+                            } as PortSummary;
+
+                            ports.push(port);
+                        });
+
+                        return 
ManageRemotePortsActions.loadRemotePortsSuccess({
+                            response: {
+                                ports,
+                                rpg: response
+                            }
+                        });
+                    }),
+                    catchError((errorResponse: HttpErrorResponse) =>
+                        of(this.errorHelper.handleLoadingError(status, 
errorResponse))
+                    )
+                );
+            })
+        )
+    );
+
+    navigateToEditPort$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.navigateToEditPort),
+                map((action) => action.id),
+                concatLatestFrom(() => 
this.store.select(selectRpgIdFromRoute)),
+                tap(([id, rpgId]) => {
+                    this.router.navigate(['/remote-process-group', rpgId, 
'manage-remote-ports', id, 'edit']);
+                })
+            ),
+        { dispatch: false }
+    );
+
+    remotePortsBannerApiError$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.remotePortsBannerApiError),
+            map((action) => action.error),
+            switchMap((error) => of(ErrorActions.addBannerError({ error })))
+        )
+    );
+
+    startRemotePortTransmission$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.startRemotePortTransmission),
+            map((action) => action.request),
+            switchMap((request) => {
+                return this.manageRemotePortService
+                    .updateRemotePortTransmission({
+                        portId: request.port.id,
+                        rpg: request.rpg,
+                        disconnectedNodeAcknowledged: false,
+                        type: request.port.type,
+                        state: 'TRANSMITTING'
+                    })
+                    .pipe(
+                        map((response) => {
+                            return ManageRemotePortsActions.loadRemotePorts({
+                                request: {
+                                    rpgId: 
response.remoteProcessGroupPort.groupId
+                                }
+                            });
+                        }),
+                        catchError((errorResponse: HttpErrorResponse) =>
+                            of(ErrorActions.snackBarError({ error: 
errorResponse.error }))
+                        )
+                    );
+            })
+        )
+    );
+
+    stopRemotePortTransmission$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ManageRemotePortsActions.stopRemotePortTransmission),
+            map((action) => action.request),
+            switchMap((request) => {
+                return this.manageRemotePortService
+                    .updateRemotePortTransmission({
+                        portId: request.port.id,
+                        rpg: request.rpg,
+                        disconnectedNodeAcknowledged: false,
+                        type: request.port.type,
+                        state: 'STOPPED'
+                    })
+                    .pipe(
+                        map((response) => {
+                            return ManageRemotePortsActions.loadRemotePorts({
+                                request: {
+                                    rpgId: 
response.remoteProcessGroupPort.groupId
+                                }
+                            });
+                        }),
+                        catchError((errorResponse: HttpErrorResponse) =>
+                            of(ErrorActions.snackBarError({ error: 
errorResponse.error }))
+                        )
+                    );
+            })
+        )
+    );
+
+    selectRemotePort$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.selectRemotePort),
+                map((action) => action.request),
+                tap((request) => {
+                    this.router.navigate(['/remote-process-group', 
request.rpgId, 'manage-remote-ports', request.id]);
+                })
+            ),
+        { dispatch: false }
+    );
+
+    openConfigureRemotePortDialog$ = createEffect(
+        () =>
+            this.actions$.pipe(
+                ofType(ManageRemotePortsActions.openConfigureRemotePortDialog),
+                map((action) => action.request),
+                concatLatestFrom(() => 
[this.store.select(selectRpg).pipe(isDefinedAndNotNull())]),
+                tap(([request, rpg]) => {
+                    const portId: string = request.id;
+
+                    const editDialogReference = 
this.dialog.open(EditRemotePortComponent, {
+                        data: {
+                            type: request.port.type,
+                            entity: request.port,
+                            rpg
+                        } as EditRemotePortDialogRequest,
+                        id: portId
+                    });
+
+                    editDialogReference.componentInstance.saving$ = 
this.store.select(selectSaving);

Review Comment:
   This isn't needed as `EditRemotePortComponent` uses the `store` and selects 
`saving$` directly.



-- 
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]


Reply via email to