Merge pull request #1637 from 4Science/CST-5535

Add admin panel for actuator information
This commit is contained in:
Tim Donohue
2022-06-08 09:11:58 -05:00
committed by GitHub
40 changed files with 1301 additions and 18 deletions

View File

@@ -80,6 +80,7 @@
"@nicky-lenaers/ngx-scroll-to": "^9.0.0", "@nicky-lenaers/ngx-scroll-to": "^9.0.0",
"angular-idle-preload": "3.0.0", "angular-idle-preload": "3.0.0",
"angulartics2": "^12.0.0", "angulartics2": "^12.0.0",
"axios": "^0.27.2",
"bootstrap": "4.3.1", "bootstrap": "4.3.1",
"caniuse-lite": "^1.0.30001165", "caniuse-lite": "^1.0.30001165",
"cerialize": "0.1.18", "cerialize": "0.1.18",
@@ -212,4 +213,4 @@
"webpack-cli": "^4.2.0", "webpack-cli": "^4.2.0",
"webpack-dev-server": "^4.5.0" "webpack-dev-server": "^4.5.0"
} }
} }

View File

@@ -19,6 +19,7 @@ import 'zone.js/node';
import 'reflect-metadata'; import 'reflect-metadata';
import 'rxjs'; import 'rxjs';
import axios from 'axios';
import * as pem from 'pem'; import * as pem from 'pem';
import * as https from 'https'; import * as https from 'https';
import * as morgan from 'morgan'; import * as morgan from 'morgan';
@@ -38,14 +39,14 @@ import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
import { environment } from './src/environments/environment'; import { environment } from './src/environments/environment';
import { createProxyMiddleware } from 'http-proxy-middleware'; import { createProxyMiddleware } from 'http-proxy-middleware';
import { hasValue, hasNoValue } from './src/app/shared/empty.util'; import { hasNoValue, hasValue } from './src/app/shared/empty.util';
import { UIServerConfig } from './src/config/ui-server-config.interface'; import { UIServerConfig } from './src/config/ui-server-config.interface';
import { ServerAppModule } from './src/main.server'; import { ServerAppModule } from './src/main.server';
import { buildAppConfig } from './src/config/config.server'; import { buildAppConfig } from './src/config/config.server';
import { AppConfig, APP_CONFIG } from './src/config/app-config.interface'; import { APP_CONFIG, AppConfig } from './src/config/app-config.interface';
import { extendEnvironmentWithAppConfig } from './src/config/config.util'; import { extendEnvironmentWithAppConfig } from './src/config/config.util';
/* /*
@@ -174,6 +175,11 @@ export function app() {
*/ */
router.use('/iiif', express.static(IIIF_VIEWER, { index: false })); router.use('/iiif', express.static(IIIF_VIEWER, { index: false }));
/**
* Checking server status
*/
server.get('/app/health', healthCheck);
// Register the ngApp callback function to handle incoming requests // Register the ngApp callback function to handle incoming requests
router.get('*', ngApp); router.get('*', ngApp);
@@ -319,6 +325,21 @@ function start() {
} }
} }
/*
* The callback function to serve health check requests
*/
function healthCheck(req, res) {
const baseUrl = `${environment.rest.baseUrl}${environment.actuators.endpointPath}`;
axios.get(baseUrl)
.then((response) => {
res.status(response.status).send(response.data);
})
.catch((error) => {
res.status(error.response.status).send({
error: error.message
});
});
}
// Webpack will replace 'require' with '__webpack_require__' // Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require' // '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle. // The below code is to ensure that the server is run only when not requiring the bundle.

View File

@@ -122,3 +122,5 @@ export const REQUEST_COPY_MODULE_PATH = 'request-a-copy';
export function getRequestCopyModulePath() { export function getRequestCopyModulePath() {
return `/${REQUEST_COPY_MODULE_PATH}`; return `/${REQUEST_COPY_MODULE_PATH}`;
} }
export const HEALTH_PAGE_PATH = 'health';

View File

