feat(web): notification channel settings UI
Server Deploy / deploy (push) Successful in 1m24s

This commit is contained in:
2026-07-21 14:24:38 +01:00
parent 8f3a27100f
commit df6f8b6f62
4 changed files with 254 additions and 4 deletions
+39
View File
@@ -97,6 +97,24 @@ export interface Rollup {
sum_latency: number;
}
export type ChannelType = "webhook" | "smtp" | "discord" | "slack" | "telegram";
export interface NotificationChannel {
channel_id: string;
name: string;
type: ChannelType;
config: Record<string, string>;
enabled: boolean;
created_at: string;
}
export interface ChannelInput {
name: string;
type: ChannelType;
config: Record<string, string>;
enabled: boolean;
}
export interface ConsoleConnectRequest {
server_id: string;
protocol: string;
@@ -370,6 +388,27 @@ export const api = {
return request<Rollup[]>(`/monitors/${monitorId}/uptime`);
},
// Notification channels
listChannels(): Promise<NotificationChannel[]> {
return request<NotificationChannel[]>("/channels");
},
createChannel(input: ChannelInput): Promise<NotificationChannel> {
return request<NotificationChannel>("/channels", { method: "POST", body: JSON.stringify(input) });
},
updateChannel(channelId: string, input: Partial<ChannelInput>): Promise<void> {
return request<void>(`/channels/${channelId}`, { method: "PUT", body: JSON.stringify(input) });
},
deleteChannel(channelId: string): Promise<void> {
return request<void>(`/channels/${channelId}`, { method: "DELETE" });
},
testChannel(channelId: string): Promise<{ status: string }> {
return request<{ status: string }>(`/channels/${channelId}/test`, { method: "POST" });
},
getLatestAgentVersion(): Promise<{ version: string }> {
return request<{ version: string }>("/agent/latest-version");
},