diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/health-check/views/health-check-group.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/health-check/views/health-check-group.ts
index 0a91b6d739..11f8e461eb 100644
--- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/health-check/views/health-check-group.ts
+++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/health-check/views/health-check-group.ts
@@ -8,10 +8,12 @@ import { UmbHealthCheckDashboardContext } from '../health-check-dashboard.contex
import {
HealthCheckAction,
HealthCheckGroupWithResult,
+ HealthCheckResource,
HealthCheckWithResult,
StatusResultType,
} from '@umbraco-cms/backend-api';
import { UmbLitElement } from '@umbraco-cms/element';
+import { tryExecuteAndNotify } from '@umbraco-cms/resources';
@customElement('umb-dashboard-health-check-group')
export class UmbDashboardHealthCheckGroupElement extends UmbLitElement {
@@ -113,6 +115,9 @@ export class UmbDashboardHealthCheckGroupElement extends UmbLitElement {
@state()
private _keyResults?: any;
+ @state()
+ private _actionButtonStates?: [{ key: string; state: UUIButtonState }];
+
private _api?: UmbHealthCheckContext;
constructor() {
@@ -141,6 +146,10 @@ export class UmbDashboardHealthCheckGroupElement extends UmbLitElement {
this._buttonState = 'success';
}
+ private async _onActionClick(action: HealthCheckAction) {
+ await tryExecuteAndNotify(this, HealthCheckResource.postHealthCheckExecuteAction({ requestBody: action }));
+ }
+
render() {
if (this._group) {
return html`
@@ -185,6 +194,7 @@ export class UmbDashboardHealthCheckGroupElement extends UmbLitElement {
${action.description || html`This action has no description`}
diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/data/health-check.data.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/data/health-check.data.ts index f66758e85c..efeae3f322 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/data/health-check.data.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/data/health-check.data.ts @@ -7,6 +7,7 @@ import { HealthCheckWithResult, HealthCheckResult, StatusResultType, + HealthCheckAction, } from '@umbraco-cms/backend-api'; export function getGroupByName(name: string) { @@ -28,6 +29,14 @@ export const healthGroups: HealthCheckGroupWithResult[] = [ completely if there are any errors in macros. Rectifying this will set the value to 'Inline'. `, resultType: StatusResultType.ERROR, readMoreLink: 'https://umbra.co/healthchecks-macro-errors', + actions: [ + { + healthCheckKey: 'key123', + name: 'Action name', + alias: 'Action alias', + description: 'Action description', + }, + ], }, ], }, diff --git a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/health-check.handlers.ts b/src/Umbraco.Web.UI.Client/src/core/mocks/domains/health-check.handlers.ts index 811f899fe2..853434595a 100644 --- a/src/Umbraco.Web.UI.Client/src/core/mocks/domains/health-check.handlers.ts +++ b/src/Umbraco.Web.UI.Client/src/core/mocks/domains/health-check.handlers.ts @@ -28,105 +28,11 @@ export const handlers = [ } }), - rest.post(umbracoPath('/postHealthCheckExecuteAction'), async (_req, res, ctx) => { + rest.post(umbracoPath('/health-check/execute-action'), async (_req, res, ctx) => { await new Promise((resolve) => setTimeout(resolve, (Math.random() + 1) * 1000)); // simulate a delay of 1-2 seconds return res( // Respond with a 200 status code ctx.status(200) ); }), - - rest.get(umbracoPath('/health-check/security'), (_req, res, ctx) => { - return res( - ctx.status(200), - ctx.json