@@ -3,13 +3,16 @@ import { RouterModule, NoPreloading } from '@angular/router';
import { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; import { AuthBlockingGuard } from './core/auth/auth-blocking.guard';
import { AuthenticatedGuard } from './core/auth/authenticated.guard'; import { AuthenticatedGuard } from './core/auth/authenticated.guard';
import { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; import {
SiteAdministratorGuard
} from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
import { import {
ACCESS_CONTROL_MODULE_PATH, ACCESS_CONTROL_MODULE_PATH,
ADMIN_MODULE_PATH, ADMIN_MODULE_PATH,
BITSTREAM_MODULE_PATH, BITSTREAM_MODULE_PATH,
FORBIDDEN_PATH, FORBIDDEN_PATH,
FORGOT_PASSWORD_PATH, FORGOT_PASSWORD_PATH,
HEALTH_PAGE_PATH,
INFO_MODULE_PATH, INFO_MODULE_PATH,
INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR,
LEGACY_BITSTREAM_MODULE_PATH, LEGACY_BITSTREAM_MODULE_PATH,
@@ -27,8 +30,12 @@ import { EndUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-
import { SiteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard'; import { SiteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard';
import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component'; import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component';
import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component'; import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component';
import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard'; import {
import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component'; GroupAdministratorGuard
} from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
import {
ThemedPageInternalServerErrorComponent
} from './page-internal-server-error/themed-page-internal-server-error.component';
import { ServerCheckGuard } from './core/server-check/server-check.guard'; import { ServerCheckGuard } from './core/server-check/server-check.guard';
import { MenuResolver } from './menu.resolver'; import { MenuResolver } from './menu.resolver';
@@ -210,6 +217,11 @@ import { MenuResolver } from './menu.resolver';
loadChildren: () => import('./statistics-page/statistics-page-routing.module') loadChildren: () => import('./statistics-page/statistics-page-routing.module')
.then((m) => m.StatisticsPageRoutingModule) .then((m) => m.StatisticsPageRoutingModule)
}, },
{
path: HEALTH_PAGE_PATH,
loadChildren: () => import('./health-page/health-page.module')
.then((m) => m.HealthPageModule)
},
{ {
path: ACCESS_CONTROL_MODULE_PATH, path: ACCESS_CONTROL_MODULE_PATH,
loadChildren: () => import('./access-control/access-control.module').then((m) => m.AccessControlModule), loadChildren: () => import('./access-control/access-control.module').then((m) => m.AccessControlModule),

View File

@@ -0,0 +1,27 @@
<div *ngFor="let entry of healthInfoComponent | dsObjNgFor" data-test="collapse">
<div *ngIf="entry && !isPlainProperty(entry.value)" class="mb-3 border-bottom">
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
aria-controls="collapseExample">
{{ entry.key | titlecase }}
</button>
<div class="d-inline-block">
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
</div>
</div>
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
<div class="card border-0">
<div class="card-body">
<ds-health-info-component [healthInfoComponent]="entry.value"
[healthInfoComponentName]="entry.key"
[isNested]="true"
data-test="info-component"></ds-health-info-component>
</div>
</div>
</div>
</div>
<ng-container *ngIf="entry && isPlainProperty(entry.value)">
<p data-test="property"> <span class="font-weight-bold">{{ getPropertyLabel(entry.key) | titlecase }}</span> : {{entry.value}}</p>
</ng-container>
</div>

View File

@@ -0,0 +1,3 @@
.collapse-toggle {
cursor: pointer;
}

View File

@@ -0,0 +1,82 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap';
import { HealthInfoComponentComponent } from './health-info-component.component';
import { HealthInfoComponentOne, HealthInfoComponentTwo } from '../../../shared/mocks/health-endpoint.mocks';
import { ObjNgFor } from '../../../shared/utils/object-ngfor.pipe';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
describe('HealthInfoComponentComponent', () => {
let component: HealthInfoComponentComponent;
let fixture: ComponentFixture<HealthInfoComponentComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CommonModule,
NgbCollapseModule,
NoopAnimationsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
})
],
declarations: [
HealthInfoComponentComponent,
ObjNgFor
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthInfoComponentComponent);
component = fixture.componentInstance;
});
describe('when has nested components', () => {
beforeEach(() => {
component.healthInfoComponentName = 'App';
component.healthInfoComponent = HealthInfoComponentOne;
component.isCollapsed = false;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should display property', () => {
const properties = fixture.debugElement.queryAll(By.css('[data-test="property"]'));
expect(properties.length).toBe(14);
const components = fixture.debugElement.queryAll(By.css('[data-test="info-component"]'));
expect(components.length).toBe(4);
});
});
describe('when has plain properties', () => {
beforeEach(() => {
component.healthInfoComponentName = 'Java';
component.healthInfoComponent = HealthInfoComponentTwo;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should display property', () => {
const property = fixture.debugElement.queryAll(By.css('[data-test="property"]'));
expect(property.length).toBe(1);
});
});
});

View File

@@ -0,0 +1,46 @@
import { Component, Input } from '@angular/core';
import { HealthInfoComponent } from '../../models/health-component.model';
import { HealthComponentComponent } from '../../health-panel/health-component/health-component.component';
/**
* Shows a health info object
*/
@Component({
selector: 'ds-health-info-component',
templateUrl: './health-info-component.component.html',
styleUrls: ['./health-info-component.component.scss']
})
export class HealthInfoComponentComponent extends HealthComponentComponent {
/**
* The HealthInfoComponent object to display
*/
@Input() healthInfoComponent: HealthInfoComponent|string;
/**
* The HealthInfoComponent object name
*/
@Input() healthInfoComponentName: string;
/**
* A boolean representing if div should start collapsed
*/
@Input() isNested = false;
/**
* A boolean representing if div should start collapsed
*/
public isCollapsed = false;
/**
* Check if the HealthInfoComponent is has only string property or contains object
*
* @param entry The HealthInfoComponent to check
* @return boolean
*/
isPlainProperty(entry: HealthInfoComponent | string): boolean {
return typeof entry === 'string';
}
}

View File

@@ -0,0 +1,25 @@
<ng-container *ngIf="healthInfoResponse">
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
<ngb-panel [id]="entry.key" *ngFor="let entry of healthInfoResponse | dsObjNgFor">
<ng-template ngbPanelHeader>
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="info-component">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
aria-controls="collapsePanels">
{{ getPanelLabel(entry.key) | titlecase }}
</button>
<div class="text-right d-flex">
<ds-health-status [status]="entry.value?.status"></ds-health-status>
<div class="ml-3 d-inline-block">
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
</div>
</div>
</div>
</ng-template>
<ng-template ngbPanelContent>
<ds-health-info-component [healthInfoComponentName]="entry.key"
[healthInfoComponent]="entry.value"></ds-health-info-component>
</ng-template>
</ngb-panel>
</ngb-accordion>
</ng-container>

