Skip to content

Commit

Permalink
Nifi 12505 system diagnostics (apache#8190)
Browse files Browse the repository at this point in the history
* [NIFI-12505] System Diagnostics

* Refactor Status History dialog to use the load and open action pattern.

* address review feedback

This closes apache#8190
  • Loading branch information
rfellows authored Dec 28, 2023
1 parent a73d812 commit e15aecc
Show file tree
Hide file tree
Showing 31 changed files with 1,091 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { AboutEffects } from './state/about/about.effects';
import { StatusHistoryEffects } from './state/status-history/status-history.effects';
import { MatDialogModule } from '@angular/material/dialog';
import { ControllerServiceStateEffects } from './state/contoller-service-state/controller-service-state.effects';
import { SystemDiagnosticsEffects } from './state/system-diagnostics/system-diagnostics.effects';

// @ts-ignore
@NgModule({
Expand All @@ -62,7 +63,8 @@ import { ControllerServiceStateEffects } from './state/contoller-service-state/c
ExtensionTypesEffects,
AboutEffects,
StatusHistoryEffects,
ControllerServiceStateEffects
ControllerServiceStateEffects,
SystemDiagnosticsEffects
),
StoreDevtoolsModule.instrument({
maxAge: 25,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ import {
import { selectUser } from '../../../../state/user/user.selectors';
import { filter, switchMap, take } from 'rxjs';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { openStatusHistoryDialog } from '../../../../state/status-history/status-history.actions';
import {
getStatusHistoryAndOpenDialog,
openStatusHistoryDialog
} from '../../../../state/status-history/status-history.actions';
import { ComponentType } from '../../../../state/shared';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'connection-status-listing',
Expand Down Expand Up @@ -67,7 +71,7 @@ export class ConnectionStatusListing {
.subscribe((connection) => {
if (connection) {
this.store.dispatch(
openStatusHistoryDialog({
getStatusHistoryAndOpenDialog({
request: {
source: 'summary',
componentType: ComponentType.Connection,
Expand Down Expand Up @@ -104,4 +108,14 @@ export class ConnectionStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { PortStatusSnapshotEntity, SummaryListingState } from '../../state/summa
import { Store } from '@ngrx/store';
import { initialState } from '../../state/summary-listing/summary-listing.reducer';
import * as SummaryListingActions from '../../state/summary-listing/summary-listing.actions';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'input-port-status-listing',
Expand Down Expand Up @@ -59,4 +60,14 @@ export class InputPortStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Store } from '@ngrx/store';
import { PortStatusSnapshotEntity, SummaryListingState } from '../../state/summary-listing';
import { initialState } from '../../state/summary-listing/summary-listing.reducer';
import * as SummaryListingActions from '../../state/summary-listing/summary-listing.actions';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'output-port-status-listing',
Expand Down Expand Up @@ -61,4 +62,14 @@ export class OutputPortStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ import {
} from '../../state/summary-listing/summary-listing.selectors';
import { filter, switchMap, take } from 'rxjs';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { openStatusHistoryDialog } from '../../../../state/status-history/status-history.actions';
import {
getStatusHistoryAndOpenDialog,
openStatusHistoryDialog
} from '../../../../state/status-history/status-history.actions';
import { ComponentType } from '../../../../state/shared';
import { selectUser } from '../../../../state/user/user.selectors';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'process-group-status-listing',
Expand Down Expand Up @@ -70,7 +74,7 @@ export class ProcessGroupStatusListing {
.subscribe((pg) => {
if (pg) {
this.store.dispatch(
openStatusHistoryDialog({
getStatusHistoryAndOpenDialog({
request: {
source: 'summary',
componentType: ComponentType.ProcessGroup,
Expand Down Expand Up @@ -107,4 +111,14 @@ export class ProcessGroupStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ import {
import { ProcessorStatusSnapshotEntity, SummaryListingState } from '../../state/summary-listing';
import { selectUser } from '../../../../state/user/user.selectors';
import { initialState } from '../../state/summary-listing/summary-listing.reducer';
import { openStatusHistoryDialog } from '../../../../state/status-history/status-history.actions';
import {
getStatusHistoryAndOpenDialog,
openStatusHistoryDialog
} from '../../../../state/status-history/status-history.actions';
import { ComponentType } from '../../../../state/shared';
import { filter, switchMap, take } from 'rxjs';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import * as SummaryListingActions from '../../state/summary-listing/summary-listing.actions';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'processor-status-listing',
Expand Down Expand Up @@ -63,7 +67,7 @@ export class ProcessorStatusListing {
.subscribe((processor) => {
if (processor) {
this.store.dispatch(
openStatusHistoryDialog({
getStatusHistoryAndOpenDialog({
request: {
source: 'summary',
componentType: ComponentType.Processor,
Expand Down Expand Up @@ -100,4 +104,14 @@ export class ProcessorStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<div>Last updated:</div>
<div class="refresh-timestamp">{{ loadedTimestamp$ | async }}</div>
</div>
<div *ngIf="(currentUser$ | async)?.systemPermissions?.canRead">
<a (click)="openSystemDiagnostics()">System Diagnostics</a>
</div>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ import { Store } from '@ngrx/store';
import { RemoteProcessGroupStatusSnapshotEntity, SummaryListingState } from '../../state/summary-listing';
import { filter, switchMap, take } from 'rxjs';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { openStatusHistoryDialog } from '../../../../state/status-history/status-history.actions';
import {
getStatusHistoryAndOpenDialog,
openStatusHistoryDialog
} from '../../../../state/status-history/status-history.actions';
import { ComponentType } from '../../../../state/shared';
import { initialState } from '../../state/summary-listing/summary-listing.reducer';
import * as SummaryListingActions from '../../state/summary-listing/summary-listing.actions';
import { getSystemDiagnosticsAndOpenDialog } from '../../../../state/system-diagnostics/system-diagnostics.actions';

@Component({
selector: 'remote-process-group-status-listing',
Expand Down Expand Up @@ -62,7 +66,7 @@ export class RemoteProcessGroupStatusListing {
.subscribe((rpg) => {
if (rpg) {
this.store.dispatch(
openStatusHistoryDialog({
getStatusHistoryAndOpenDialog({
request: {
source: 'summary',
componentType: ComponentType.RemoteProcessGroup,
Expand Down Expand Up @@ -99,4 +103,14 @@ export class RemoteProcessGroupStatusListing {
})
);
}

openSystemDiagnostics() {
this.store.dispatch(
getSystemDiagnosticsAndOpenDialog({
request: {
nodewise: false
}
})
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Client } from './client.service';

@Injectable({ providedIn: 'root' })
export class SystemDiagnosticsService {
private static readonly API: string = '../nifi-api';

constructor(
private httpClient: HttpClient,
private client: Client
) {}

getSystemDiagnostics(nodewise?: boolean) {
if (nodewise) {
const params = {
nodewise: true
};
return this.httpClient.get(`${SystemDiagnosticsService.API}/system-diagnostics`, { params });
}
return this.httpClient.get(`${SystemDiagnosticsService.API}/system-diagnostics`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { statusHistoryFeatureKey, StatusHistoryState } from './status-history';
import { statusHistoryReducer } from './status-history/status-history.reducer';
import { controllerServiceStateFeatureKey, ControllerServiceState } from './contoller-service-state';
import { controllerServiceStateReducer } from './contoller-service-state/controller-service-state.reducer';
import { systemDiagnosticsFeatureKey, SystemDiagnosticsState } from './system-diagnostics';
import { systemDiagnosticsReducer } from './system-diagnostics/system-diagnostics.reducer';

export interface NiFiState {
router: RouterReducerState;
Expand All @@ -35,6 +37,7 @@ export interface NiFiState {
[aboutFeatureKey]: AboutState;
[statusHistoryFeatureKey]: StatusHistoryState;
[controllerServiceStateFeatureKey]: ControllerServiceState;
[systemDiagnosticsFeatureKey]: SystemDiagnosticsState;
}

export const rootReducers: ActionReducerMap<NiFiState> = {
Expand All @@ -43,5 +46,6 @@ export const rootReducers: ActionReducerMap<NiFiState> = {
[extensionTypesFeatureKey]: extensionTypesReducer,
[aboutFeatureKey]: aboutReducer,
[statusHistoryFeatureKey]: statusHistoryReducer,
[controllerServiceStateFeatureKey]: controllerServiceStateReducer
[controllerServiceStateFeatureKey]: controllerServiceStateReducer,
[systemDiagnosticsFeatureKey]: systemDiagnosticsReducer
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,24 @@ import { StatusHistoryRequest, StatusHistoryResponse } from './index';

const STATUS_HISTORY_PREFIX: string = '[Status History]';

export const loadStatusHistory = createAction(
`${STATUS_HISTORY_PREFIX} Load Status History`,
export const reloadStatusHistory = createAction(
`${STATUS_HISTORY_PREFIX} Reload Status History`,
props<{ request: StatusHistoryRequest }>()
);

export const getStatusHistoryAndOpenDialog = createAction(
`${STATUS_HISTORY_PREFIX} Get Status History and Open Dialog`,
props<{ request: StatusHistoryRequest }>()
);

export const reloadStatusHistorySuccess = createAction(
`${STATUS_HISTORY_PREFIX} Reload Status History Success`,
props<{ response: StatusHistoryResponse }>()
);

export const loadStatusHistorySuccess = createAction(
`${STATUS_HISTORY_PREFIX} Load Status History Success`,
props<{ response: StatusHistoryResponse }>()
props<{ request: StatusHistoryRequest; response: StatusHistoryResponse }>()
);

export const openStatusHistoryDialog = createAction(
Expand Down
Loading

0 comments on commit e15aecc

Please sign in to comment.