implement notification page (#8)

This commit is contained in:
UUBulb
2024-11-20 21:37:03 +08:00
committed by GitHub
parent e37f30d335
commit b3588b3378
27 changed files with 1133 additions and 36 deletions

4
src/types/alert-rule.tsx Normal file
View File

@@ -0,0 +1,4 @@
export const triggerModes: Record<number, string> = {
0: "Always",
1: "Once",
}

View File

@@ -390,19 +390,22 @@ export interface ModelRule {
/** 覆盖范围 RuleCoverAll/IgnoreAll */
cover: number;
/** 流量统计周期 */
cycle_interval: number;
cycle_interval?: number;
/** 流量统计的开始时间 */
cycle_start: string;
/** 流量统计周期单位默认hour,可选(hour, day, week, month, year) */
cycle_unit: string;
cycle_start?: string;
/**
* 流量统计周期单位默认hour,可选(hour, day, week, month, year)
* @default "hour"
*/
cycle_unit?: "hour" | "day" | "week" | "month" | "year";
/** 持续时间 (秒) */
duration: number;
duration?: number;
/** 覆盖范围的排除 */
ignore: Record<string, boolean>;
ignore?: Record<string, boolean>;
/** 最大阈值 (百分比、字节 kb ÷ 1024) */
max: number;
max?: number;
/** 最小阈值 (百分比、字节 kb ÷ 1024) */
min: number;
min?: number;
/**
* 指标类型cpu、memory、swap、disk、net_in_speed、net_out_speed
* net_all_speed、transfer_in、transfer_out、transfer_all、offline

View File

@@ -6,3 +6,7 @@ export * from './ddns';
export * from './serverStore';
export * from './serverContext';
export * from './cron';
export * from './notification';
export * from './alert-rule';
export * from './notificationStore';
export * from './notificationContext';

View File

@@ -0,0 +1,9 @@
export const nrequestMethods: Record<number, string> = {
1: "GET",
2: "POST",
}
export const nrequestTypes: Record<number, string> = {
1: "JSON",
2: "Form",
}

View File

@@ -0,0 +1,6 @@
import { ModelNotification, ModelNotificationGroupResponseItem } from "@/types";
export interface NotificationContextProps {
notifiers?: ModelNotification[];
notifierGroup?: ModelNotificationGroupResponseItem[];
}

View File

@@ -0,0 +1,8 @@
import { ModelNotification, ModelNotificationGroupResponseItem } from "@/types";
export interface NotificationStore {
notifiers?: ModelNotification[];
notifierGroup?: ModelNotificationGroupResponseItem[];
setNotifier: (notifiers?: ModelNotification[]) => void;
setNotifierGroup: (notifierGroup?: ModelNotificationGroupResponseItem[]) => void;
}