View File

@@ -0,0 +1,3 @@
.collapse-toggle {
cursor: pointer;
}

View File

@@ -0,0 +1,51 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HealthInfoComponent } from './health-info.component';
import { HealthInfoResponseObj } from '../../shared/mocks/health-endpoint.mocks';
import { ObjNgFor } from '../../shared/utils/object-ngfor.pipe';
import { By } from '@angular/platform-browser';
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
describe('HealthInfoComponent', () => {
let component: HealthInfoComponent;
let fixture: ComponentFixture<HealthInfoComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
NgbAccordionModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
})
],
declarations: [
HealthInfoComponent,
ObjNgFor
],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthInfoComponent);
component = fixture.componentInstance;
component.healthInfoResponse = HealthInfoResponseObj;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create info component properly', () => {
const components = fixture.debugElement.queryAll(By.css('[data-test="info-component"]'));
expect(components.length).toBe(3);
});
});

View File

@@ -0,0 +1,46 @@
import { Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HealthInfoResponse } from '../models/health-component.model';
/**
* A component to render a "health-info component" object.
*
* Note that the word "component" in "health-info component" doesn't refer to Angular use of the term
* but rather to the components used in the response of the health endpoint of Spring's Actuator
* API.
*/
@Component({
selector: 'ds-health-info',
templateUrl: './health-info.component.html',
styleUrls: ['./health-info.component.scss']
})
export class HealthInfoComponent implements OnInit {
@Input() healthInfoResponse: HealthInfoResponse;
/**
* The first active panel id
*/
activeId: string;
constructor(private translate: TranslateService) {
}
ngOnInit(): void {
this.activeId = Object.keys(this.healthInfoResponse)[0];
}
/**
* Return translated label if exist for the given property
*
* @param panelKey
*/
public getPanelLabel(panelKey: string): string {
const translationKey = `health-page.section-info.${panelKey}.title`;
const translation = this.translate.instant(translationKey);
return (translation === translationKey) ? panelKey : translation;
}
}

View File

@@ -0,0 +1,27 @@
<div class="container" *ngIf="(healthResponseInitialised | async) && (healthInfoResponseInitialised | async)">
<h2>{{'health-page.heading' | translate}}</h2>
<div *ngIf="(healthResponse | async) && (healthInfoResponse | async)">
<ul ngbNav #nav="ngbNav" [activeId]="'status'" class="nav-tabs">
<li [ngbNavItem]="'status'">
<a ngbNavLink>{{'health-page.status-tab' | translate}}</a>
<ng-template ngbNavContent>
<div id="status">
<ds-health-panel [healthResponse]="(healthResponse | async)"></ds-health-panel>
</div>
</ng-template>
</li>
<li [ngbNavItem]="'info'">
<a ngbNavLink>{{'health-page.info-tab' | translate}}</a>
<ng-template ngbNavContent>
<div id="info">
<ds-health-info [healthInfoResponse]="(healthInfoResponse | async)"></ds-health-info>
</div>
</ng-template>
</li>
</ul>
<div [ngbNavOutlet]="nav" class="mt-2"></div>
</div>
<ds-alert *ngIf="!(healthResponse | async) || !(healthInfoResponse | async)" [type]="'alert-danger'" [content]="'health-page.error.msg'"></ds-alert>
</div>

View File

@@ -0,0 +1,72 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { By } from '@angular/platform-browser';
import { of } from 'rxjs';
import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { HealthPageComponent } from './health-page.component';
import { HealthService } from './health.service';
import { HealthInfoResponseObj, HealthResponseObj } from '../shared/mocks/health-endpoint.mocks';
import { RawRestResponse } from '../core/dspace-rest/raw-rest-response.model';
import { TranslateLoaderMock } from '../shared/mocks/translate-loader.mock';
describe('HealthPageComponent', () => {
let component: HealthPageComponent;
let fixture: ComponentFixture<HealthPageComponent>;
const healthService = jasmine.createSpyObj('healthDataService', {
getHealth: jasmine.createSpy('getHealth'),
getInfo: jasmine.createSpy('getInfo'),
});
const healthRestResponse$ = of({
payload: HealthResponseObj,
statusCode: 200,
statusText: 'OK'
} as RawRestResponse);
const healthInfoRestResponse$ = of({
payload: HealthInfoResponseObj,
statusCode: 200,
statusText: 'OK'
} as RawRestResponse);
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CommonModule,
NgbNavModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
})
],
declarations: [ HealthPageComponent ],
providers: [
{ provide: HealthService, useValue: healthService }
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthPageComponent);
component = fixture.componentInstance;
healthService.getHealth.and.returnValue(healthRestResponse$);
healthService.getInfo.and.returnValue(healthInfoRestResponse$);
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create nav items properly', () => {
const navItems = fixture.debugElement.queryAll(By.css('li.nav-item'));
expect(navItems.length).toBe(2);
});
});

View File

