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


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/summary/state/component-cluster-status/component-cluster-status.effects.ts:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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 { NiFiState } from '../../../../state';
+import { Store } from '@ngrx/store';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import * as ClusterStatusActions from './component-cluster-status.actions';
+import { catchError, from, map, of, switchMap, tap } from 'rxjs';
+import { ComponentClusterStatusService } from 
'../../service/component-cluster-status.service';
+import { MatDialog } from '@angular/material/dialog';
+import { ClusterSummaryDialog } from 
'../../ui/common/cluster-summary-dialog/cluster-summary-dialog.component';
+import { selectComponentClusterStatusLatestRequest } from 
'./component-cluster-status.selectors';
+import { isDefinedAndNotNull } from '../../../../state/shared';
+
+@Injectable()
+export class ComponentClusterStatusEffects {
+    constructor(
+        private actions$: Actions,
+        private store: Store<NiFiState>,
+        private errorHelper: ErrorHelper,
+        private clusterStatusService: ComponentClusterStatusService,
+        private dialog: MatDialog
+    ) {}
+
+    loadComponentClusterStatusAndOpenDialog$ = createEffect(() =>
+        this.actions$.pipe(
+            
ofType(ClusterStatusActions.loadComponentClusterStatusAndOpenDialog),
+            map((action) => action.request),
+            switchMap((request) =>
+                from(this.clusterStatusService.getClusterStatus(request.id, 
request.componentType)).pipe(
+                    map((response) => {
+                        return 
ClusterStatusActions.openComponentClusterStatusDialog({
+                            response: {
+                                clusterStatusEntity: response,
+                                componentType: request.componentType
+                            }
+                        });
+                    }),
+                    catchError((error) => 
of(this.errorHelper.handleLoadingError(error.error, error)))
+                )
+            )
+        )
+    );
+
+    loadComponentClusterStatus$ = createEffect(() =>
+        this.actions$.pipe(
+            ofType(ClusterStatusActions.loadComponentClusterStatus),
+            map((action) => action.request),
+            switchMap((request) =>
+                from(this.clusterStatusService.getClusterStatus(request.id, 
request.componentType)).pipe(
+                    map((response) => {
+                        return 
ClusterStatusActions.loadComponentClusterStatusSuccess({
+                            response: {
+                                clusterStatusEntity: response,
+                                componentType: request.componentType
+                            }
+                        });
+                    }),
+                    catchError((error) => 
of(this.errorHelper.handleLoadingError(error.error, error)))

Review Comment:
   Same as above.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/summary/ui/common/component-status-table/component-status-table.component.ts:
##########
@@ -0,0 +1,239 @@
+/*
+ * 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 { AfterViewInit, Component, EventEmitter, Input, Output, ViewChild } 
from '@angular/core';
+import { BaseSnapshotEntity } from '../../../state';
+import { MatTableDataSource, MatTableModule } from '@angular/material/table';
+import { MatSortModule, Sort, SortDirection } from '@angular/material/sort';
+import { MultiSort } from '../index';
+import { SummaryTableFilterContext } from 
'../summary-table-filter/summary-table-filter.component';
+import { MatPaginator } from '@angular/material/paginator';
+import { NodeSearchResult } from '../../../../../state/cluster-summary';
+
+@Component({
+    selector: 'component-status-table',
+    standalone: true,
+    imports: [MatTableModule, MatSortModule],
+    template: ''
+})
+export abstract class ComponentStatusTable<T extends BaseSnapshotEntity> 
implements AfterViewInit {
+    private _summaryListingStatus: string | null = null;
+    private _loadedTimestamp: string | null = null;
+    private _initialSortColumn!: string;
+    private _initialSortDirection: SortDirection = 'asc';
+    private _connectedToCluster: boolean = false;
+    private _clusterNodes: NodeSearchResult[] | null = null;
+    private _selectedClusterNode: NodeSearchResult | null = null;
+    private _selectedId: string | null = null;
+    private currentFilter: SummaryTableFilterContext | null = null;

Review Comment:
   This doesn't appear to be used (though maybe I missed it).



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/summary/state/component-cluster-status/component-cluster-status.effects.ts:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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 { NiFiState } from '../../../../state';
+import { Store } from '@ngrx/store';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import * as ClusterStatusActions from './component-cluster-status.actions';
+import { catchError, from, map, of, switchMap, tap } from 'rxjs';
+import { ComponentClusterStatusService } from 
'../../service/component-cluster-status.service';
+import { MatDialog } from '@angular/material/dialog';
+import { ClusterSummaryDialog } from 
'../../ui/common/cluster-summary-dialog/cluster-summary-dialog.component';
+import { selectComponentClusterStatusLatestRequest } from 
'./component-cluster-status.selectors';
+import { isDefinedAndNotNull } from '../../../../state/shared';
+
+@Injectable()
+export class ComponentClusterStatusEffects {
+    constructor(
+        private actions$: Actions,
+        private store: Store<NiFiState>,
+        private errorHelper: ErrorHelper,
+        private clusterStatusService: ComponentClusterStatusService,
+        private dialog: MatDialog
+    ) {}
+
+    loadComponentClusterStatusAndOpenDialog$ = createEffect(() =>
+        this.actions$.pipe(
+            
ofType(ClusterStatusActions.loadComponentClusterStatusAndOpenDialog),
+            map((action) => action.request),
+            switchMap((request) =>
+                from(this.clusterStatusService.getClusterStatus(request.id, 
request.componentType)).pipe(
+                    map((response) => {
+                        return 
ClusterStatusActions.openComponentClusterStatusDialog({
+                            response: {
+                                clusterStatusEntity: response,
+                                componentType: request.componentType
+                            }
+                        });
+                    }),
+                    catchError((error) => 
of(this.errorHelper.handleLoadingError(error.error, error)))

Review Comment:
   I don't think we want to be using `handleLoadingError` here. I think we 
probably want to check the error and see if it should be shown in context and 
then either use a snackbar or full screen. `handlingLoadingError` accepts an 
argument that is the current store `status` and uses that as part of the logic 
to determine how to sure the error message.



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

Reply via email to