Skip to main content

DashboardAlertDefinition

DashboardAlertDefinition

Status: Developer Preview

Allows you to define custom alerts that can be displayed in the dashboard.

Signature
interface DashboardAlertDefinition<TResponse = any> {
id: string;
title: string | ((data: TResponse) => string);
description?: string | ((data: TResponse) => string);
severity: 'info' | 'warning' | 'error';
check: () => Promise<TResponse> | TResponse;
recheckInterval?: number;
shouldShow?: (data: TResponse) => boolean;
actions?: Array<{
label: string;
onClick: (data: TResponse) => void;
}>;
}

id

property
string

A unique identifier for the alert.

title

property
string | ((data: TResponse) => string)

The title of the alert. Can be a string or a function that returns a string based on the response data.

description

property
string | ((data: TResponse) => string)

The description of the alert. Can be a string or a function that returns a string based on the response data.

severity

property
'info' | 'warning' | 'error'

The severity level of the alert.

check

property
() => Promise<TResponse> | TResponse

A function that checks the condition and returns the response data.

recheckInterval

property
number

The interval in milliseconds to recheck the condition.

shouldShow

property
(data: TResponse) => boolean

A function that determines whether the alert should be shown based on the response data.

actions

property
Array<{ label: string; onClick: (data: TResponse) => void; }>

Optional actions that can be performed when the alert is shown.