@@ -0,0 +1,66 @@
import { Component, OnInit } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { take } from 'rxjs/operators';
import { HealthService } from './health.service';
import { HealthInfoResponse, HealthResponse } from './models/health-component.model';
@Component({
selector: 'ds-health-page',
templateUrl: './health-page.component.html',
styleUrls: ['./health-page.component.scss']
})
export class HealthPageComponent implements OnInit {
/**
* Health info endpoint response
*/
healthInfoResponse: BehaviorSubject<HealthInfoResponse> = new BehaviorSubject<HealthInfoResponse>(null);
/**
* Health endpoint response
*/
healthResponse: BehaviorSubject<HealthResponse> = new BehaviorSubject<HealthResponse>(null);
/**
* Represent if the response from health status endpoint is already retrieved or not
*/
healthResponseInitialised: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
/**
* Represent if the response from health info endpoint is already retrieved or not
*/
healthInfoResponseInitialised: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
constructor(private healthDataService: HealthService) {
}
/**
* Retrieve responses from rest
*/
ngOnInit(): void {
this.healthDataService.getHealth().pipe(take(1)).subscribe({
next: (data: any) => {
this.healthResponse.next(data.payload);
this.healthResponseInitialised.next(true);
},
error: () => {
this.healthResponse.next(null);
this.healthResponseInitialised.next(true);
}
});
this.healthDataService.getInfo().pipe(take(1)).subscribe({
next: (data: any) => {
this.healthInfoResponse.next(data.payload);
this.healthInfoResponseInitialised.next(true);
},
error: () => {
this.healthInfoResponse.next(null);
this.healthInfoResponseInitialised.next(true);
}
});
}
}

View File

@@ -0,0 +1,35 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { HealthPageRoutingModule } from './health-page.routing.module';
import { HealthPanelComponent } from './health-panel/health-panel.component';
import { HealthStatusComponent } from './health-panel/health-status/health-status.component';
import { SharedModule } from '../shared/shared.module';
import { HealthPageComponent } from './health-page.component';
import { HealthComponentComponent } from './health-panel/health-component/health-component.component';
import { HealthInfoComponent } from './health-info/health-info.component';
import { HealthInfoComponentComponent } from './health-info/health-info-component/health-info-component.component';
@NgModule({
imports: [
CommonModule,
HealthPageRoutingModule,
NgbModule,
SharedModule,
TranslateModule
],
declarations: [
HealthPageComponent,
HealthPanelComponent,
HealthStatusComponent,
HealthComponentComponent,
HealthInfoComponent,
HealthInfoComponentComponent,
]
})
export class HealthPageModule {
}

View File

@@ -0,0 +1,28 @@
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { HealthPageComponent } from './health-page.component';
import {
SiteAdministratorGuard
} from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
resolve: { breadcrumb: I18nBreadcrumbResolver },
data: {
breadcrumbKey: 'health',
title: 'health-page.title',
},
canActivate: [SiteAdministratorGuard],
component: HealthPageComponent
}
])
]
})
export class HealthPageRoutingModule {
}

View File

@@ -0,0 +1,30 @@
<ng-container *ngIf="healthComponent?.components">
<div *ngFor="let entry of healthComponent?.components | dsObjNgFor" class="mb-3 border-bottom" data-test="collapse">
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
aria-controls="collapseExample">
{{ entry.key | titlecase }}
</button>
<div class="d-inline-block">
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
</div>
</div>
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
<div class="card border-0">
<div class="card-body">
<ds-health-component [healthComponent]="entry.value"
[healthComponentName]="entry.key"></ds-health-component>
</div>
</div>
</div>
</div>
</ng-container>
<ng-container *ngIf="healthComponent?.details">
<div *ngFor="let item of healthComponent?.details | dsObjNgFor" data-test="details">
<p data-test="property"><span class="font-weight-bold">{{ getPropertyLabel(item.key) | titlecase }}</span> : {{item.value}}</p>
</div>
</ng-container>
<ng-container *ngIf="!healthComponent?.details && !healthComponent?.components">
<ds-alert [content]="'health-page.section.no-issues'" [type]="AlertTypeEnum.Info"></ds-alert>
</ng-container>

View File

@@ -0,0 +1,3 @@
.collapse-toggle {
cursor: pointer;
}

View File

@@ -0,0 +1,85 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonModule } from '@angular/common';
import { By } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NgbCollapseModule } from '@ng-bootstrap/ng-bootstrap';
import { HealthComponentComponent } from './health-component.component';
import { HealthComponentOne, HealthComponentTwo } from '../../../shared/mocks/health-endpoint.mocks';
import { ObjNgFor } from '../../../shared/utils/object-ngfor.pipe';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
describe('HealthComponentComponent', () => {
let component: HealthComponentComponent;
let fixture: ComponentFixture<HealthComponentComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CommonModule,
NgbCollapseModule,
NoopAnimationsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
})
],
declarations: [
HealthComponentComponent,
ObjNgFor
],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponentComponent);
component = fixture.componentInstance;
});
describe('when has nested components', () => {
beforeEach(() => {
component.healthComponentName = 'db';
component.healthComponent = HealthComponentOne;
component.isCollapsed = false;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create collapsible divs properly', () => {
const collapseDivs = fixture.debugElement.queryAll(By.css('[data-test="collapse"]'));
expect(collapseDivs.length).toBe(2);
const detailsDivs = fixture.debugElement.queryAll(By.css('[data-test="details"]'));
expect(detailsDivs.length).toBe(6);
});
});
describe('when has details', () => {
beforeEach(() => {
component.healthComponentName = 'geoIp';
component.healthComponent = HealthComponentTwo;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create detail divs properly', () => {
const detailsDivs = fixture.debugElement.queryAll(By.css('[data-test="details"]'));
expect(detailsDivs.length).toBe(1);
const collapseDivs = fixture.debugElement.queryAll(By.css('[data-test="collapse"]'));
expect(collapseDivs.length).toBe(0);
});
});
});

