Merge branch 'feature/dashboard-health-check' of https://github.com/umbraco/Umbraco.CMS.Backoffice into feature/dashboard-health-check
This commit is contained in:
@@ -2,9 +2,9 @@ import { html, css, nothing } from 'lit';
|
||||
import { customElement, state } from 'lit/decorators.js';
|
||||
import { IRoute, IRoutingInfo, path } from 'router-slot';
|
||||
import { UmbDashboardHealthCheckGroupElement } from './views/health-check-group';
|
||||
import { UmbHealthCheckDashboardContext } from './health-check-dashboard.context';
|
||||
import { UmbLitElement } from '@umbraco-cms/element';
|
||||
import { ManifestHealthCheck, umbExtensionsRegistry } from '@umbraco-cms/extensions-registry';
|
||||
import { UmbHealthCheckDashboardContext } from './health-check-dashboard.context';
|
||||
|
||||
@customElement('umb-dashboard-health-check')
|
||||
export class UmbDashboardHealthCheckElement extends UmbLitElement {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { HealthCheckResource, HealthCheckWithResult } from '@umbraco-cms/backend-api';
|
||||
import { tryExecuteAndNotify } from '@umbraco-cms/resources';
|
||||
import { UmbControllerHostInterface } from 'src/core/controller/controller-host.mixin';
|
||||
|
||||
export class UmbHealthCheckContext {
|
||||
private _checks: BehaviorSubject<Array<any>> = new BehaviorSubject(<Array<any>>[]);
|
||||
@@ -8,32 +10,36 @@ export class UmbHealthCheckContext {
|
||||
private _results: BehaviorSubject<Array<any>> = new BehaviorSubject(<Array<any>>[]);
|
||||
public readonly results: Observable<Array<any>> = this._results.asObservable();
|
||||
|
||||
public host = null;
|
||||
public host: UmbControllerHostInterface;
|
||||
|
||||
constructor(host: any) {
|
||||
constructor(host: UmbControllerHostInterface) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
async getGroupChecks(name: string) {
|
||||
const response = await HealthCheckResource.getHealthCheckGroupByName({ name });
|
||||
response.checks?.forEach((check) => {
|
||||
delete check.results;
|
||||
});
|
||||
const { data } = await tryExecuteAndNotify(this.host, HealthCheckResource.getHealthCheckGroupByName({ name }));
|
||||
|
||||
this._checks.next(response.checks as HealthCheckWithResult[]);
|
||||
if (data) {
|
||||
data.checks?.forEach((check) => {
|
||||
delete check.results;
|
||||
});
|
||||
this._checks.next(data.checks as HealthCheckWithResult[]);
|
||||
}
|
||||
}
|
||||
|
||||
async checkGroup(name: string) {
|
||||
const response = await HealthCheckResource.getHealthCheckGroupByName({ name });
|
||||
const { data } = await tryExecuteAndNotify(this.host, HealthCheckResource.getHealthCheckGroupByName({ name }));
|
||||
|
||||
const results =
|
||||
response.checks?.map((check) => {
|
||||
return {
|
||||
key: check.key,
|
||||
results: check.results,
|
||||
};
|
||||
}) || [];
|
||||
if (data) {
|
||||
const results =
|
||||
data.checks?.map((check) => {
|
||||
return {
|
||||
key: check.key,
|
||||
results: check.results,
|
||||
};
|
||||
}) || [];
|
||||
|
||||
this._results.next(results);
|
||||
this._results.next(results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user