NIFI-13552 - Ensure errors from Provenance and Lineage queries are shown. (#9088)

This closes #9088
This commit is contained in:
Matt Gilman 2024-07-17 15:25:14 -05:00 committed by GitHub
parent 8e5cf99cd7
commit ca227c7cd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 10 deletions

View File

@ -29,7 +29,7 @@ import { selectActiveLineageId, selectClusterNodeIdFromActiveLineage } from './l
import * as ErrorActions from '../../../../state/error/error.actions'; import * as ErrorActions from '../../../../state/error/error.actions';
import { ErrorHelper } from '../../../../service/error-helper.service'; import { ErrorHelper } from '../../../../service/error-helper.service';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { isDefinedAndNotNull } from 'libs/shared/src'; import { isDefinedAndNotNull, NiFiCommon } from 'libs/shared/src';
@Injectable() @Injectable()
export class LineageEffects { export class LineageEffects {
@ -38,6 +38,7 @@ export class LineageEffects {
private store: Store<NiFiState>, private store: Store<NiFiState>,
private provenanceService: ProvenanceService, private provenanceService: ProvenanceService,
private errorHelper: ErrorHelper, private errorHelper: ErrorHelper,
private nifiCommon: NiFiCommon,
private dialog: MatDialog private dialog: MatDialog
) {} ) {}
@ -78,8 +79,11 @@ export class LineageEffects {
map((action) => action.response), map((action) => action.response),
switchMap((response) => { switchMap((response) => {
const query: Lineage = response.lineage; const query: Lineage = response.lineage;
if (query.finished) { if (query.finished || !this.nifiCommon.isEmpty(query.results.errors)) {
this.dialog.closeAll(); response.lineage.results.errors?.forEach((error) => {
this.store.dispatch(ErrorActions.addBannerError({ error }));
});
return of(LineageActions.deleteLineageQuery()); return of(LineageActions.deleteLineageQuery());
} else { } else {
return of(LineageActions.startPollingLineageQuery()); return of(LineageActions.startPollingLineageQuery());
@ -138,8 +142,16 @@ export class LineageEffects {
this.actions$.pipe( this.actions$.pipe(
ofType(LineageActions.pollLineageQuerySuccess), ofType(LineageActions.pollLineageQuerySuccess),
map((action) => action.response), map((action) => action.response),
filter((response) => response.lineage.finished), filter(
switchMap(() => of(LineageActions.stopPollingLineageQuery())) (response) => response.lineage.finished || !this.nifiCommon.isEmpty(response.lineage.results.errors)
),
switchMap((response) => {
response.lineage.results.errors?.forEach((error) => {
this.store.dispatch(ErrorActions.addBannerError({ error }));
});
return of(LineageActions.stopPollingLineageQuery());
})
) )
); );
@ -158,6 +170,8 @@ export class LineageEffects {
this.store.select(selectClusterNodeIdFromActiveLineage) this.store.select(selectClusterNodeIdFromActiveLineage)
]), ]),
tap(([, id, clusterNodeId]) => { tap(([, id, clusterNodeId]) => {
this.dialog.closeAll();
if (id) { if (id) {
this.provenanceService.deleteLineageQuery(id, clusterNodeId).subscribe(); this.provenanceService.deleteLineageQuery(id, clusterNodeId).subscribe();
} }

View File

@ -41,7 +41,7 @@ import { CancelDialog } from '../../../../ui/common/cancel-dialog/cancel-dialog.
import * as ErrorActions from '../../../../state/error/error.actions'; import * as ErrorActions from '../../../../state/error/error.actions';
import { ErrorHelper } from '../../../../service/error-helper.service'; import { ErrorHelper } from '../../../../service/error-helper.service';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { isDefinedAndNotNull } from 'libs/shared/src'; import { isDefinedAndNotNull, NiFiCommon } from 'libs/shared/src';
import { selectClusterSummary } from '../../../../state/cluster-summary/cluster-summary.selectors'; import { selectClusterSummary } from '../../../../state/cluster-summary/cluster-summary.selectors';
import { ClusterService } from '../../../../service/cluster.service'; import { ClusterService } from '../../../../service/cluster.service';
import { LARGE_DIALOG, MEDIUM_DIALOG } from 'libs/shared/src'; import { LARGE_DIALOG, MEDIUM_DIALOG } from 'libs/shared/src';
@ -54,6 +54,7 @@ export class ProvenanceEventListingEffects {
private provenanceService: ProvenanceService, private provenanceService: ProvenanceService,
private errorHelper: ErrorHelper, private errorHelper: ErrorHelper,
private clusterService: ClusterService, private clusterService: ClusterService,
private nifiCommon: NiFiCommon,
private dialog: MatDialog, private dialog: MatDialog,
private router: Router private router: Router
) {} ) {}
@ -143,8 +144,11 @@ export class ProvenanceEventListingEffects {
map((action) => action.response), map((action) => action.response),
switchMap((response) => { switchMap((response) => {
const query: Provenance = response.provenance; const query: Provenance = response.provenance;
if (query.finished) { if (query.finished || !this.nifiCommon.isEmpty(query.results.errors)) {
this.dialog.closeAll(); response.provenance.results.errors?.forEach((error) => {
this.store.dispatch(ErrorActions.addBannerError({ error }));
});
return of(ProvenanceEventListingActions.deleteProvenanceQuery()); return of(ProvenanceEventListingActions.deleteProvenanceQuery());
} else { } else {
return of(ProvenanceEventListingActions.startPollingProvenanceQuery()); return of(ProvenanceEventListingActions.startPollingProvenanceQuery());
@ -203,8 +207,17 @@ export class ProvenanceEventListingEffects {
this.actions$.pipe( this.actions$.pipe(
ofType(ProvenanceEventListingActions.pollProvenanceQuerySuccess), ofType(ProvenanceEventListingActions.pollProvenanceQuerySuccess),
map((action) => action.response), map((action) => action.response),
filter((response) => response.provenance.finished), filter(
switchMap(() => of(ProvenanceEventListingActions.stopPollingProvenanceQuery())) (response) =>
response.provenance.finished || !this.nifiCommon.isEmpty(response.provenance.results.errors)
),
switchMap((response) => {
response.provenance.results.errors?.forEach((error) => {
this.store.dispatch(ErrorActions.addBannerError({ error }));
});
return of(ProvenanceEventListingActions.stopPollingProvenanceQuery());
})
) )
); );