View File

@@ -0,0 +1,53 @@
import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HealthComponent } from '../../models/health-component.model';
import { AlertType } from '../../../shared/alert/aletr-type';
/**
* A component to render a "health component" object.
*
* Note that the word "component" in "health component" doesn't refer to Angular use of the term
* but rather to the components used in the response of the health endpoint of Spring's Actuator
* API.
*/
@Component({
selector: 'ds-health-component',
templateUrl: './health-component.component.html',
styleUrls: ['./health-component.component.scss']
})
export class HealthComponentComponent {
/**
* The HealthComponent object to display
*/
@Input() healthComponent: HealthComponent;
/**
* The HealthComponent object name
*/
@Input() healthComponentName: string;
public AlertTypeEnum = AlertType;
/**
* A boolean representing if div should start collapsed
*/
public isCollapsed = false;
constructor(private translate: TranslateService) {
}
/**
* Return translated label if exist for the given property
*
* @param property
*/
public getPropertyLabel(property: string): string {
const translationKey = `health-page.property.${property}`;
const translation = this.translate.instant(translationKey);
return (translation === translationKey) ? property : translation;
}
}

View File

@@ -0,0 +1,25 @@
<p class="h4">{{'health-page.status' | translate}} : <ds-health-status [status]="healthResponse.status"></ds-health-status></p>
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
<ngb-panel [id]="entry.key" *ngFor="let entry of healthResponse.components | dsObjNgFor">
<ng-template ngbPanelHeader>
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
aria-controls="collapsePanels">
{{ getPanelLabel(entry.key) | titlecase }}
</button>
<div class="text-right d-flex">
<ds-health-status [status]="entry.value?.status"></ds-health-status>
<div class="ml-3 d-inline-block">
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
</div>
</div>
</div>
</ng-template>
<ng-template ngbPanelContent>
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"></ds-health-component>
</ng-template>
</ngb-panel>
</ngb-accordion>

View File

@@ -0,0 +1,3 @@
.collapse-toggle {
cursor: pointer;
}

View File

@@ -0,0 +1,57 @@
import { CommonModule } from '@angular/common';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { NgbAccordionModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
import { HealthPanelComponent } from './health-panel.component';
import { HealthResponseObj } from '../../shared/mocks/health-endpoint.mocks';
import { ObjNgFor } from '../../shared/utils/object-ngfor.pipe';
describe('HealthPanelComponent', () => {
let component: HealthPanelComponent;
let fixture: ComponentFixture<HealthPanelComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
NgbNavModule,
NgbAccordionModule,
CommonModule,
BrowserAnimationsModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
}),
],
declarations: [
HealthPanelComponent,
ObjNgFor
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthPanelComponent);
component = fixture.componentInstance;
component.healthResponse = HealthResponseObj;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render a panel for each component', () => {
const components = fixture.debugElement.queryAll(By.css('[data-test="component"]'));
expect(components.length).toBe(5);
});
});

View File

@@ -0,0 +1,45 @@
import { Component, Input, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { HealthResponse } from '../models/health-component.model';
/**
* Show the health panel
*/
@Component({
selector: 'ds-health-panel',
templateUrl: './health-panel.component.html',
styleUrls: ['./health-panel.component.scss']
})
export class HealthPanelComponent implements OnInit {
/**
* Health endpoint response
*/
@Input() healthResponse: HealthResponse;
/**
* The first active panel id
*/
activeId: string;
constructor(private translate: TranslateService) {
}
ngOnInit(): void {
this.activeId = Object.keys(this.healthResponse.components)[0];
}
/**
* Return translated label if exist for the given property
*
* @param panelKey
*/
public getPanelLabel(panelKey: string): string {
const translationKey = `health-page.section.${panelKey}.title`;
const translation = this.translate.instant(translationKey);
return (translation === translationKey) ? panelKey : translation;
}
}

View File

@@ -0,0 +1,12 @@
<ng-container [ngSwitch]="status">
<i *ngSwitchCase="HealthStatus.UP"
class="fa fa-check-circle text-success ml-2 mt-1"
ngbTooltip="{{'health-page.status.ok.info' | translate}}" container="body" ></i>
<i *ngSwitchCase="HealthStatus.UP_WITH_ISSUES"
class="fa fa-exclamation-triangle text-warning ml-2 mt-1"
ngbTooltip="{{'health-page.status.warning.info' | translate}}" container="body"></i>
<i *ngSwitchCase="HealthStatus.DOWN"
class="fa fa-times-circle text-danger ml-2 mt-1"
ngbTooltip="{{'health-page.status.error.info' | translate}}" container="body"></i>
</ng-container>

View File

@@ -0,0 +1,60 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { HealthStatusComponent } from './health-status.component';
import { HealthStatus } from '../../models/health-component.model';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
describe('HealthStatusComponent', () => {
let component: HealthStatusComponent;
let fixture: ComponentFixture<HealthStatusComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
NgbTooltipModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateLoaderMock
}
})
],
declarations: [ HealthStatusComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HealthStatusComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create success icon', () => {
component.status = HealthStatus.UP;
fixture.detectChanges();
const icon = fixture.debugElement.query(By.css('i.text-success'));
expect(icon).toBeTruthy();
});
it('should create warning icon', () => {
component.status = HealthStatus.UP_WITH_ISSUES;
fixture.detectChanges();
const icon = fixture.debugElement.query(By.css('i.text-warning'));
expect(icon).toBeTruthy();
});
it('should create success icon', () => {
component.status = HealthStatus.DOWN;
fixture.detectChanges();
const icon = fixture.debugElement.query(By.css('i.text-danger'));
expect(icon).toBeTruthy();
});
});

