diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts index e79c587b8e..04fbca2d85 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-context-menu.service.ts @@ -16,8 +16,6 @@ */ import { Injectable } from '@angular/core'; -import { Observable, throwError } from 'rxjs'; -import { HttpClient } from '@angular/common/http'; import { CanvasUtils } from './canvas-utils.service'; import { Store } from '@ngrx/store'; import { CanvasState } from '../state'; @@ -33,18 +31,17 @@ import { navigateToEditComponent, navigateToEditCurrentProcessGroup, navigateToProvenanceForComponent, + navigateToViewStatusHistoryForComponent, reloadFlow, replayLastProvenanceEvent } from '../state/flow/flow.actions'; import { ComponentType } from '../../../state/shared'; import { DeleteComponentRequest, MoveComponentRequest } from '../state/flow'; import { - ContextMenu, ContextMenuDefinition, ContextMenuDefinitionProvider, ContextMenuItemDefinition } from '../../../ui/common/context-menu/context-menu.component'; -import { selection } from 'd3'; @Injectable({ providedIn: 'root' }) export class CanvasContextMenu implements ContextMenuDefinitionProvider { @@ -550,14 +547,21 @@ export class CanvasContextMenu implements ContextMenuDefinitionProvider { isSeparator: true }, { - condition: function (canvasUtils: CanvasUtils, selection: any) { - // TODO - supportsStats - return false; + condition: (canvasUtils: CanvasUtils, selection: any) => { + return canvasUtils.canViewStatusHistory(selection); }, clazz: 'fa fa-area-chart', text: 'View status history', - action: function (store: Store) { - // TODO - showStats + action: (store: Store, selection: any) => { + const selectionData = selection.datum(); + store.dispatch( + navigateToViewStatusHistoryForComponent({ + request: { + type: selectionData.type, + id: selectionData.id + } + }) + ); } }, { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts index 7fa34099c6..53c0f41391 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/canvas-utils.service.ts @@ -228,7 +228,7 @@ export class CanvasUtils { // get the selection data const selectionData: any = selection.datum(); - let supportsModification: boolean = false; + let supportsModification = false; if (this.isProcessor(selection) || this.isInputPort(selection) || this.isOutputPort(selection)) { supportsModification = !( selectionData.status.aggregateSnapshot.runStatus === 'Running' || @@ -246,8 +246,8 @@ export class CanvasUtils { } else if (this.isLabel(selection)) { supportsModification = true; } else if (this.isConnection(selection)) { - let isSourceConfigurable: boolean = false; - let isDestinationConfigurable: boolean = false; + let isSourceConfigurable = false; + let isDestinationConfigurable = false; const sourceComponentId: string = this.getConnectionSourceComponentId(selectionData); const source: any = d3.select('#id-' + sourceComponentId); @@ -286,7 +286,7 @@ export class CanvasUtils { } const self: CanvasUtils = this; - let isDeletable: boolean = true; + let isDeletable = true; selection.each(function (this: any) { if (!self.isDeletable(d3.select(this))) { isDeletable = false; @@ -487,6 +487,24 @@ export class CanvasUtils { return this.isProcessor(selection) && this.canAccessProvenance(); } + /** + * Determines whether the current user can view the status history for the selected component. + * + * @param {selection} selection + */ + public canViewStatusHistory(selection: any): boolean { + if (selection.size() !== 1) { + return false; + } + + return ( + this.isProcessor(selection) || + this.isConnection(selection) || + this.isRemoteProcessGroup(selection) || + this.isProcessGroup(selection) + ); + } + /** * Gets the currently selected components and connections. * @@ -639,7 +657,7 @@ export class CanvasUtils { const connections: Map = new Map(); const components: Map = new Map(); - let isDisconnected: boolean = true; + let isDisconnected = true; // include connections selection @@ -894,7 +912,7 @@ export class CanvasUtils { * @param tooltipData */ public canvasTooltip(viewContainerRef: ViewContainerRef, type: Type, selection: any, tooltipData: any): void { - let closeTimer: number = -1; + let closeTimer = -1; let tooltipRef: ComponentRef | undefined; selection @@ -1034,7 +1052,7 @@ export class CanvasUtils { * @param {string} cacheName */ public multilineEllipsis(selection: any, lineCount: number, text: string, cacheName: string) { - let i: number = 1; + let i = 1; const words: string[] = text.split(/\s+/).reverse(); // get the appropriate position @@ -1047,7 +1065,7 @@ export class CanvasUtils { // go through each word let word = words.pop(); - while (!!word) { + while (word) { // add the current word line.push(word); @@ -1069,7 +1087,7 @@ export class CanvasUtils { if (++i >= lineCount) { // get the remainder using the current word and // reversing whats left - var remainder = [word].concat(words.reverse()); + const remainder = [word].concat(words.reverse()); // apply ellipsis to the last line this.ellipsis(tspan, remainder.join(' '), cacheName); @@ -1103,7 +1121,7 @@ export class CanvasUtils { // if there is active threads show the count, otherwise hide if (activeThreads > 0 || terminatedThreads > 0) { const generateThreadsTip = function () { - var tip = activeThreads + ' active threads'; + let tip = activeThreads + ' active threads'; if (terminatedThreads > 0) { tip += ' (' + terminatedThreads + ' terminated)'; } 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/flow/flow.actions.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.actions.ts index 0b07b87078..b4c47bb5fa 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.actions.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.actions.ts @@ -56,6 +56,7 @@ import { NavigateToControllerServicesRequest, ReplayLastProvenanceEventRequest } from './index'; +import { StatusHistoryRequest } from '../../../../state/status-history'; /* Loading Flow @@ -237,6 +238,15 @@ export const createComponentComplete = createAction( props<{ response: CreateComponentResponse }>() ); +export const navigateToViewStatusHistoryForComponent = createAction( + '[Canvas] Navigate To Status History For Component', + props<{ request: OpenComponentDialogRequest }>() +); + +export const viewStatusHistoryForComponent = createAction( + '[Canvas] View Status History for Component', + props<{ request: StatusHistoryRequest }>() +); /* Update Component Actions */ 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/flow/flow.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/flow/flow.effects.ts index 62b1ceb085..edc6ec953c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts @@ -20,6 +20,7 @@ import { FlowService } from '../../service/flow.service'; import { Actions, createEffect, ofType } from '@ngrx/effects'; import * as FlowActions from './flow.actions'; import * as ParameterActions from '../parameter/parameter.actions'; +import * as StatusHistoryActions from '../../../../state/status-history/status-history.actions'; import { asyncScheduler, catchError, @@ -673,6 +674,49 @@ export class FlowEffects { { dispatch: false } ); + navigateToViewStatusHistoryForComponent$ = createEffect( + () => + this.actions$.pipe( + ofType(FlowActions.navigateToViewStatusHistoryForComponent), + map((action) => action.request), + withLatestFrom(this.store.select(selectCurrentProcessGroupId)), + tap(([request, currentProcessGroupId]) => { + this.router.navigate([ + '/process-groups', + currentProcessGroupId, + request.type, + request.id, + 'history' + ]); + }) + ), + { dispatch: false } + ); + + completeStatusHistoryForComponent$ = createEffect( + () => + this.actions$.pipe( + ofType(StatusHistoryActions.viewStatusHistoryComplete), + map((action) => action.request), + filter((request) => request.source === 'canvas'), + tap((request) => { + this.store.dispatch( + FlowActions.selectComponents({ + request: { + components: [ + { + id: request.componentId, + componentType: request.componentType + } + ] + } + }) + ); + }) + ), + { dispatch: false } + ); + navigateToControllerServicesForProcessGroup$ = createEffect( () => this.actions$.pipe( @@ -1943,8 +1987,8 @@ export class FlowEffects { }) ); } else if (response.nodeSnapshots) { - let replayedCount: number = 0; - let unavailableCount: number = 0; + let replayedCount = 0; + let unavailableCount = 0; response.nodeSnapshots.forEach((nodeResponse: any) => { if (nodeResponse.snapshot.eventAvailable) { 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/flow/flow.selectors.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.selectors.ts index 80e6caa6d0..5c2c3d1b25 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.selectors.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/state/flow/flow.selectors.ts @@ -121,6 +121,19 @@ export const selectEditedCurrentProcessGroup = createSelector(selectCurrentRoute return null; }); +export const selectViewStatusHistoryComponent = createSelector(selectCurrentRoute, (route) => { + let selectedComponent: SelectedComponent | null = null; + if (route?.routeConfig?.path == 'history') { + if (route.params.id && route.params.type) { + selectedComponent = { + id: route.params.id, + componentType: route.params.type + }; + } + } + return selectedComponent; +}); + export const selectTransitionRequired = createSelector(selectFlowState, (state: FlowState) => state.transitionRequired); export const selectDragging = createSelector(selectFlowState, (state: FlowState) => state.dragging); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas-routing.module.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas-routing.module.ts index 0df4294bce..78f344634c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas-routing.module.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas-routing.module.ts @@ -29,7 +29,10 @@ const routes: Routes = [ { path: ':type/:id', component: Canvas, - children: [{ path: 'edit', component: Canvas }] + children: [ + { path: 'edit', component: Canvas }, + { path: 'history', component: Canvas } + ] } ] } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.ts index ad9f6be0a4..46402f5df6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/canvas.component.ts @@ -53,7 +53,8 @@ import { selectRemoteProcessGroup, selectSingleEditedComponent, selectSingleSelectedComponent, - selectSkipTransform + selectSkipTransform, + selectViewStatusHistoryComponent } from '../../state/flow/flow.selectors'; import { filter, map, switchMap, take, withLatestFrom } from 'rxjs'; import { restoreViewport, zoomFit } from '../../state/transform/transform.actions'; @@ -61,6 +62,7 @@ import { ComponentType } from '../../../../state/shared'; import { initialState } from '../../state/flow/flow.reducer'; import { ContextMenuDefinitionProvider } from '../../../../ui/common/context-menu/context-menu.component'; import { CanvasContextMenu } from '../../service/canvas-context-menu.service'; +import { getStatusHistoryAndOpenDialog } from '../../../../state/status-history/status-history.actions'; @Component({ selector: 'fd-canvas', @@ -72,7 +74,7 @@ export class Canvas implements OnInit, OnDestroy { private canvas: any; private scale: number = INITIAL_SCALE; - private canvasClicked: boolean = false; + private canvasClicked = false; constructor( private viewContainerRef: ViewContainerRef, @@ -239,6 +241,28 @@ export class Canvas implements OnInit, OnDestroy { }) ); }); + + this.store + .select(selectCurrentProcessGroupId) + .pipe( + filter((processGroupId) => processGroupId != initialState.id), + switchMap(() => this.store.select(selectViewStatusHistoryComponent)), + filter((selectedComponent) => selectedComponent != null), + takeUntilDestroyed() + ) + .subscribe((component) => { + if (component) { + this.store.dispatch( + getStatusHistoryAndOpenDialog({ + request: { + source: 'canvas', + componentType: component.componentType, + componentId: component.id + } + }) + ); + } + }); } ngOnInit(): void { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.html b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.html index 81eb270f47..0deb4084f5 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.html +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.html @@ -110,7 +110,7 @@ Flow Configuration History - diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.ts index 27ab07c29e..353e645181 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/ui/canvas/header/header.component.ts @@ -38,6 +38,7 @@ import { AsyncPipe, NgIf, NgOptimizedImage } from '@angular/common'; import { MatDividerModule } from '@angular/material/divider'; import { RouterLink } from '@angular/router'; import { FlowStatus } from './flow-status/flow-status.component'; +import * as StatusHistoryActions from '../../../../../state/status-history/status-history.actions'; @Component({ selector: 'fd-header', @@ -84,4 +85,14 @@ export class HeaderComponent { logout(): void { this.authService.logout(); } + + viewNodeStatusHistory(): void { + this.store.dispatch( + StatusHistoryActions.getNodeStatusHistoryAndOpenDialog({ + request: { + source: 'menu' + } + }) + ); + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/status-history.service.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/status-history.service.ts index 2527f1b4ce..669e8ffb69 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/status-history.service.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/status-history.service.ts @@ -29,7 +29,7 @@ export class StatusHistoryService { private client: Client ) {} - getProcessorStatusHistory(componentType: ComponentType, componentId: string) { + getComponentStatusHistory(componentType: ComponentType, componentId: string) { let componentPath: string; switch (componentType) { case ComponentType.Processor: @@ -51,4 +51,8 @@ export class StatusHistoryService { `${StatusHistoryService.API}/flow/${componentPath}/${encodeURIComponent(componentId)}/status/history` ); } + + getNodeStatusHistory() { + return this.httpClient.get(`${StatusHistoryService.API}/controller/status/history`); + } } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/index.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/index.ts index eacd6be520..6cb0a355aa 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/index.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/index.ts @@ -25,6 +25,10 @@ export interface StatusHistoryRequest { componentType: ComponentType; } +export interface NodeStatusHistoryRequest { + source: string; +} + export interface FieldDescriptor { description: string; field: string; diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.actions.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.actions.ts index de072b8c08..b1c5c59c86 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.actions.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.actions.ts @@ -16,9 +16,9 @@ */ import { createAction, props } from '@ngrx/store'; -import { StatusHistoryRequest, StatusHistoryResponse } from './index'; +import { NodeStatusHistoryRequest, StatusHistoryRequest, StatusHistoryResponse } from './index'; -const STATUS_HISTORY_PREFIX: string = '[Status History]'; +const STATUS_HISTORY_PREFIX = '[Status History]'; export const reloadStatusHistory = createAction( `${STATUS_HISTORY_PREFIX} Reload Status History`, @@ -30,6 +30,11 @@ export const getStatusHistoryAndOpenDialog = createAction( props<{ request: StatusHistoryRequest }>() ); +export const getNodeStatusHistoryAndOpenDialog = createAction( + `${STATUS_HISTORY_PREFIX} Get Node Status History and Open Dialog`, + props<{ request: NodeStatusHistoryRequest }>() +); + export const reloadStatusHistorySuccess = createAction( `${STATUS_HISTORY_PREFIX} Reload Status History Success`, props<{ response: StatusHistoryResponse }>() @@ -37,12 +42,12 @@ export const reloadStatusHistorySuccess = createAction( export const loadStatusHistorySuccess = createAction( `${STATUS_HISTORY_PREFIX} Load Status History Success`, - props<{ request: StatusHistoryRequest; response: StatusHistoryResponse }>() + props<{ request: StatusHistoryRequest | NodeStatusHistoryRequest; response: StatusHistoryResponse }>() ); export const openStatusHistoryDialog = createAction( `${STATUS_HISTORY_PREFIX} Open Status History Dialog`, - props<{ request: StatusHistoryRequest }>() + props<{ request: StatusHistoryRequest | NodeStatusHistoryRequest }>() ); export const statusHistoryApiError = createAction( @@ -56,3 +61,8 @@ export const viewStatusHistoryComplete = createAction( `${STATUS_HISTORY_PREFIX} View Status History Complete`, props<{ request: StatusHistoryRequest }>() ); + +export const viewNodeStatusHistoryComplete = createAction( + `${STATUS_HISTORY_PREFIX} View Node Status History Complete`, + props<{ request: NodeStatusHistoryRequest }>() +); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.effects.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.effects.ts index 5a0bb03c59..3d8ec8171e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.effects.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/state/status-history/status-history.effects.ts @@ -43,7 +43,7 @@ export class StatusHistoryEffects { switchMap((request: StatusHistoryRequest) => from( this.statusHistoryService - .getProcessorStatusHistory(request.componentType, request.componentId) + .getComponentStatusHistory(request.componentType, request.componentId) .pipe( map((response: any) => StatusHistoryActions.reloadStatusHistorySuccess({ @@ -75,7 +75,7 @@ export class StatusHistoryEffects { switchMap((request) => from( this.statusHistoryService - .getProcessorStatusHistory(request.componentType, request.componentId) + .getComponentStatusHistory(request.componentType, request.componentId) .pipe( map((response: any) => StatusHistoryActions.loadStatusHistorySuccess({ @@ -101,6 +101,37 @@ export class StatusHistoryEffects { ) ); + getNodeStatusHistoryAndOpenDialog$ = createEffect(() => + this.actions$.pipe( + ofType(StatusHistoryActions.getNodeStatusHistoryAndOpenDialog), + map((action) => action.request), + switchMap((request) => + from( + this.statusHistoryService.getNodeStatusHistory().pipe( + map((response: any) => + StatusHistoryActions.loadStatusHistorySuccess({ + request, + response: { + statusHistory: { + canRead: response.canRead, + statusHistory: response.statusHistory + } + } + }) + ), + catchError((error) => + of( + StatusHistoryActions.statusHistoryApiError({ + error: error.error + }) + ) + ) + ) + ) + ) + ) + ); + loadStatusHistorySuccess$ = createEffect(() => this.actions$.pipe( ofType(StatusHistoryActions.loadStatusHistorySuccess), @@ -122,15 +153,25 @@ export class StatusHistoryEffects { dialogReference.afterClosed().subscribe((response) => { if (response !== 'ROUTED') { - this.store.dispatch( - StatusHistoryActions.viewStatusHistoryComplete({ - request: { - source: request.source, - componentType: request.componentType, - componentId: request.componentId - } - }) - ); + if ('componentType' in request) { + this.store.dispatch( + StatusHistoryActions.viewStatusHistoryComplete({ + request: { + source: request.source, + componentType: request.componentType, + componentId: request.componentId + } + }) + ); + } else { + this.store.dispatch( + StatusHistoryActions.viewNodeStatusHistoryComplete({ + request: { + source: request.source + } + }) + ); + } } }); })