This is an automated email from the ASF dual-hosted git repository.
rfellows pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 82c7cf65b5 NIFI-12723: Error Handling in Settings, Bulletin Board, and
Counters (#8349)
82c7cf65b5 is described below
commit 82c7cf65b513c3a6cf2978ab7a4a17108e2e68fe
Author: Matt Gilman <[email protected]>
AuthorDate: Tue Feb 6 08:13:22 2024 -0500
NIFI-12723: Error Handling in Settings, Bulletin Board, and Counters (#8349)
* NIFI-12723:
- Error handling in General and Flow Analysis Rules.
- Fixed saving flag in management Controller Service listing.
* NIFI-12723:
- Error handling in Reporting Tasks and Registry Clients.
* NIFI-12723:
- Error handling in Bulletin Board.
* NIFI-12723:
- Error handling in Counters.
* NIFI-12723:
- Fixing lint issues.
* NIFI-12723:
- Addressing review feedback.
This closes #8349
---
.../bulletins/service/bulletin-board.service.ts | 6 +-
.../state/bulletin-board/bulletin-board.actions.ts | 5 --
.../state/bulletin-board/bulletin-board.effects.ts | 17 +++--
.../state/bulletin-board/bulletin-board.reducer.ts | 9 ---
.../bulletin-board/bulletin-board.selectors.ts | 2 +
.../pages/bulletins/state/bulletin-board/index.ts | 3 +-
.../counter-listing/counter-listing.actions.ts | 2 +-
.../counter-listing/counter-listing.effects.ts | 32 +++++----
.../counter-listing/counter-listing.reducer.ts | 8 +--
.../counter-listing/counter-listing.selectors.ts | 2 +
.../pages/counters/state/counter-listing/index.ts | 3 +-
.../controller-services.effects.ts | 14 +---
.../flow-analysis-rules.actions.ts | 9 ++-
.../flow-analysis-rules.effects.ts | 75 +++++++++++++---------
.../flow-analysis-rules.reducer.ts | 13 ++--
.../flow-analysis-rules.selectors.ts | 5 ++
.../settings/state/flow-analysis-rules/index.ts | 3 +-
.../settings/state/general/general.effects.ts | 29 ++++++---
.../settings/state/general/general.reducer.ts | 15 +++--
.../settings/state/general/general.selectors.ts | 6 +-
.../src/app/pages/settings/state/general/index.ts | 4 +-
.../management-controller-services.actions.ts | 5 ++
.../management-controller-services.effects.ts | 34 ++++++----
.../management-controller-services.reducer.ts | 3 +-
.../pages/settings/state/registry-clients/index.ts | 3 +-
.../registry-clients/registry-clients.actions.ts | 9 ++-
.../registry-clients/registry-clients.effects.ts | 56 ++++++++++------
.../registry-clients/registry-clients.reducer.ts | 11 ++--
.../registry-clients/registry-clients.selectors.ts | 2 +
.../pages/settings/state/reporting-tasks/index.ts | 3 +-
.../reporting-tasks/reporting-tasks.actions.ts | 9 ++-
.../reporting-tasks/reporting-tasks.effects.ts | 75 +++++++++++++---------
.../reporting-tasks/reporting-tasks.reducer.ts | 11 ++--
.../reporting-tasks/reporting-tasks.selectors.ts | 2 +
.../edit-flow-analysis-rule.component.html | 1 +
.../edit-flow-analysis-rule.component.spec.ts | 19 +++++-
.../edit-flow-analysis-rule.component.ts | 4 +-
.../general-form/general-form.component.html | 18 +++---
.../general/general-form/general-form.component.ts | 2 +
.../pages/settings/ui/general/general.module.ts | 4 +-
.../edit-registry-client.component.html | 1 +
.../edit-registry-client.component.spec.ts | 19 +++++-
.../edit-registry-client.component.ts | 4 +-
.../edit-reporting-task.component.html | 1 +
.../edit-reporting-task.component.spec.ts | 19 +++++-
.../edit-reporting-task.component.ts | 4 +-
.../nifi/src/app/service/error-helper.service.ts | 16 ++++-
47 files changed, 375 insertions(+), 222 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/service/bulletin-board.service.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/service/bulletin-board.service.ts
index 58e181a774..024cfad214 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/service/bulletin-board.service.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/service/bulletin-board.service.ts
@@ -17,17 +17,13 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
-import { Client } from '../../../service/client.service';
import { LoadBulletinBoardRequest } from '../state/bulletin-board';
@Injectable({ providedIn: 'root' })
export class BulletinBoardService {
private static readonly API: string = '../nifi-api';
- constructor(
- private httpClient: HttpClient,
- private client: Client
- ) {}
+ constructor(private httpClient: HttpClient) {}
getBulletins(request: LoadBulletinBoardRequest) {
const params: HttpParams = request as HttpParams;
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.actions.ts
index 4885be3c73..bd343a3498 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.actions.ts
@@ -34,11 +34,6 @@ export const resetBulletinBoardState =
createAction(`${BULLETIN_BOARD_PREFIX} Re
export const clearBulletinBoard = createAction(`${BULLETIN_BOARD_PREFIX} Clear
Bulletin Board`);
-export const bulletinBoardApiError = createAction(
- `${BULLETIN_BOARD_PREFIX} Load Bulletin Board Errors`,
- props<{ error: string }>()
-);
-
export const setBulletinBoardFilter = createAction(
`${BULLETIN_BOARD_PREFIX} Set Bulletin Board Filter`,
props<{ filter: BulletinBoardFilterArgs }>()
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.effects.ts
index 31417f205e..adb6320336 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.effects.ts
@@ -19,27 +19,29 @@ import { Injectable } from '@angular/core';
import { Actions, concatLatestFrom, createEffect, ofType } from
'@ngrx/effects';
import { Store } from '@ngrx/store';
import { NiFiState } from '../../../../state';
-import { Router } from '@angular/router';
import * as BulletinBoardActions from './bulletin-board.actions';
-import { asyncScheduler, from, interval, map, of, switchMap, takeUntil } from
'rxjs';
+import { asyncScheduler, catchError, from, interval, map, of, switchMap,
takeUntil } from 'rxjs';
import { BulletinBoardService } from '../../service/bulletin-board.service';
-import { selectBulletinBoardFilter, selectLastBulletinId } from
'./bulletin-board.selectors';
+import { selectBulletinBoardFilter, selectLastBulletinId, selectStatus } from
'./bulletin-board.selectors';
import { LoadBulletinBoardRequest } from './index';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class BulletinBoardEffects {
constructor(
private actions$: Actions,
private store: Store<NiFiState>,
- private router: Router,
- private bulletinBoardService: BulletinBoardService
+ private bulletinBoardService: BulletinBoardService,
+ private errorHelper: ErrorHelper
) {}
loadBulletinBoard$ = createEffect(() =>
this.actions$.pipe(
ofType(BulletinBoardActions.loadBulletinBoard),
map((action) => action.request),
- switchMap((request) =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([request, status]) =>
from(
this.bulletinBoardService.getBulletins(request).pipe(
map((response: any) =>
@@ -49,6 +51,9 @@ export class BulletinBoardEffects {
loadedTimestamp:
response.bulletinBoard.generated
}
})
+ ),
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.reducer.ts
index 9d6dc96f31..7f913158ae 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.reducer.ts
@@ -18,7 +18,6 @@
import { BulletinBoardEvent, BulletinBoardItem, BulletinBoardState } from
'./index';
import { createReducer, on } from '@ngrx/store';
import {
- bulletinBoardApiError,
clearBulletinBoard,
loadBulletinBoard,
loadBulletinBoardSuccess,
@@ -36,7 +35,6 @@ export const initialBulletinBoardState: BulletinBoardState = {
autoRefresh: true,
lastBulletinId: 0,
status: 'pending',
- error: null,
loadedTimestamp: ''
};
@@ -67,17 +65,10 @@ export const bulletinBoardReducer = createReducer(
bulletinBoardItems: [...state.bulletinBoardItems, ...items],
lastBulletinId: lastId,
status: 'success' as const,
- error: null,
loadedTimestamp: response.loadedTimestamp
};
}),
- on(bulletinBoardApiError, (state, { error }) => ({
- ...state,
- error,
- status: 'error' as const
- })),
-
on(resetBulletinBoardState, () => ({ ...initialBulletinBoardState })),
on(clearBulletinBoard, (state) => ({
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.selectors.ts
index c13ba12e6e..b622be2a87 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/bulletin-board.selectors.ts
@@ -33,3 +33,5 @@ export const selectBulletinBoardFilter = createSelector(
selectBulletinBoardState,
(state: BulletinBoardState) => state.filter
);
+
+export const selectStatus = createSelector(selectBulletinBoardState, (state:
BulletinBoardState) => state.status);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/index.ts
index 6908510aae..263cb5234b 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/bulletins/state/bulletin-board/index.ts
@@ -39,8 +39,7 @@ export interface BulletinBoardState {
autoRefresh: boolean;
lastBulletinId: number;
loadedTimestamp: string;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ status: 'pending' | 'loading' | 'success';
}
export interface LoadBulletinBoardResponse {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.actions.ts
index 6abf48fc23..0dbd476a95 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.actions.ts
@@ -28,7 +28,7 @@ export const loadCountersSuccess = createAction(
);
export const counterListingApiError = createAction(
- `${COUNTER_PREFIX} Load Counter Listing Errors`,
+ `${COUNTER_PREFIX} Load Counter Listing Error`,
props<{ error: string }>()
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.effects.ts
index 0f35e30e66..849fc7c680 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.effects.ts
@@ -16,30 +16,34 @@
*/
import { Injectable } from '@angular/core';
-import { Actions, createEffect, ofType } from '@ngrx/effects';
+import { Actions, concatLatestFrom, createEffect, ofType } from
'@ngrx/effects';
import { NiFiState } from '../../../../state';
import { Store } from '@ngrx/store';
-import { Router } from '@angular/router';
import * as CounterListingActions from './counter-listing.actions';
import { catchError, from, map, of, switchMap, take, tap } from 'rxjs';
import { CountersService } from '../../service/counters.service';
import { MatDialog } from '@angular/material/dialog';
import { YesNoDialog } from
'../../../../ui/common/yes-no-dialog/yes-no-dialog.component';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { HttpErrorResponse } from '@angular/common/http';
+import { selectStatus } from './counter-listing.selectors';
@Injectable()
export class CounterListingEffects {
constructor(
private actions$: Actions,
private store: Store<NiFiState>,
- private router: Router,
private countersService: CountersService,
+ private errorHelper: ErrorHelper,
private dialog: MatDialog
) {}
loadCounters$ = createEffect(() =>
this.actions$.pipe(
ofType(CounterListingActions.loadCounters),
- switchMap(() =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([, status]) =>
from(this.countersService.getCounters()).pipe(
map((response) =>
CounterListingActions.loadCountersSuccess({
@@ -49,12 +53,8 @@ export class CounterListingEffects {
}
})
),
- catchError((error) =>
- of(
- CounterListingActions.counterListingApiError({
- error: error.error
- })
- )
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
@@ -98,9 +98,19 @@ export class CounterListingEffects {
response
})
),
- catchError((error) =>
of(CounterListingActions.counterListingApiError({ error: error.error })))
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(CounterListingActions.counterListingApiError({
error: errorResponse.error }))
+ )
)
)
)
);
+
+ counterListingApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(CounterListingActions.counterListingApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.reducer.ts
index 342d97e3c5..f10d6560e7 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.reducer.ts
@@ -30,7 +30,6 @@ export const initialState: CounterListingState = {
counters: [],
saving: false,
loadedTimestamp: '',
- error: null,
status: 'pending'
};
@@ -44,14 +43,11 @@ export const counterListingReducer = createReducer(
...state,
counters: response.counters,
loadedTimestamp: response.loadedTimestamp,
- error: null,
status: 'success' as const
})),
- on(counterListingApiError, (state, { error }) => ({
+ on(counterListingApiError, (state) => ({
...state,
- saving: false,
- error,
- status: 'error' as const
+ saving: false
})),
on(resetCounterSuccess, (state, { response }) => {
return produce(state, (draftState) => {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.selectors.ts
index 5855fef5ca..7af968de59 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/counter-listing.selectors.ts
@@ -25,3 +25,5 @@ export const selectCounterListingState = createSelector(
);
export const selectCounters = createSelector(selectCounterListingState,
(state: CounterListingState) => state.counters);
+
+export const selectStatus = createSelector(selectCounterListingState, (state:
CounterListingState) => state.status);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/index.ts
index 7459519b37..966211e433 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/counters/state/counter-listing/index.ts
@@ -27,8 +27,7 @@ export interface CounterListingState {
counters: CounterEntity[];
saving: boolean;
loadedTimestamp: string;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ status: 'pending' | 'loading' | 'success';
}
export interface LoadCounterListingResponse {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts
index 2ad4ea44f9..f8ee780901 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts
@@ -85,17 +85,9 @@ export class ControllerServicesEffects {
}
})
),
- catchError((errorResponse: HttpErrorResponse) => {
- if (status === 'success') {
- if
(this.errorHelper.showErrorInContext(errorResponse.status)) {
- return of(ErrorActions.snackBarError({ error:
errorResponse.error }));
- } else {
- return
of(this.errorHelper.fullScreenError(errorResponse));
- }
- } else {
- return
of(this.errorHelper.fullScreenError(errorResponse));
- }
- })
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
+ )
)
)
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.actions.ts
index d783be1d47..acae3493f3 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.actions.ts
@@ -80,8 +80,13 @@ export const disableFlowAnalysisRuleSuccess = createAction(
props<{ response: DisableFlowAnalysisRuleSuccess }>()
);
-export const flowAnalysisRuleApiError = createAction(
- '[Flow Analysis Rules] Load Flow Analysis Rules Error',
+export const flowAnalysisRuleBannerApiError = createAction(
+ '[Flow Analysis Rules] Load Flow Analysis Rule Banner Error',
+ props<{ error: string }>()
+);
+
+export const flowAnalysisRuleSnackbarApiError = createAction(
+ '[Flow Analysis Rules] Load Flow Analysis Rule Snackbar Error',
props<{ error: string }>()
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.effects.ts
index 5095c200f9..f039f3a91e 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.effects.ts
@@ -25,7 +25,6 @@ import { NiFiState } from '../../../../state';
import { selectFlowAnalysisRuleTypes } from
'../../../../state/extension-types/extension-types.selectors';
import { YesNoDialog } from
'../../../../ui/common/yes-no-dialog/yes-no-dialog.component';
import { FlowAnalysisRuleService } from
'../../service/flow-analysis-rule.service';
-import { Client } from '../../../../service/client.service';
import { ManagementControllerServiceService } from
'../../service/management-controller-service.service';
import { CreateFlowAnalysisRule } from
'../../ui/flow-analysis-rules/create-flow-analysis-rule/create-flow-analysis-rule.component';
import { Router } from '@angular/router';
@@ -33,18 +32,20 @@ import { selectSaving } from
'../management-controller-services/management-contr
import { UpdateControllerServiceRequest } from '../../../../state/shared';
import { EditFlowAnalysisRule } from
'../../ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component';
import { CreateFlowAnalysisRuleSuccess } from './index';
-import { ExtensionTypesService } from
'../../../../service/extension-types.service';
import { PropertyTableHelperService } from
'../../../../service/property-table-helper.service';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { selectStatus } from './flow-analysis-rules.selectors';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class FlowAnalysisRulesEffects {
constructor(
private actions$: Actions,
private store: Store<NiFiState>,
- private client: Client,
private managementControllerServiceService:
ManagementControllerServiceService,
- private extensionTypesService: ExtensionTypesService,
private flowAnalysisRuleService: FlowAnalysisRuleService,
+ private errorHelper: ErrorHelper,
private dialog: MatDialog,
private router: Router,
private propertyTableHelperService: PropertyTableHelperService
@@ -53,7 +54,8 @@ export class FlowAnalysisRulesEffects {
loadFlowAnalysisRule$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowAnalysisRuleActions.loadFlowAnalysisRules),
- switchMap(() =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([, status]) =>
from(this.flowAnalysisRuleService.getFlowAnalysisRule()).pipe(
map((response) =>
FlowAnalysisRuleActions.loadFlowAnalysisRulesSuccess({
@@ -63,12 +65,8 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
- of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
- })
- )
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
@@ -105,13 +103,12 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
- of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
- })
- )
- )
+ catchError((errorResponse: HttpErrorResponse) => {
+ this.dialog.closeAll();
+ return of(
+
FlowAnalysisRuleActions.flowAnalysisRuleSnackbarApiError({ error:
errorResponse.error })
+ );
+ })
)
)
)
@@ -136,6 +133,22 @@ export class FlowAnalysisRulesEffects {
)
);
+ flowAnalysisRuleBannerApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowAnalysisRuleActions.flowAnalysisRuleBannerApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.addBannerError({ error })))
+ )
+ );
+
+ flowAnalysisRuleSnackbarApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(FlowAnalysisRuleActions.flowAnalysisRuleSnackbarApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
+
promptFlowAnalysisRuleDeletion$ = createEffect(
() =>
this.actions$.pipe(
@@ -175,10 +188,10 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
+
FlowAnalysisRuleActions.flowAnalysisRuleSnackbarApiError({
+ error: errorResponse.error
})
)
)
@@ -272,6 +285,8 @@ export class FlowAnalysisRulesEffects {
});
editDialogReference.afterClosed().subscribe((response) => {
+ this.store.dispatch(ErrorActions.clearBannerErrors());
+
if (response != 'ROUTED') {
this.store.dispatch(
FlowAnalysisRuleActions.selectFlowAnalysisRule({
@@ -302,10 +317,10 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
+
FlowAnalysisRuleActions.flowAnalysisRuleBannerApiError({
+ error: errorResponse.error
})
)
)
@@ -358,10 +373,10 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
+
FlowAnalysisRuleActions.flowAnalysisRuleSnackbarApiError({
+ error: errorResponse.error
})
)
)
@@ -399,10 +414,10 @@ export class FlowAnalysisRulesEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- FlowAnalysisRuleActions.flowAnalysisRuleApiError({
- error: error.error
+
FlowAnalysisRuleActions.flowAnalysisRuleSnackbarApiError({
+ error: errorResponse.error
})
)
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.reducer.ts
index 45f8cdda1c..d558869999 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.reducer.ts
@@ -26,12 +26,13 @@ import {
deleteFlowAnalysisRuleSuccess,
loadFlowAnalysisRules,
loadFlowAnalysisRulesSuccess,
- flowAnalysisRuleApiError,
+ flowAnalysisRuleBannerApiError,
resetFlowAnalysisRulesState,
disableFlowAnalysisRule,
enableFlowAnalysisRule,
enableFlowAnalysisRuleSuccess,
- disableFlowAnalysisRuleSuccess
+ disableFlowAnalysisRuleSuccess,
+ flowAnalysisRuleSnackbarApiError
} from './flow-analysis-rules.actions';
import { produce } from 'immer';
@@ -39,7 +40,6 @@ export const initialState: FlowAnalysisRulesState = {
flowAnalysisRules: [],
saving: false,
loadedTimestamp: '',
- error: null,
status: 'pending'
};
@@ -56,14 +56,11 @@ export const flowAnalysisRulesReducer = createReducer(
...state,
flowAnalysisRules: response.flowAnalysisRules,
loadedTimestamp: response.loadedTimestamp,
- error: null,
status: 'success' as const
})),
- on(flowAnalysisRuleApiError, (state, { error }) => ({
+ on(flowAnalysisRuleBannerApiError, flowAnalysisRuleSnackbarApiError,
(state) => ({
...state,
- saving: false,
- error,
- status: 'error' as const
+ saving: false
})),
on(enableFlowAnalysisRuleSuccess, (state, { response }) => {
return produce(state, (draftState) => {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.selectors.ts
index b69f9f2ae2..80c774a645 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/flow-analysis-rules.selectors.ts
@@ -30,6 +30,11 @@ export const selectSaving = createSelector(
(state: FlowAnalysisRulesState) => state.saving
);
+export const selectStatus = createSelector(
+ selectFlowAnalysisRulesState,
+ (state: FlowAnalysisRulesState) => state.status
+);
+
export const selectFlowAnalysisRuleIdFromRoute =
createSelector(selectCurrentRoute, (route) => {
if (route) {
// always select the rule from the route
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/index.ts
index 043230f9cf..679daf3f62 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/flow-analysis-rules/index.ts
@@ -117,6 +117,5 @@ export interface FlowAnalysisRulesState {
flowAnalysisRules: FlowAnalysisRuleEntity[];
saving: boolean;
loadedTimestamp: string;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ status: 'pending' | 'loading' | 'success';
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.effects.ts
index 8e9497c61d..addaf271c9 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.effects.ts
@@ -16,25 +16,34 @@
*/
import { Injectable } from '@angular/core';
-import { Actions, createEffect, ofType } from '@ngrx/effects';
+import { Actions, concatLatestFrom, createEffect, ofType } from
'@ngrx/effects';
import * as GeneralActions from './general.actions';
+import * as ErrorActions from '../../../../state/error/error.actions';
import { catchError, from, map, of, switchMap, tap } from 'rxjs';
import { ControllerService } from '../../service/controller.service';
import { MatDialog } from '@angular/material/dialog';
import { OkDialog } from '../../../../ui/common/ok-dialog/ok-dialog.component';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { selectStatus } from './general.selectors';
+import { NiFiState } from '../../../../state';
+import { Store } from '@ngrx/store';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class GeneralEffects {
constructor(
private actions$: Actions,
+ private store: Store<NiFiState>,
private controllerService: ControllerService,
+ private errorHelper: ErrorHelper,
private dialog: MatDialog
) {}
loadControllerConfig$ = createEffect(() =>
this.actions$.pipe(
ofType(GeneralActions.loadControllerConfig),
- switchMap(() =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([, status]) =>
from(this.controllerService.getControllerConfig()).pipe(
map((response) =>
GeneralActions.loadControllerConfigSuccess({
@@ -43,12 +52,8 @@ export class GeneralEffects {
}
})
),
- catchError((error) =>
- of(
- GeneralActions.controllerConfigApiError({
- error: error.error
- })
- )
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
@@ -96,4 +101,12 @@ export class GeneralEffects {
),
{ dispatch: false }
);
+
+ controllerConfigApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(GeneralActions.controllerConfigApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.reducer.ts
index 60c2a55f69..6d1ba8bf45 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.reducer.ts
@@ -22,6 +22,7 @@ import {
loadControllerConfig,
loadControllerConfigSuccess,
resetGeneralState,
+ updateControllerConfig,
updateControllerConfigSuccess
} from './general.actions';
import { Revision } from '../../../../state/shared';
@@ -40,7 +41,7 @@ export const initialState: GeneralState = {
revision: INITIAL_REVISION,
component: INITIAL_CONTROLLER
},
- error: null,
+ saving: false,
status: 'pending'
};
@@ -56,18 +57,20 @@ export const generalReducer = createReducer(
on(loadControllerConfigSuccess, (state, { response }) => ({
...state,
controller: response.controller,
- error: null,
status: 'success' as const
})),
- on(controllerConfigApiError, (state, { error }) => ({
+ on(updateControllerConfig, (state) => ({
...state,
- error,
- status: 'error' as const
+ saving: true
+ })),
+ on(controllerConfigApiError, (state) => ({
+ ...state,
+ saving: false
})),
on(updateControllerConfigSuccess, (state, { response }) => ({
...state,
+ saving: false,
controller: response.controller,
- error: null,
status: 'success' as const
}))
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.selectors.ts
index 1591aac78a..01b30d26e8 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/general.selectors.ts
@@ -17,6 +17,10 @@
import { createSelector } from '@ngrx/store';
import { selectSettingsState, SettingsState } from '../index';
-import { generalFeatureKey } from './index';
+import { generalFeatureKey, GeneralState } from './index';
export const selectGeneral = createSelector(selectSettingsState, (state:
SettingsState) => state[generalFeatureKey]);
+
+export const selectSaving = createSelector(selectGeneral, (state:
GeneralState) => state.saving);
+
+export const selectStatus = createSelector(selectGeneral, (state:
GeneralState) => state.status);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/index.ts
index a7e89fb451..d66bb154be 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/general/index.ts
@@ -38,6 +38,6 @@ export interface ControllerEntity {
export interface GeneralState {
controller: ControllerEntity;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ saving: boolean;
+ status: 'pending' | 'loading' | 'success';
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.actions.ts
index 483b481bf4..26a1c7daaf 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.actions.ts
@@ -50,6 +50,11 @@ export const managementControllerServicesBannerApiError =
createAction(
props<{ error: string }>()
);
+export const managementControllerServicesSnackbarApiError = createAction(
+ '[Management Controller Services] Management Controller Services Snackbar
Api Error',
+ props<{ error: string }>()
+);
+
export const openNewControllerServiceDialog = createAction(
'[Management Controller Services] Open New Controller Service Dialog'
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.effects.ts
index 58e0837bac..46ad41dfc8 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.effects.ts
@@ -69,17 +69,9 @@ export class ManagementControllerServicesEffects {
}
})
),
- catchError((errorResponse: HttpErrorResponse) => {
- if (status === 'success') {
- if
(this.errorHelper.showErrorInContext(errorResponse.status)) {
- return of(ErrorActions.snackBarError({ error:
errorResponse.error }));
- } else {
- return
of(this.errorHelper.fullScreenError(errorResponse));
- }
- } else {
- return
of(this.errorHelper.fullScreenError(errorResponse));
- }
- })
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
+ )
)
)
)
@@ -136,7 +128,11 @@ export class ManagementControllerServicesEffects {
),
catchError((errorResponse: HttpErrorResponse) => {
this.dialog.closeAll();
- return of(ErrorActions.snackBarError({ error:
errorResponse.error }));
+ return of(
+
ManagementControllerServicesActions.managementControllerServicesSnackbarApiError({
+ error: errorResponse.error
+ })
+ );
})
)
)
@@ -323,6 +319,14 @@ export class ManagementControllerServicesEffects {
)
);
+ managementControllerServicesSnackbarApiError$ = createEffect(() =>
+ this.actions$.pipe(
+
ofType(ManagementControllerServicesActions.managementControllerServicesSnackbarApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
+
configureControllerServiceSuccess$ = createEffect(
() =>
this.actions$.pipe(
@@ -442,7 +446,11 @@ export class ManagementControllerServicesEffects {
})
),
catchError((errorResponse: HttpErrorResponse) =>
- of(ErrorActions.snackBarError({ error:
errorResponse.error }))
+ of(
+
ManagementControllerServicesActions.managementControllerServicesSnackbarApiError({
+ error: errorResponse.error
+ })
+ )
)
)
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.reducer.ts
index b550ec3587..8e533504a5 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/management-controller-services/management-controller-services.reducer.ts
@@ -28,6 +28,7 @@ import {
loadManagementControllerServices,
loadManagementControllerServicesSuccess,
managementControllerServicesBannerApiError,
+ managementControllerServicesSnackbarApiError,
resetManagementControllerServicesState
} from './management-controller-services.actions';
import { produce } from 'immer';
@@ -54,7 +55,7 @@ export const managementControllerServicesReducer =
createReducer(
loadedTimestamp: response.loadedTimestamp,
status: 'success' as const
})),
- on(managementControllerServicesBannerApiError, (state) => ({
+ on(managementControllerServicesBannerApiError,
managementControllerServicesSnackbarApiError, (state) => ({
...state,
saving: false
})),
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/index.ts
index c7c84e93b6..4cbe47e3ee 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/index.ts
@@ -84,6 +84,5 @@ export interface RegistryClientsState {
registryClients: RegistryClientEntity[];
saving: boolean;
loadedTimestamp: string;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ status: 'pending' | 'loading' | 'success';
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.actions.ts
index ed8f30e740..4adeac7e44 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.actions.ts
@@ -37,8 +37,13 @@ export const loadRegistryClientsSuccess = createAction(
props<{ response: LoadRegistryClientsResponse }>()
);
-export const registryClientsApiError = createAction(
- '[Registry Clients] Load Registry Clients Error',
+export const registryClientsBannerApiError = createAction(
+ '[Registry Clients] Load Registry Clients Banner Api Error',
+ props<{ error: string }>()
+);
+
+export const registryClientsSnackbarApiError = createAction(
+ '[Registry Clients] Load Registry Clients Snackbar Api Error',
props<{ error: string }>()
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.effects.ts
index dc67ba24b5..6d60690f71 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.effects.ts
@@ -27,23 +27,23 @@ import { YesNoDialog } from
'../../../../ui/common/yes-no-dialog/yes-no-dialog.c
import { Router } from '@angular/router';
import { RegistryClientService } from '../../service/registry-client.service';
import { CreateRegistryClient } from
'../../ui/registry-clients/create-registry-client/create-registry-client.component';
-import { selectSaving } from './registry-clients.selectors';
+import { selectSaving, selectStatus } from './registry-clients.selectors';
import { EditRegistryClient } from
'../../ui/registry-clients/edit-registry-client/edit-registry-client.component';
-import { ExtensionTypesService } from
'../../../../service/extension-types.service';
import { ManagementControllerServiceService } from
'../../service/management-controller-service.service';
-import { Client } from '../../../../service/client.service';
import { EditRegistryClientRequest } from './index';
import { PropertyTableHelperService } from
'../../../../service/property-table-helper.service';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class RegistryClientsEffects {
constructor(
private actions$: Actions,
private store: Store<NiFiState>,
- private client: Client,
private registryClientService: RegistryClientService,
- private extensionTypesService: ExtensionTypesService,
private managementControllerServiceService:
ManagementControllerServiceService,
+ private errorHelper: ErrorHelper,
private dialog: MatDialog,
private router: Router,
private propertyTableHelperService: PropertyTableHelperService
@@ -52,7 +52,8 @@ export class RegistryClientsEffects {
loadRegistryClients$ = createEffect(() =>
this.actions$.pipe(
ofType(RegistryClientsActions.loadRegistryClients),
- switchMap(() =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([, status]) =>
from(this.registryClientService.getRegistryClients()).pipe(
map((response) =>
RegistryClientsActions.loadRegistryClientsSuccess({
@@ -62,12 +63,8 @@ export class RegistryClientsEffects {
}
})
),
- catchError((error) =>
- of(
- RegistryClientsActions.registryClientsApiError({
- error: error.error
- })
- )
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
@@ -114,13 +111,14 @@ export class RegistryClientsEffects {
}
})
),
- catchError((error) =>
- of(
- RegistryClientsActions.registryClientsApiError({
- error: error.error
+ catchError((errorResponse: HttpErrorResponse) => {
+ this.dialog.closeAll();
+ return of(
+
RegistryClientsActions.registryClientsSnackbarApiError({
+ error: errorResponse.error
})
- )
- )
+ );
+ })
)
)
)
@@ -145,6 +143,22 @@ export class RegistryClientsEffects {
)
);
+ registryClientsBannerApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(RegistryClientsActions.registryClientsBannerApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.addBannerError({ error })))
+ )
+ );
+
+ registryClientsSnackbarApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(RegistryClientsActions.registryClientsSnackbarApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
+
navigateToEditRegistryClient$ = createEffect(
() =>
this.actions$.pipe(
@@ -220,6 +234,8 @@ export class RegistryClientsEffects {
});
editDialogReference.afterClosed().subscribe((response) => {
+ this.store.dispatch(ErrorActions.clearBannerErrors());
+
if (response != 'ROUTED') {
this.store.dispatch(
RegistryClientsActions.selectClient({
@@ -252,7 +268,7 @@ export class RegistryClientsEffects {
),
catchError((error) =>
of(
- RegistryClientsActions.registryClientsApiError({
+
RegistryClientsActions.registryClientsBannerApiError({
error: error.error
})
)
@@ -320,7 +336,7 @@ export class RegistryClientsEffects {
),
catchError((error) =>
of(
- RegistryClientsActions.registryClientsApiError({
+
RegistryClientsActions.registryClientsSnackbarApiError({
error: error.error
})
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.reducer.ts
index 0abbad1e50..ba68c17737 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.reducer.ts
@@ -27,7 +27,8 @@ import {
deleteRegistryClientSuccess,
loadRegistryClients,
loadRegistryClientsSuccess,
- registryClientsApiError,
+ registryClientsBannerApiError,
+ registryClientsSnackbarApiError,
resetRegistryClientsState
} from './registry-clients.actions';
@@ -35,7 +36,6 @@ export const initialState: RegistryClientsState = {
registryClients: [],
saving: false,
loadedTimestamp: '',
- error: null,
status: 'pending'
};
@@ -52,14 +52,11 @@ export const registryClientsReducer = createReducer(
...state,
registryClients: response.registryClients,
loadedTimestamp: response.loadedTimestamp,
- error: null,
status: 'success' as const
})),
- on(registryClientsApiError, (state, { error }) => ({
+ on(registryClientsBannerApiError, registryClientsSnackbarApiError, (state)
=> ({
...state,
- saving: false,
- error,
- status: 'error' as const
+ saving: false
})),
on(createRegistryClient, configureRegistryClient, deleteRegistryClient,
(state) => ({
...state,
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.selectors.ts
index 24a7cbca0a..49dcbd5ecf 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/registry-clients/registry-clients.selectors.ts
@@ -27,6 +27,8 @@ export const selectRegistryClientsState = createSelector(
export const selectSaving = createSelector(selectRegistryClientsState, (state:
RegistryClientsState) => state.saving);
+export const selectStatus = createSelector(selectRegistryClientsState, (state:
RegistryClientsState) => state.status);
+
export const selectRegistryClientIdFromRoute =
createSelector(selectCurrentRoute, (route) => {
if (route) {
// always select the registry client from the route
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/index.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/index.ts
index f097a08dc8..c887504d5b 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/index.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/index.ts
@@ -111,6 +111,5 @@ export interface ReportingTasksState {
reportingTasks: ReportingTaskEntity[];
saving: boolean;
loadedTimestamp: string;
- error: string | null;
- status: 'pending' | 'loading' | 'error' | 'success';
+ status: 'pending' | 'loading' | 'success';
}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.actions.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.actions.ts
index ada2a743cd..c88e84c17e 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.actions.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.actions.ts
@@ -56,8 +56,13 @@ export const configureReportingTaskSuccess = createAction(
props<{ response: ConfigureReportingTaskSuccess }>()
);
-export const reportingTasksApiError = createAction(
- '[Reporting Tasks] Load Reporting Tasks Error',
+export const reportingTasksBannerApiError = createAction(
+ '[Reporting Tasks] Load Reporting Tasks Banner Api Error',
+ props<{ error: string }>()
+);
+
+export const reportingTasksSnackbarApiError = createAction(
+ '[Reporting Tasks] Load Reporting Tasks Snackbar Api Error',
props<{ error: string }>()
);
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.effects.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.effects.ts
index eeaee7661b..bfd2dd0eaa 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.effects.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.effects.ts
@@ -31,20 +31,21 @@ import { selectSaving } from
'../management-controller-services/management-contr
import { UpdateControllerServiceRequest } from '../../../../state/shared';
import { EditReportingTask } from
'../../ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component';
import { CreateReportingTaskSuccess } from './index';
-import { ExtensionTypesService } from
'../../../../service/extension-types.service';
import { ManagementControllerServiceService } from
'../../service/management-controller-service.service';
-import { Client } from '../../../../service/client.service';
import { PropertyTableHelperService } from
'../../../../service/property-table-helper.service';
+import * as ErrorActions from '../../../../state/error/error.actions';
+import { ErrorHelper } from '../../../../service/error-helper.service';
+import { selectStatus } from './reporting-tasks.selectors';
+import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class ReportingTasksEffects {
constructor(
private actions$: Actions,
private store: Store<NiFiState>,
- private client: Client,
private reportingTaskService: ReportingTaskService,
private managementControllerServiceService:
ManagementControllerServiceService,
- private extensionTypesService: ExtensionTypesService,
+ private errorHelper: ErrorHelper,
private dialog: MatDialog,
private router: Router,
private propertyTableHelperService: PropertyTableHelperService
@@ -53,7 +54,8 @@ export class ReportingTasksEffects {
loadReportingTasks$ = createEffect(() =>
this.actions$.pipe(
ofType(ReportingTaskActions.loadReportingTasks),
- switchMap(() =>
+ concatLatestFrom(() => this.store.select(selectStatus)),
+ switchMap(([, status]) =>
from(this.reportingTaskService.getReportingTasks()).pipe(
map((response) =>
ReportingTaskActions.loadReportingTasksSuccess({
@@ -63,12 +65,8 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
- of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
- })
- )
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(this.errorHelper.handleLoadingError(status,
errorResponse))
)
)
)
@@ -105,13 +103,14 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
- of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
+ catchError((errorResponse: HttpErrorResponse) => {
+ this.dialog.closeAll();
+ return of(
+
ReportingTaskActions.reportingTasksSnackbarApiError({
+ error: errorResponse.error
})
- )
- )
+ );
+ })
)
)
)
@@ -136,6 +135,22 @@ export class ReportingTasksEffects {
)
);
+ reportingTasksBannerApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(ReportingTaskActions.reportingTasksBannerApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.addBannerError({ error })))
+ )
+ );
+
+ reportingTasksSnackbarApiError$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(ReportingTaskActions.reportingTasksSnackbarApiError),
+ map((action) => action.error),
+ switchMap((error) => of(ErrorActions.snackBarError({ error })))
+ )
+ );
+
promptReportingTaskDeletion$ = createEffect(
() =>
this.actions$.pipe(
@@ -175,10 +190,10 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
+
ReportingTaskActions.reportingTasksSnackbarApiError({
+ error: errorResponse.error
})
)
)
@@ -272,6 +287,8 @@ export class ReportingTasksEffects {
});
editDialogReference.afterClosed().subscribe((response) => {
+ this.store.dispatch(ErrorActions.clearBannerErrors());
+
if (response != 'ROUTED') {
this.store.dispatch(
ReportingTaskActions.selectReportingTask({
@@ -302,10 +319,10 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
+ ReportingTaskActions.reportingTasksBannerApiError({
+ error: errorResponse.error
})
)
)
@@ -344,10 +361,10 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
+
ReportingTaskActions.reportingTasksSnackbarApiError({
+ error: errorResponse.error
})
)
)
@@ -369,10 +386,10 @@ export class ReportingTasksEffects {
}
})
),
- catchError((error) =>
+ catchError((errorResponse: HttpErrorResponse) =>
of(
- ReportingTaskActions.reportingTasksApiError({
- error: error.error
+
ReportingTaskActions.reportingTasksSnackbarApiError({
+ error: errorResponse.error
})
)
)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.reducer.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.reducer.ts
index 0943102919..a59b12d218 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.reducer.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.reducer.ts
@@ -26,7 +26,8 @@ import {
deleteReportingTaskSuccess,
loadReportingTasks,
loadReportingTasksSuccess,
- reportingTasksApiError,
+ reportingTasksBannerApiError,
+ reportingTasksSnackbarApiError,
resetReportingTasksState,
startReportingTaskSuccess,
stopReportingTaskSuccess
@@ -37,7 +38,6 @@ export const initialState: ReportingTasksState = {
reportingTasks: [],
saving: false,
loadedTimestamp: '',
- error: null,
status: 'pending'
};
@@ -54,14 +54,11 @@ export const reportingTasksReducer = createReducer(
...state,
reportingTasks: response.reportingTasks,
loadedTimestamp: response.loadedTimestamp,
- error: null,
status: 'success' as const
})),
- on(reportingTasksApiError, (state, { error }) => ({
+ on(reportingTasksBannerApiError, reportingTasksSnackbarApiError, (state)
=> ({
...state,
- saving: false,
- error,
- status: 'error' as const
+ saving: false
})),
on(configureReportingTaskSuccess, (state, { response }) => {
return produce(state, (draftState) => {
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.selectors.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.selectors.ts
index ae9f7ae120..1c5d8fb347 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.selectors.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/state/reporting-tasks/reporting-tasks.selectors.ts
@@ -27,6 +27,8 @@ export const selectReportingTasksState = createSelector(
export const selectSaving = createSelector(selectReportingTasksState, (state:
ReportingTasksState) => state.saving);
+export const selectStatus = createSelector(selectReportingTasksState, (state:
ReportingTasksState) => state.status);
+
export const selectReportingTaskIdFromRoute =
createSelector(selectCurrentRoute, (route) => {
if (route) {
// always select the reporting task from the route
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.html
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.html
index 4946e45c71..ea2a1656c1 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.html
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.html
@@ -17,6 +17,7 @@
<h2 mat-dialog-title>Edit Flow Analysis Rule</h2>
<form class="flow-analysis-rule-edit-form"
[formGroup]="editFlowAnalysisRuleForm">
+ <error-banner></error-banner>
<mat-dialog-content>
<mat-tab-group>
<mat-tab label="Settings">
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.spec.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.spec.ts
index 40c8b8222d..ce78197790 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.spec.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.spec.ts
@@ -21,6 +21,9 @@ import { EditFlowAnalysisRule } from
'./edit-flow-analysis-rule.component';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EditFlowAnalysisRuleDialogRequest } from
'../../../state/flow-analysis-rules';
+import { Component } from '@angular/core';
+import { provideMockStore } from '@ngrx/store/testing';
+import { initialState } from '../../../../../state/error/error.reducer';
describe('EditFlowAnalysisRule', () => {
let component: EditFlowAnalysisRule;
@@ -89,10 +92,22 @@ describe('EditFlowAnalysisRule', () => {
}
};
+ @Component({
+ selector: 'error-banner',
+ standalone: true,
+ template: ''
+ })
+ class MockErrorBanner {}
+
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [EditFlowAnalysisRule, BrowserAnimationsModule],
- providers: [{ provide: MAT_DIALOG_DATA, useValue: data }]
+ imports: [EditFlowAnalysisRule, MockErrorBanner,
BrowserAnimationsModule],
+ providers: [
+ { provide: MAT_DIALOG_DATA, useValue: data },
+ provideMockStore({
+ initialState
+ })
+ ]
});
fixture = TestBed.createComponent(EditFlowAnalysisRule);
component = fixture.componentInstance;
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.ts
index 71842fd0ed..c87e35c15a 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/flow-analysis-rules/edit-flow-analysis-rule/edit-flow-analysis-rule.component.ts
@@ -45,6 +45,7 @@ import {
UpdateFlowAnalysisRuleRequest
} from '../../../state/flow-analysis-rules';
import { FlowAnalysisRuleTable } from
'../flow-analysis-rule-table/flow-analysis-rule-table.component';
+import { ErrorBanner } from
'../../../../../ui/common/error-banner/error-banner.component';
@Component({
selector: 'edit-flow-analysis-rule',
@@ -65,7 +66,8 @@ import { FlowAnalysisRuleTable } from
'../flow-analysis-rule-table/flow-analysis
NifiSpinnerDirective,
MatTooltipModule,
NifiTooltipDirective,
- FlowAnalysisRuleTable
+ FlowAnalysisRuleTable,
+ ErrorBanner
],
styleUrls: ['./edit-flow-analysis-rule.component.scss']
})
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.html
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.html
index a216f2c072..eb39bfead2 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.html
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.html
@@ -28,14 +28,16 @@
</mat-form-field>
</div>
<div *ngIf="currentUser.controllerPermissions.canWrite">
- <button
- [disabled]="!controllerForm.dirty || controllerForm.invalid"
- type="button"
- color="primary"
- (click)="apply()"
- mat-raised-button>
- Apply
- </button>
+ <ng-container *ngIf="{ value: (saving$ | async)! } as saving">
+ <button
+ [disabled]="!controllerForm.dirty ||
controllerForm.invalid"
+ type="button"
+ color="primary"
+ (click)="apply()"
+ mat-raised-button>
+ <span *nifiSpinner="saving.value">Add</span>
+ </button>
+ </ng-container>
</div>
</form>
</div>
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.ts
index d6e2059996..47c169c8bc 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general-form/general-form.component.ts
@@ -22,6 +22,7 @@ import { Store } from '@ngrx/store';
import { updateControllerConfig } from
'../../../state/general/general.actions';
import { Client } from '../../../../../service/client.service';
import { selectCurrentUser } from
'../../../../../state/current-user/current-user.selectors';
+import { selectSaving } from '../../../state/general/general.selectors';
@Component({
selector: 'general-form',
@@ -36,6 +37,7 @@ export class GeneralForm {
this.controllerForm.get('timerDrivenThreadCount')?.setValue(controller.component.maxTimerDrivenThreadCount);
}
+ saving$ = this.store.select(selectSaving);
currentUser$ = this.store.select(selectCurrentUser);
controllerForm: FormGroup;
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general.module.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general.module.ts
index dda80b5729..da1afd093c 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general.module.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/general/general.module.ts
@@ -24,6 +24,7 @@ import { MatFormFieldModule } from
'@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
+import { NifiSpinnerDirective } from
'../../../../ui/common/spinner/nifi-spinner.directive';
@NgModule({
declarations: [General, GeneralForm],
@@ -35,7 +36,8 @@ import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
MatFormFieldModule,
MatInputModule,
MatButtonModule,
- NgxSkeletonLoaderModule
+ NgxSkeletonLoaderModule,
+ NifiSpinnerDirective
]
})
export class GeneralModule {}
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.html
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.html
index c99bce6874..78c264906a 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.html
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.html
@@ -17,6 +17,7 @@
<h2 mat-dialog-title>Edit Registry Client</h2>
<form class="edit-registry-client-form" [formGroup]="editRegistryClientForm">
+ <error-banner></error-banner>
<mat-dialog-content>
<mat-tab-group>
<mat-tab label="Settings">
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.spec.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.spec.ts
index 637398763a..ceab67e19b 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.spec.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.spec.ts
@@ -21,6 +21,9 @@ import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EditRegistryClient } from './edit-registry-client.component';
import { EditRegistryClientDialogRequest } from
'../../../state/registry-clients';
+import { Component } from '@angular/core';
+import { provideMockStore } from '@ngrx/store/testing';
+import { initialState } from '../../../../../state/error/error.reducer';
describe('EditRegistryClient', () => {
let component: EditRegistryClient;
@@ -102,10 +105,22 @@ describe('EditRegistryClient', () => {
}
};
+ @Component({
+ selector: 'error-banner',
+ standalone: true,
+ template: ''
+ })
+ class MockErrorBanner {}
+
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [EditRegistryClient, BrowserAnimationsModule],
- providers: [{ provide: MAT_DIALOG_DATA, useValue: data }]
+ imports: [EditRegistryClient, MockErrorBanner,
BrowserAnimationsModule],
+ providers: [
+ { provide: MAT_DIALOG_DATA, useValue: data },
+ provideMockStore({
+ initialState
+ })
+ ]
});
fixture = TestBed.createComponent(EditRegistryClient);
component = fixture.componentInstance;
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.ts
index 5e72c69ef3..7ca58dc809 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/registry-clients/edit-registry-client/edit-registry-client.component.ts
@@ -40,6 +40,7 @@ import { TextTip } from
'../../../../../ui/common/tooltips/text-tip/text-tip.com
import { NiFiCommon } from '../../../../../service/nifi-common.service';
import { MatTabsModule } from '@angular/material/tabs';
import { PropertyTable } from
'../../../../../ui/common/property-table/property-table.component';
+import { ErrorBanner } from
'../../../../../ui/common/error-banner/error-banner.component';
@Component({
selector: 'edit-registry-client',
@@ -58,7 +59,8 @@ import { PropertyTable } from
'../../../../../ui/common/property-table/property-
NgForOf,
NifiTooltipDirective,
MatTabsModule,
- PropertyTable
+ PropertyTable,
+ ErrorBanner
],
styleUrls: ['./edit-registry-client.component.scss']
})
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.html
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.html
index df23db3b94..ec259abd6d 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.html
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.html
@@ -17,6 +17,7 @@
<h2 mat-dialog-title>Edit Reporting Task</h2>
<form class="reporting-task-edit-form" [formGroup]="editReportingTaskForm">
+ <error-banner></error-banner>
<mat-dialog-content>
<mat-tab-group>
<mat-tab label="Settings">
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.spec.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.spec.ts
index b252b762d7..9083aab2b6 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.spec.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.spec.ts
@@ -21,6 +21,9 @@ import { EditReportingTask } from
'./edit-reporting-task.component';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EditReportingTaskDialogRequest } from
'../../../state/reporting-tasks';
+import { Component } from '@angular/core';
+import { provideMockStore } from '@ngrx/store/testing';
+import { initialState } from '../../../../../state/error/error.reducer';
describe('EditReportingTask', () => {
let component: EditReportingTask;
@@ -382,10 +385,22 @@ describe('EditReportingTask', () => {
}
};
+ @Component({
+ selector: 'error-banner',
+ standalone: true,
+ template: ''
+ })
+ class MockErrorBanner {}
+
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [EditReportingTask, BrowserAnimationsModule],
- providers: [{ provide: MAT_DIALOG_DATA, useValue: data }]
+ imports: [EditReportingTask, MockErrorBanner,
BrowserAnimationsModule],
+ providers: [
+ { provide: MAT_DIALOG_DATA, useValue: data },
+ provideMockStore({
+ initialState
+ })
+ ]
});
fixture = TestBed.createComponent(EditReportingTask);
component = fixture.componentInstance;
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.ts
index 90aa4d15b4..ef3b119534 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/reporting-tasks/edit-reporting-task/edit-reporting-task.component.ts
@@ -47,6 +47,7 @@ import {
import { ControllerServiceApi } from
'../../../../../ui/common/controller-service/controller-service-api/controller-service-api.component';
import { NifiTooltipDirective } from
'../../../../../ui/common/tooltips/nifi-tooltip.directive';
import { TextTip } from
'../../../../../ui/common/tooltips/text-tip/text-tip.component';
+import { ErrorBanner } from
'../../../../../ui/common/error-banner/error-banner.component';
@Component({
selector: 'edit-reporting-task',
@@ -68,7 +69,8 @@ import { TextTip } from
'../../../../../ui/common/tooltips/text-tip/text-tip.com
AsyncPipe,
NifiSpinnerDirective,
MatTooltipModule,
- NifiTooltipDirective
+ NifiTooltipDirective,
+ ErrorBanner
],
styleUrls: ['./edit-reporting-task.component.scss']
})
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/error-helper.service.ts
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/error-helper.service.ts
index 3b1ef875b1..16976ee041 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/error-helper.service.ts
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/error-helper.service.ts
@@ -17,7 +17,7 @@
import { Injectable } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
-import * as ErrorDetailActions from '../state/error/error.actions';
+import * as ErrorActions from '../state/error/error.actions';
import { Action } from '@ngrx/store';
import { NiFiCommon } from './nifi-common.service';
@@ -55,7 +55,7 @@ export class ErrorHelper {
message = errorResponse.error;
}
- return ErrorDetailActions.fullScreenError({
+ return ErrorActions.fullScreenError({
errorDetail: {
title,
message
@@ -66,4 +66,16 @@ export class ErrorHelper {
showErrorInContext(status: number): boolean {
return [400, 403, 404, 409, 413, 503].includes(status);
}
+
+ handleLoadingError(status: string, errorResponse: HttpErrorResponse):
Action {
+ if (status === 'success') {
+ if (this.showErrorInContext(errorResponse.status)) {
+ return ErrorActions.snackBarError({ error: errorResponse.error
});
+ } else {
+ return this.fullScreenError(errorResponse);
+ }
+ } else {
+ return this.fullScreenError(errorResponse);
+ }
+ }
}