View File

@@ -0,0 +1,23 @@
import { Component, Input } from '@angular/core';
import { HealthStatus } from '../../models/health-component.model';
/**
* Show a health status object
*/
@Component({
selector: 'ds-health-status',
templateUrl: './health-status.component.html',
styleUrls: ['./health-status.component.scss']
})
export class HealthStatusComponent {
/**
* The current status to show
*/
@Input() status: HealthStatus;
/**
* He
*/
HealthStatus = HealthStatus;
}

View File

@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { DspaceRestService } from '../core/dspace-rest/dspace-rest.service';
import { RawRestResponse } from '../core/dspace-rest/raw-rest-response.model';
import { HALEndpointService } from '../core/shared/hal-endpoint.service';
@Injectable({
providedIn: 'root'
})
export class HealthService {
constructor(protected halService: HALEndpointService,
protected restService: DspaceRestService) {
}
/**
* @returns health data
*/
getHealth(): Observable<RawRestResponse> {
return this.halService.getEndpoint('/actuator').pipe(
map((restURL: string) => restURL + '/health'),
switchMap((endpoint: string) => this.restService.get(endpoint)));
}
/**
* @returns information of server
*/
getInfo(): Observable<RawRestResponse> {
return this.halService.getEndpoint('/actuator').pipe(
map((restURL: string) => restURL + '/info'),
switchMap((endpoint: string) => this.restService.get(endpoint)));
}
}

View File

@@ -0,0 +1,48 @@
/**
* Interface for Health Status
*/
export enum HealthStatus {
UP = 'UP',
UP_WITH_ISSUES = 'UP_WITH_ISSUES',
DOWN = 'DOWN'
}
/**
* Interface describing the Health endpoint response
*/
export interface HealthResponse {
status: HealthStatus;
components: {
[name: string]: HealthComponent;
};
}
/**
* Interface describing a single component retrieved from the Health endpoint response
*/
export interface HealthComponent {
status: HealthStatus;
details?: {
[name: string]: number|string;
};
components?: {
[name: string]: HealthComponent;
};
}
/**
* Interface describing the Health info endpoint response
*/
export interface HealthInfoResponse {
[name: string]: HealthInfoComponent|string;
}
/**
* Interface describing a single component retrieved from the Health info endpoint response
*/
export interface HealthInfoComponent {
[property: string]: HealthInfoComponent|string;
}

View File

@@ -15,18 +15,34 @@ import { MenuService } from './shared/menu/menu.service';
import { filter, find, map, take } from 'rxjs/operators'; import { filter, find, map, take } from 'rxjs/operators';
import { hasValue } from './shared/empty.util'; import { hasValue } from './shared/empty.util';
import { FeatureID } from './core/data/feature-authorization/feature-id'; import { FeatureID } from './core/data/feature-authorization/feature-id';
import { CreateCommunityParentSelectorComponent } from './shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component'; import {
CreateCommunityParentSelectorComponent
} from './shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component';
import { OnClickMenuItemModel } from './shared/menu/menu-item/models/onclick.model'; import { OnClickMenuItemModel } from './shared/menu/menu-item/models/onclick.model';
import { CreateCollectionParentSelectorComponent } from './shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component'; import {
import { CreateItemParentSelectorComponent } from './shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component'; CreateCollectionParentSelectorComponent
import { EditCommunitySelectorComponent } from './shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component'; } from './shared/dso-selector/modal-wrappers/create-collection-parent-selector/create-collection-parent-selector.component';
import { EditCollectionSelectorComponent } from './shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component'; import {
import { EditItemSelectorComponent } from './shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component'; CreateItemParentSelectorComponent
import { ExportMetadataSelectorComponent } from './shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component'; } from './shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component';
import {
EditCommunitySelectorComponent
} from './shared/dso-selector/modal-wrappers/edit-community-selector/edit-community-selector.component';
import {
EditCollectionSelectorComponent
} from './shared/dso-selector/modal-wrappers/edit-collection-selector/edit-collection-selector.component';
import {
EditItemSelectorComponent
} from './shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component';
import {
ExportMetadataSelectorComponent
} from './shared/dso-selector/modal-wrappers/export-metadata-selector/export-metadata-selector.component';
import { AuthorizationDataService } from './core/data/feature-authorization/authorization-data.service'; import { AuthorizationDataService } from './core/data/feature-authorization/authorization-data.service';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { import {
METADATA_EXPORT_SCRIPT_NAME, METADATA_IMPORT_SCRIPT_NAME, ScriptDataService METADATA_EXPORT_SCRIPT_NAME,
METADATA_IMPORT_SCRIPT_NAME,
ScriptDataService
} from './core/data/processes/script-data.service'; } from './core/data/processes/script-data.service';
/** /**
@@ -321,6 +337,18 @@ export class MenuResolver implements Resolve<boolean> {
icon: 'terminal', icon: 'terminal',
index: 10 index: 10
}, },
{
id: 'health',
active: false,
visible: isSiteAdmin,
model: {
type: MenuItemType.LINK,
text: 'menu.section.health',
link: '/health'
} as LinkMenuItemModel,
icon: 'heartbeat',
index: 11
},
]; ];
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, { menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, {
shouldPersistOnRouteChange: true shouldPersistOnRouteChange: true

View File

@@ -0,0 +1,160 @@
import {
HealthComponent,
HealthInfoComponent,
HealthInfoResponse,
HealthResponse,
HealthStatus
} from '../../health-page/models/health-component.model';
export const HealthResponseObj: HealthResponse = {
'status': HealthStatus.UP_WITH_ISSUES,
'components': {
'db': {
'status': HealthStatus.UP,
'components': {
'dataSource': {
'status': HealthStatus.UP,
'details': {
'database': 'PostgreSQL',
'result': 1,
'validationQuery': 'SELECT 1'
}
},
'dspaceDataSource': {
'status': HealthStatus.UP,
'details': {
'database': 'PostgreSQL',
'result': 1,
'validationQuery': 'SELECT 1'
}
}
}
},
'geoIp': {
'status': HealthStatus.UP_WITH_ISSUES,
'details': {
'reason': 'The GeoLite Database file is missing (/var/lib/GeoIP/GeoLite2-City.mmdb)! Solr Statistics cannot generate location based reports! Please see the DSpace installation instructions for instructions to install this file.'
}
},
'solrOaiCore': {
'status': HealthStatus.UP,
'details': {
'status': 0,
'detectedPathType': 'particular core'
}
},
'solrSearchCore': {
'status': HealthStatus.UP,
'details': {
'status': 0,
'detectedPathType': 'particular core'
}
},
'solrStatisticsCore': {
'status': HealthStatus.UP,
'details': {
'status': 0,
'detectedPathType': 'particular core'
}
}
}
};
export const HealthComponentOne: HealthComponent = {
'status': HealthStatus.UP,
'components': {
'dataSource': {
'status': HealthStatus.UP,
'details': {
'database': 'PostgreSQL',
'result': 1,
'validationQuery': 'SELECT 1'
}
},
'dspaceDataSource': {
'status': HealthStatus.UP,
'details': {
'database': 'PostgreSQL',
'result': 1,
'validationQuery': 'SELECT 1'
}
}
}
};
export const HealthComponentTwo: HealthComponent = {
'status': HealthStatus.UP_WITH_ISSUES,
'details': {
'reason': 'The GeoLite Database file is missing (/var/lib/GeoIP/GeoLite2-City.mmdb)! Solr Statistics cannot generate location based reports! Please see the DSpace installation instructions for instructions to install this file.'
}
};
export const HealthInfoResponseObj: HealthInfoResponse = {
'app': {
'name': 'DSpace at My University',
'dir': '/home/giuseppe/development/java/install/dspace7-review',
'url': 'http://localhost:8080/server',
'db': 'jdbc:postgresql://localhost:5432/dspace7',
'solr': {
'server': 'http://localhost:8983/solr',
'prefix': ''
},
'mail': {
'server': 'smtp.example.com',
'from-address': 'dspace-noreply@myu.edu',
'feedback-recipient': 'dspace-help@myu.edu',
'mail-admin': 'dspace-help@myu.edu',
'mail-helpdesk': 'dspace-help@myu.edu',
'alert-recipient': 'dspace-help@myu.edu'
},
'cors': {
'allowed-origins': 'http://localhost:4000'
},
'ui': {
'url': 'http://localhost:4000'
}
},
'java': {
'vendor': 'Private Build',
'version': '11.0.15',
'runtime': {
'name': 'OpenJDK Runtime Environment',
'version': '11.0.15+10-Ubuntu-0ubuntu0.20.04.1'
},
'jvm': {
'name': 'OpenJDK 64-Bit Server VM',
'vendor': 'Private Build',
'version': '11.0.15+10-Ubuntu-0ubuntu0.20.04.1'
}
},
'version': '7.3-SNAPSHOT'
};
export const HealthInfoComponentOne: HealthInfoComponent = {
'name': 'DSpace at My University',
'dir': '/home/giuseppe/development/java/install/dspace7-review',
'url': 'http://localhost:8080/server',
'db': 'jdbc:postgresql://localhost:5432/dspace7',
'solr': {
'server': 'http://localhost:8983/solr',
'prefix': ''
},
'mail': {
'server': 'smtp.example.com',
'from-address': 'dspace-noreply@myu.edu',
'feedback-recipient': 'dspace-help@myu.edu',
'mail-admin': 'dspace-help@myu.edu',
'mail-helpdesk': 'dspace-help@myu.edu',
'alert-recipient': 'dspace-help@myu.edu'
},
'cors': {
'allowed-origins': 'http://localhost:4000'
},
'ui': {
'url': 'http://localhost:4000'
}
};
export const HealthInfoComponentTwo = {
'version': '7.3-SNAPSHOT'
};

View File

@@ -1587,6 +1587,46 @@
"grant-request-copy.success": "Successfully granted item request", "grant-request-copy.success": "Successfully granted item request",
"health.breadcrumbs": "Health",
"health-page.heading" : "Health",
"health-page.info-tab" : "Info",
"health-page.status-tab" : "Status",
"health-page.error.msg": "The health check service is temporarily unavailable",
"health-page.property.status": "Status code",
"health-page.section.db.title": "Database",
"health-page.section.geoIp.title": "GeoIp",
"health-page.section.solrAuthorityCore.title": "Sor: authority core",
"health-page.section.solrOaiCore.title": "Sor: oai core",
"health-page.section.solrSearchCore.title": "Sor: search core",
"health-page.section.solrStatisticsCore.title": "Sor: statistics core",
"health-page.section-info.app.title": "Application Backend",
"health-page.section-info.java.title": "Java",
"health-page.status": "Status",
"health-page.status.ok.info": "Operational",
"health-page.status.error.info": "Problems detected",
"health-page.status.warning.info": "Possible issues detected",
"health-page.title": "Health",
"health-page.section.no-issues": "No issues detected",
"home.description": "", "home.description": "",
@@ -2540,13 +2580,15 @@
"menu.section.icon.find": "Find menu section", "menu.section.icon.find": "Find menu section",
"menu.section.icon.health": "Health check menu section",
"menu.section.icon.import": "Import menu section", "menu.section.icon.import": "Import menu section",
"menu.section.icon.new": "New menu section", "menu.section.icon.new": "New menu section",
"menu.section.icon.pin": "Pin sidebar", "menu.section.icon.pin": "Pin sidebar",
"menu.section.icon.processes": "Processes menu section", "menu.section.icon.processes": "Processes Health",
"menu.section.icon.registries": "Registries menu section", "menu.section.icon.registries": "Registries menu section",
@@ -2588,6 +2630,8 @@
"menu.section.processes": "Processes", "menu.section.processes": "Processes",
"menu.section.health": "Health",
"menu.section.registries": "Registries", "menu.section.registries": "Registries",
@@ -2954,8 +2998,6 @@
"profile.title": "Update Profile", "profile.title": "Update Profile",
"project.listelement.badge": "Research Project", "project.listelement.badge": "Research Project",
"project.page.contributor": "Contributors", "project.page.contributor": "Contributors",

View File

@@ -0,0 +1,11 @@
import { Config } from './config.interface';
/**
* Config that determines the spring Actuators options
*/
export class ActuatorsConfig implements Config {
/**
* The endpoint path
*/
public endpointPath: string;
}

View File

@@ -15,6 +15,7 @@ import { UIServerConfig } from './ui-server-config.interface';
import { MediaViewerConfig } from './media-viewer-config.interface'; import { MediaViewerConfig } from './media-viewer-config.interface';
import { BrowseByConfig } from './browse-by-config.interface'; import { BrowseByConfig } from './browse-by-config.interface';
import { BundleConfig } from './bundle-config.interface'; import { BundleConfig } from './bundle-config.interface';
import { ActuatorsConfig } from './actuators.config';
interface AppConfig extends Config { interface AppConfig extends Config {
ui: UIServerConfig; ui: UIServerConfig;
@@ -34,6 +35,7 @@ interface AppConfig extends Config {
themes: ThemeConfig[]; themes: ThemeConfig[];
mediaViewer: MediaViewerConfig; mediaViewer: MediaViewerConfig;
bundle: BundleConfig; bundle: BundleConfig;
actuators: ActuatorsConfig
} }
const APP_CONFIG = new InjectionToken<AppConfig>('APP_CONFIG'); const APP_CONFIG = new InjectionToken<AppConfig>('APP_CONFIG');

View File

@@ -15,6 +15,7 @@ import { SubmissionConfig } from './submission-config.interface';
import { ThemeConfig } from './theme.model'; import { ThemeConfig } from './theme.model';
import { UIServerConfig } from './ui-server-config.interface'; import { UIServerConfig } from './ui-server-config.interface';
import { BundleConfig } from './bundle-config.interface'; import { BundleConfig } from './bundle-config.interface';
import { ActuatorsConfig } from './actuators.config';
export class DefaultAppConfig implements AppConfig { export class DefaultAppConfig implements AppConfig {
production = false; production = false;
@@ -48,6 +49,10 @@ export class DefaultAppConfig implements AppConfig {
nameSpace: '/', nameSpace: '/',
}; };
actuators: ActuatorsConfig = {
endpointPath: '/actuator/health'
};
// Caching settings // Caching settings
cache: CacheConfig = { cache: CacheConfig = {
// NOTE: how long should objects be cached for by default // NOTE: how long should objects be cached for by default

View File

@@ -38,6 +38,10 @@ export const environment: BuildConfig = {
baseUrl: 'https://rest.com/api' baseUrl: 'https://rest.com/api'
}, },
actuators: {
endpointPath: '/actuator/health'
},
// Caching settings // Caching settings
cache: { cache: {
// NOTE: how long should objects be cached for by default // NOTE: how long should objects be cached for by default

View File

@@ -3221,6 +3221,14 @@ axios@0.21.4:
dependencies: dependencies:
follow-redirects "^1.14.0" follow-redirects "^1.14.0"
axios@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
dependencies:
follow-redirects "^1.14.9"
form-data "^4.0.0"
axobject-query@^2.2.0: axobject-query@^2.2.0:
version "2.2.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
@@ -6118,7 +6126,7 @@ flatted@^3.1.0, flatted@^3.2.5:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3"
integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==
follow-redirects@^1.0.0, follow-redirects@^1.14.0: follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.9:
version "1.14.9" version "1.14.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==