mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-02-04 12:40:08 +00:00
feat: 修改用户名,简化代码
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { useMainStore } from "@/hooks/useMainStore";
|
||||||
|
|
||||||
interface CommonResponse<T> {
|
interface CommonResponse<T> {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
error: string;
|
error: string;
|
||||||
@@ -48,7 +50,7 @@ export async function fetcher<T>(method: FetcherMethod, path: string, data?: any
|
|||||||
}
|
}
|
||||||
|
|
||||||
// auto refresh token
|
// auto refresh token
|
||||||
if (!lastestRefreshTokenAt || Date.now() - lastestRefreshTokenAt > 1000 * 60 * 60) {
|
if (document.cookie && (!lastestRefreshTokenAt || Date.now() - lastestRefreshTokenAt > 1000 * 60 * 60)) {
|
||||||
lastestRefreshTokenAt = Date.now();
|
lastestRefreshTokenAt = Date.now();
|
||||||
fetch("/api/v1/refresh-token")
|
fetch("/api/v1/refresh-token")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
} from "@/components/ui/dropdown-menu"
|
} from "@/components/ui/dropdown-menu"
|
||||||
import { Button, ButtonProps } from "@/components/ui/button"
|
import { Button, ButtonProps } from "@/components/ui/button"
|
||||||
import { forwardRef, useState } from "react"
|
import { forwardRef, useState } from "react"
|
||||||
import { useConfig } from "@/hooks/useConfig"
|
import useSettings from "@/hooks/useSetting"
|
||||||
import { ConfigEssential } from "@/types"
|
import { ModelConfig } from "@/types"
|
||||||
import { Check, Clipboard } from "lucide-react"
|
import { Check, Clipboard } from "lucide-react"
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
|
|
||||||
@@ -21,15 +21,15 @@ enum OSTypes {
|
|||||||
|
|
||||||
export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
||||||
const [copy, setCopy] = useState(false);
|
const [copy, setCopy] = useState(false);
|
||||||
const { config } = useConfig();
|
const settings = useSettings();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const switchState = async (type: number) => {
|
const switchState = async (type: number) => {
|
||||||
if (!copy) {
|
if (!copy) {
|
||||||
try {
|
try {
|
||||||
setCopy(true);
|
setCopy(true);
|
||||||
if (config)
|
if (settings)
|
||||||
await navigator.clipboard.writeText(generateCommand(type, config));
|
await navigator.clipboard.writeText(generateCommand(type, settings));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
toast(t("Error"), {
|
toast(t("Error"), {
|
||||||
@@ -60,7 +60,7 @@ export const InstallCommandsMenu = forwardRef<HTMLButtonElement, ButtonProps>((p
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
||||||
const generateCommand = (type: number, { agent_secret_key, install_host, listen_port, tls }: ConfigEssential) => {
|
const generateCommand = (type: number, { agent_secret_key, install_host, listen_port, tls }: ModelConfig) => {
|
||||||
if (!install_host)
|
if (!install_host)
|
||||||
throw new Error("You have not specify the installed host.");
|
throw new Error("You have not specify the installed host.");
|
||||||
|
|
||||||
|
|||||||
@@ -32,22 +32,25 @@ import { useTranslation } from "react-i18next";
|
|||||||
const profileFormSchema = z.object({
|
const profileFormSchema = z.object({
|
||||||
original_password: z.string().min(5).max(72),
|
original_password: z.string().min(5).max(72),
|
||||||
new_password: z.string().min(8).max(72),
|
new_password: z.string().min(8).max(72),
|
||||||
|
new_username: z.string().min(1).max(32),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ProfileCard = ({ className }: { className: string }) => {
|
export const ProfileCard = ({ className }: { className: string }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const { profile, setProfile } = useMainStore();
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof profileFormSchema>>({
|
const form = useForm<z.infer<typeof profileFormSchema>>({
|
||||||
resolver: zodResolver(profileFormSchema),
|
resolver: zodResolver(profileFormSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
original_password: '',
|
original_password: '',
|
||||||
new_password: '',
|
new_password: '',
|
||||||
|
new_username: profile?.username,
|
||||||
},
|
},
|
||||||
resetOptions: {
|
resetOptions: {
|
||||||
keepDefaultValues: false,
|
keepDefaultValues: false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const { setProfile } = useMainStore();
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: z.infer<typeof profileFormSchema>) => {
|
const onSubmit = async (values: z.infer<typeof profileFormSchema>) => {
|
||||||
@@ -69,18 +72,33 @@ export const ProfileCard = ({ className }: { className: string }) => {
|
|||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Button variant="outline" className={className}>
|
<Button variant="outline" className={className}>
|
||||||
{t("UpdatePassword")}
|
{t("UpdateProfile")}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<DialogContent className="sm:max-w-xl">
|
<DialogContent className="sm:max-w-xl">
|
||||||
<ScrollArea className="max-h-[calc(100dvh-5rem)] p-3">
|
<ScrollArea className="max-h-[calc(100dvh-5rem)] p-3">
|
||||||
<div className="items-center mx-1">
|
<div className="items-center mx-1">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{t("UpdatePassword")}</DialogTitle>
|
<DialogTitle>{t("UpdateProfile")}</DialogTitle>
|
||||||
<DialogDescription />
|
<DialogDescription />
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-2 my-2">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-2 my-2">
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="new_username"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>{t("NewUsername")}</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="original_password"
|
name="original_password"
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
import { createContext, useContext, useEffect, useMemo } from "react"
|
|
||||||
import { useConfigStore } from "./useConfigStore"
|
|
||||||
import { getSettings } from "@/api/settings"
|
|
||||||
import { ConfigContextProps } from "@/types"
|
|
||||||
import { useLocation } from "react-router-dom"
|
|
||||||
|
|
||||||
const ConfigContext = createContext<ConfigContextProps>({});
|
|
||||||
|
|
||||||
interface ConfigProviderProps {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ConfigProvider: React.FC<ConfigProviderProps> = ({ children }) => {
|
|
||||||
const config = useConfigStore(store => store.config);
|
|
||||||
const setConfig = useConfigStore(store => store.setConfig);
|
|
||||||
|
|
||||||
const location = useLocation();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
(async () => {
|
|
||||||
if (location.pathname !== "/dashboard/settings")
|
|
||||||
try {
|
|
||||||
const c = await getSettings();
|
|
||||||
const { agent_secret_key, language, listen_port, install_host, site_name, tls } = c;
|
|
||||||
const data = {
|
|
||||||
agent_secret_key,
|
|
||||||
language,
|
|
||||||
listen_port,
|
|
||||||
install_host,
|
|
||||||
site_name,
|
|
||||||
tls,
|
|
||||||
};
|
|
||||||
setConfig(data);
|
|
||||||
} catch (error) {
|
|
||||||
setConfig(undefined);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}, [location.pathname])
|
|
||||||
|
|
||||||
const value: ConfigContextProps = useMemo(() => ({
|
|
||||||
config: config,
|
|
||||||
}), [config]);
|
|
||||||
return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useConfig = () => {
|
|
||||||
return useContext(ConfigContext);
|
|
||||||
};
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { ConfigStore } from '@/types'
|
|
||||||
import { create } from 'zustand'
|
|
||||||
import { persist, createJSONStorage } from 'zustand/middleware'
|
|
||||||
|
|
||||||
export const useConfigStore = create<ConfigStore, [['zustand/persist', ConfigStore]]>(
|
|
||||||
persist(
|
|
||||||
(set, get) => ({
|
|
||||||
config: get()?.config,
|
|
||||||
setConfig: config => set({ config }),
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: 'configStore',
|
|
||||||
storage: createJSONStorage(() => localStorage),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
11
src/hooks/useSetting.tsx
Normal file
11
src/hooks/useSetting.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { swrFetcher } from "@/api/api";
|
||||||
|
import { ModelConfig } from "@/types";
|
||||||
|
import useSWR from "swr";
|
||||||
|
|
||||||
|
export default function useSetting() {
|
||||||
|
const { data } = useSWR<ModelConfig>(
|
||||||
|
"/api/v1/setting",
|
||||||
|
swrFetcher
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -103,7 +103,8 @@
|
|||||||
"Refresh": "Refresh",
|
"Refresh": "Refresh",
|
||||||
"CopyPath": "copy path",
|
"CopyPath": "copy path",
|
||||||
"Goto": "Go to",
|
"Goto": "Go to",
|
||||||
"UpdatePassword": "change password",
|
"UpdateProfile": "Update profile",
|
||||||
|
"NewUsername": "New username",
|
||||||
"OriginalPassword": "original password",
|
"OriginalPassword": "original password",
|
||||||
"NewPassword": "New Password",
|
"NewPassword": "New Password",
|
||||||
"EditDDNS": "Edit DDNS",
|
"EditDDNS": "Edit DDNS",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"Refresh": "aggiornare",
|
"Refresh": "aggiornare",
|
||||||
"CopyPath": "percorso di copia",
|
"CopyPath": "percorso di copia",
|
||||||
"Goto": "Vai a",
|
"Goto": "Vai a",
|
||||||
"UpdatePassword": "cambiare la password",
|
"UpdateProfile": "Aggiorna il profilo",
|
||||||
|
"NewUsername": "Nuovo nome utente",
|
||||||
"OriginalPassword": "password originale",
|
"OriginalPassword": "password originale",
|
||||||
"NewPassword": "Nuova parola d'ordine",
|
"NewPassword": "Nuova parola d'ordine",
|
||||||
"EditDDNS": "Modifica DDNS",
|
"EditDDNS": "Modifica DDNS",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"Refresh": "刷新",
|
"Refresh": "刷新",
|
||||||
"CopyPath": "复制路径",
|
"CopyPath": "复制路径",
|
||||||
"Goto": "前往",
|
"Goto": "前往",
|
||||||
"UpdatePassword": "更改密码",
|
"UpdateProfile": "更新个人资料",
|
||||||
|
"NewUsername": "新用户名",
|
||||||
"OriginalPassword": "原始密码",
|
"OriginalPassword": "原始密码",
|
||||||
"NewPassword": "新密码",
|
"NewPassword": "新密码",
|
||||||
"EditDDNS": "编辑DDNS",
|
"EditDDNS": "编辑DDNS",
|
||||||
|
|||||||
@@ -104,7 +104,8 @@
|
|||||||
"Refresh": "刷新",
|
"Refresh": "刷新",
|
||||||
"CopyPath": "複製路徑",
|
"CopyPath": "複製路徑",
|
||||||
"Goto": "前往",
|
"Goto": "前往",
|
||||||
"UpdatePassword": "更改密碼",
|
"UpdateProfile": "更新個人資料",
|
||||||
|
"NewUsername": "新用戶名",
|
||||||
"OriginalPassword": "原始密碼",
|
"OriginalPassword": "原始密碼",
|
||||||
"NewPassword": "新密碼",
|
"NewPassword": "新密碼",
|
||||||
"EditDDNS": "編輯DDNS",
|
"EditDDNS": "編輯DDNS",
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import ServerGroupPage from './routes/server-group';
|
|||||||
import NotificationGroupPage from './routes/notification-group';
|
import NotificationGroupPage from './routes/notification-group';
|
||||||
import { ServerProvider } from './hooks/useServer';
|
import { ServerProvider } from './hooks/useServer';
|
||||||
import { NotificationProvider } from './hooks/useNotfication';
|
import { NotificationProvider } from './hooks/useNotfication';
|
||||||
import { ConfigProvider } from './hooks/useConfig';
|
|
||||||
import CronPage from './routes/cron';
|
import CronPage from './routes/cron';
|
||||||
import NotificationPage from './routes/notification';
|
import NotificationPage from './routes/notification';
|
||||||
import AlertRulePage from './routes/alert-rule';
|
import AlertRulePage from './routes/alert-rule';
|
||||||
@@ -37,9 +36,7 @@ const router = createBrowserRouter([
|
|||||||
element: (
|
element: (
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<ConfigProvider>
|
<Root />
|
||||||
<Root />
|
|
||||||
</ConfigProvider>
|
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
),
|
),
|
||||||
|
|||||||
690
src/types/api.ts
690
src/types/api.ts
@@ -9,262 +9,262 @@
|
|||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseAny {
|
export interface GithubComNezhahqNezhaModelCommonResponseAny {
|
||||||
data: any;
|
data?: any;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelAlertRule {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelAlertRule {
|
||||||
data: ModelAlertRule[];
|
data?: ModelAlertRule[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelCron {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelCron {
|
||||||
data: ModelCron[];
|
data?: ModelCron[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelDDNSProfile {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelDDNSProfile {
|
||||||
data: ModelDDNSProfile[];
|
data?: ModelDDNSProfile[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelNAT {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNAT {
|
||||||
data: ModelNAT[];
|
data?: ModelNAT[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelNotification {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotification {
|
||||||
data: ModelNotification[];
|
data?: ModelNotification[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelNotificationGroupResponseItem {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelNotificationGroupResponseItem {
|
||||||
data: ModelNotificationGroupResponseItem[];
|
data?: ModelNotificationGroupResponseItem[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelServer {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServer {
|
||||||
data: ModelServer[];
|
data?: ModelServer[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelServerGroupResponseItem {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServerGroupResponseItem {
|
||||||
data: ModelServerGroupResponseItem[];
|
data?: ModelServerGroupResponseItem[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelServiceInfos {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelServiceInfos {
|
||||||
data: ModelServiceInfos[];
|
data?: ModelServiceInfos[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelUser {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelUser {
|
||||||
data: ModelUser[];
|
data?: ModelUser[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayModelWAF {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayModelWAF {
|
||||||
data: ModelWAF[];
|
data?: ModelWAF[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayString {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayString {
|
||||||
data: string[];
|
data?: string[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseArrayUint64 {
|
export interface GithubComNezhahqNezhaModelCommonResponseArrayUint64 {
|
||||||
data: number[];
|
data?: number[];
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseModelConfig {
|
export interface GithubComNezhahqNezhaModelCommonResponseModelConfig {
|
||||||
data: ModelConfig;
|
data?: ModelConfig;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseModelForceUpdateResponse {
|
export interface GithubComNezhahqNezhaModelCommonResponseModelForceUpdateResponse {
|
||||||
data: ModelForceUpdateResponse;
|
data?: ModelForceUpdateResponse;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseModelLoginResponse {
|
export interface GithubComNezhahqNezhaModelCommonResponseModelLoginResponse {
|
||||||
data: ModelLoginResponse;
|
data?: ModelLoginResponse;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseModelProfile {
|
export interface GithubComNezhahqNezhaModelCommonResponseModelProfile {
|
||||||
data: ModelProfile;
|
data?: ModelProfile;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseModelServiceResponse {
|
export interface GithubComNezhahqNezhaModelCommonResponseModelServiceResponse {
|
||||||
data: ModelServiceResponse;
|
data?: ModelServiceResponse;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GithubComNaibaNezhaModelCommonResponseUint64 {
|
export interface GithubComNezhahqNezhaModelCommonResponseUint64 {
|
||||||
data: number;
|
data?: number;
|
||||||
error: string;
|
error?: string;
|
||||||
success: boolean;
|
success?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelAlertRule {
|
export interface ModelAlertRule {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
enable: boolean;
|
enable?: boolean;
|
||||||
/** 失败时执行的触发任务id */
|
/** 失败时执行的触发任务id */
|
||||||
fail_trigger_tasks: number[];
|
fail_trigger_tasks?: number[];
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 该报警规则所在的通知组 */
|
/** 该报警规则所在的通知组 */
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
/** 恢复时执行的触发任务id */
|
/** 恢复时执行的触发任务id */
|
||||||
recover_trigger_tasks: number[];
|
recover_trigger_tasks?: number[];
|
||||||
rules: ModelRule[];
|
rules?: ModelRule[];
|
||||||
/** 触发模式: 0-始终触发(默认) 1-单次触发 */
|
/** 触发模式: 0-始终触发(默认) 1-单次触发 */
|
||||||
trigger_mode: number;
|
trigger_mode?: number;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelAlertRuleForm {
|
export interface ModelAlertRuleForm {
|
||||||
enable?: boolean;
|
enable?: boolean;
|
||||||
/** 失败时触发的任务id */
|
/** 失败时触发的任务id */
|
||||||
fail_trigger_tasks: number[];
|
fail_trigger_tasks?: number[];
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
/** 恢复时触发的任务id */
|
/** 恢复时触发的任务id */
|
||||||
recover_trigger_tasks: number[];
|
recover_trigger_tasks?: number[];
|
||||||
rules: ModelRule[];
|
rules?: ModelRule[];
|
||||||
/** @default 0 */
|
/** @default 0 */
|
||||||
trigger_mode: number;
|
trigger_mode?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelConfig {
|
export interface ModelConfig {
|
||||||
agent_secret_key: string;
|
agent_secret_key?: string;
|
||||||
avg_ping_count: number;
|
avg_ping_count?: number;
|
||||||
/** 覆盖范围(0:提醒未被 IgnoredIPNotification 包含的所有服务器; 1:仅提醒被 IgnoredIPNotification 包含的服务器;) */
|
/** 覆盖范围(0:提醒未被 IgnoredIPNotification 包含的所有服务器; 1:仅提醒被 IgnoredIPNotification 包含的服务器;) */
|
||||||
cover: number;
|
cover?: number;
|
||||||
custom_code: string;
|
custom_code?: string;
|
||||||
custom_code_dashboard: string;
|
custom_code_dashboard?: string;
|
||||||
/** debug模式开关 */
|
/** debug模式开关 */
|
||||||
debug: boolean;
|
debug?: boolean;
|
||||||
dns_servers: string;
|
dns_servers?: string;
|
||||||
/** IP变更提醒 */
|
/** IP变更提醒 */
|
||||||
enable_ip_change_notification: boolean;
|
enable_ip_change_notification?: boolean;
|
||||||
/** 通知信息IP不打码 */
|
/** 通知信息IP不打码 */
|
||||||
enable_plain_ip_in_notification: boolean;
|
enable_plain_ip_in_notification?: boolean;
|
||||||
/** 特定服务器IP(多个服务器用逗号分隔) */
|
/** 特定服务器IP(多个服务器用逗号分隔) */
|
||||||
ignored_ip_notification: string;
|
ignored_ip_notification?: string;
|
||||||
/** [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内) */
|
/** [ServerID] -> bool(值为true代表当前ServerID在特定服务器列表内) */
|
||||||
ignored_ip_notification_server_ids: Record<string, boolean>;
|
ignored_ip_notification_server_ids?: Record<string, boolean>;
|
||||||
install_host: string;
|
install_host?: string;
|
||||||
ip_change_notification_group_id: number;
|
ip_change_notification_group_id?: number;
|
||||||
jwt_secret_key: string;
|
jwt_secret_key?: string;
|
||||||
/** 系统语言,默认 zh_CN */
|
/** 系统语言,默认 zh_CN */
|
||||||
language: string;
|
language?: string;
|
||||||
listen_port: number;
|
listen_port?: number;
|
||||||
/** 时区,默认为 Asia/Shanghai */
|
/** 时区,默认为 Asia/Shanghai */
|
||||||
location: string;
|
location?: string;
|
||||||
/** 真实IP */
|
/** 真实IP */
|
||||||
real_ip_header: string;
|
real_ip_header?: string;
|
||||||
site_name: string;
|
site_name?: string;
|
||||||
tls: boolean;
|
tls?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelCreateFMResponse {
|
export interface ModelCreateFMResponse {
|
||||||
session_id: string;
|
session_id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelCreateTerminalResponse {
|
export interface ModelCreateTerminalResponse {
|
||||||
server_id: number;
|
server_id?: number;
|
||||||
server_name: string;
|
server_name?: string;
|
||||||
session_id: string;
|
session_id?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelCron {
|
export interface ModelCron {
|
||||||
command: string;
|
command?: string;
|
||||||
/** 计划任务覆盖范围 (0:仅覆盖特定服务器 1:仅忽略特定服务器 2:由触发该计划任务的服务器执行) */
|
/** 计划任务覆盖范围 (0:仅覆盖特定服务器 1:仅忽略特定服务器 2:由触发该计划任务的服务器执行) */
|
||||||
cover: number;
|
cover?: number;
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
cron_job_id: number;
|
cron_job_id?: number;
|
||||||
id: number;
|
id?: number;
|
||||||
/** 最后一次执行时间 */
|
/** 最后一次执行时间 */
|
||||||
last_executed_at: string;
|
last_executed_at?: string;
|
||||||
/** 最后一次执行结果 */
|
/** 最后一次执行结果 */
|
||||||
last_result: boolean;
|
last_result?: boolean;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 指定通知方式的分组 */
|
/** 指定通知方式的分组 */
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
/** 推送成功的通知 */
|
/** 推送成功的通知 */
|
||||||
push_successful: boolean;
|
push_successful?: boolean;
|
||||||
/** 分钟 小时 天 月 星期 */
|
/** 分钟 小时 天 月 星期 */
|
||||||
scheduler: string;
|
scheduler?: string;
|
||||||
servers: number[];
|
servers?: number[];
|
||||||
/** 0:计划任务 1:触发任务 */
|
/** 0:计划任务 1:触发任务 */
|
||||||
task_type: number;
|
task_type?: number;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelCronForm {
|
export interface ModelCronForm {
|
||||||
command?: string;
|
command?: string;
|
||||||
/** @default 0 */
|
/** @default 0 */
|
||||||
cover: number;
|
cover?: number;
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
push_successful?: boolean;
|
push_successful?: boolean;
|
||||||
scheduler: string;
|
scheduler?: string;
|
||||||
servers: number[];
|
servers?: number[];
|
||||||
/**
|
/**
|
||||||
* 0:计划任务 1:触发任务
|
* 0:计划任务 1:触发任务
|
||||||
* @default 0
|
* @default 0
|
||||||
*/
|
*/
|
||||||
task_type: number;
|
task_type?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelCycleTransferStats {
|
export interface ModelCycleTransferStats {
|
||||||
from: string;
|
from?: string;
|
||||||
max: number;
|
max?: number;
|
||||||
min: number;
|
min?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
next_update: Record<string, string>;
|
next_update?: Record<string, string>;
|
||||||
server_name: Record<string, string>;
|
server_name?: Record<string, string>;
|
||||||
to: string;
|
to?: string;
|
||||||
transfer: Record<string, number>;
|
transfer?: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelDDNSForm {
|
export interface ModelDDNSForm {
|
||||||
access_id?: string;
|
access_id?: string;
|
||||||
access_secret?: string;
|
access_secret?: string;
|
||||||
domains: string[];
|
domains?: string[];
|
||||||
enable_ipv4?: boolean;
|
enable_ipv4?: boolean;
|
||||||
enable_ipv6?: boolean;
|
enable_ipv6?: boolean;
|
||||||
/** @default 3 */
|
/** @default 3 */
|
||||||
max_retries: number;
|
max_retries?: number;
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
provider: string;
|
provider?: string;
|
||||||
webhook_headers?: string;
|
webhook_headers?: string;
|
||||||
/** @default 1 */
|
/** @default 1 */
|
||||||
webhook_method?: number;
|
webhook_method?: number;
|
||||||
@@ -275,22 +275,22 @@ export interface ModelDDNSForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelDDNSProfile {
|
export interface ModelDDNSProfile {
|
||||||
access_id: string;
|
access_id?: string;
|
||||||
access_secret: string;
|
access_secret?: string;
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
domains: string[];
|
domains?: string[];
|
||||||
enable_ipv4: boolean;
|
enable_ipv4?: boolean;
|
||||||
enable_ipv6: boolean;
|
enable_ipv6?: boolean;
|
||||||
id: number;
|
id?: number;
|
||||||
max_retries: number;
|
max_retries?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
provider: string;
|
provider?: string;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
webhook_headers: string;
|
webhook_headers?: string;
|
||||||
webhook_method: number;
|
webhook_method?: number;
|
||||||
webhook_request_body: string;
|
webhook_request_body?: string;
|
||||||
webhook_request_type: number;
|
webhook_request_type?: number;
|
||||||
webhook_url: string;
|
webhook_url?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelForceUpdateResponse {
|
export interface ModelForceUpdateResponse {
|
||||||
@@ -300,137 +300,137 @@ export interface ModelForceUpdateResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelGeoIP {
|
export interface ModelGeoIP {
|
||||||
country_code: string;
|
country_code?: string;
|
||||||
ip: ModelIP;
|
ip?: ModelIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelHost {
|
export interface ModelHost {
|
||||||
arch: string;
|
arch?: string;
|
||||||
boot_time: number;
|
boot_time?: number;
|
||||||
cpu: string[];
|
cpu?: string[];
|
||||||
disk_total: number;
|
disk_total?: number;
|
||||||
gpu: string[];
|
gpu?: string[];
|
||||||
mem_total: number;
|
mem_total?: number;
|
||||||
platform: string;
|
platform?: string;
|
||||||
platform_version: string;
|
platform_version?: string;
|
||||||
swap_total: number;
|
swap_total?: number;
|
||||||
version: string;
|
version?: string;
|
||||||
virtualization: string;
|
virtualization?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelHostState {
|
export interface ModelHostState {
|
||||||
cpu: number;
|
cpu?: number;
|
||||||
disk_used: number;
|
disk_used?: number;
|
||||||
gpu: number[];
|
gpu?: number[];
|
||||||
load_1: number;
|
load_1?: number;
|
||||||
load_15: number;
|
load_15?: number;
|
||||||
load_5: number;
|
load_5?: number;
|
||||||
mem_used: number;
|
mem_used?: number;
|
||||||
net_in_speed: number;
|
net_in_speed?: number;
|
||||||
net_in_transfer: number;
|
net_in_transfer?: number;
|
||||||
net_out_speed: number;
|
net_out_speed?: number;
|
||||||
net_out_transfer: number;
|
net_out_transfer?: number;
|
||||||
process_count: number;
|
process_count?: number;
|
||||||
swap_used: number;
|
swap_used?: number;
|
||||||
tcp_conn_count: number;
|
tcp_conn_count?: number;
|
||||||
temperatures: ModelSensorTemperature[];
|
temperatures?: ModelSensorTemperature[];
|
||||||
udp_conn_count: number;
|
udp_conn_count?: number;
|
||||||
uptime: number;
|
uptime?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelIP {
|
export interface ModelIP {
|
||||||
ipv4_addr: string;
|
ipv4_addr?: string;
|
||||||
ipv6_addr: string;
|
ipv6_addr?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelLoginRequest {
|
export interface ModelLoginRequest {
|
||||||
password: string;
|
password?: string;
|
||||||
username: string;
|
username?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelLoginResponse {
|
export interface ModelLoginResponse {
|
||||||
expire: string;
|
expire?: string;
|
||||||
token: string;
|
token?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNAT {
|
export interface ModelNAT {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
domain: string;
|
domain?: string;
|
||||||
host: string;
|
host?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
server_id: number;
|
server_id?: number;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNATForm {
|
export interface ModelNATForm {
|
||||||
domain: string;
|
domain?: string;
|
||||||
host: string;
|
host?: string;
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
server_id: number;
|
server_id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNotification {
|
export interface ModelNotification {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
request_body: string;
|
request_body?: string;
|
||||||
request_header: string;
|
request_header?: string;
|
||||||
request_method: number;
|
request_method?: number;
|
||||||
request_type: number;
|
request_type?: number;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
url: string;
|
url?: string;
|
||||||
verify_tls: boolean;
|
verify_tls?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNotificationForm {
|
export interface ModelNotificationForm {
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
request_body: string;
|
request_body?: string;
|
||||||
request_header: string;
|
request_header?: string;
|
||||||
request_method: number;
|
request_method?: number;
|
||||||
request_type: number;
|
request_type?: number;
|
||||||
skip_check?: boolean;
|
skip_check?: boolean;
|
||||||
url: string;
|
url?: string;
|
||||||
verify_tls?: boolean;
|
verify_tls?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNotificationGroup {
|
export interface ModelNotificationGroup {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNotificationGroupForm {
|
export interface ModelNotificationGroupForm {
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
notifications: number[];
|
notifications?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelNotificationGroupResponseItem {
|
export interface ModelNotificationGroupResponseItem {
|
||||||
group: ModelNotificationGroup;
|
group?: ModelNotificationGroup;
|
||||||
notifications: number[];
|
notifications?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelProfile {
|
export interface ModelProfile {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
login_ip: string;
|
login_ip?: string;
|
||||||
password: string;
|
password?: string;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
username: string;
|
username?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelProfileForm {
|
export interface ModelProfileForm {
|
||||||
new_password: string;
|
new_password?: string;
|
||||||
original_password: string;
|
original_password?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelRule {
|
export interface ModelRule {
|
||||||
/** 覆盖范围 RuleCoverAll/IgnoreAll */
|
/** 覆盖范围 RuleCoverAll/IgnoreAll */
|
||||||
cover: number;
|
cover?: number;
|
||||||
/** 流量统计周期 */
|
/** 流量统计周期 */
|
||||||
cycle_interval?: number;
|
cycle_interval?: number;
|
||||||
/** 流量统计的开始时间 */
|
/** 流量统计的开始时间 */
|
||||||
@@ -453,7 +453,7 @@ export interface ModelRule {
|
|||||||
* net_all_speed、transfer_in、transfer_out、transfer_all、offline
|
* net_all_speed、transfer_in、transfer_out、transfer_all、offline
|
||||||
* transfer_in_cycle、transfer_out_cycle、transfer_all_cycle
|
* transfer_in_cycle、transfer_out_cycle、transfer_all_cycle
|
||||||
*/
|
*/
|
||||||
type: string;
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelSensorTemperature {
|
export interface ModelSensorTemperature {
|
||||||
@@ -462,27 +462,27 @@ export interface ModelSensorTemperature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServer {
|
export interface ModelServer {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
/** DDNS配置 */
|
/** DDNS配置 */
|
||||||
ddns_profiles?: number[];
|
ddns_profiles?: number[];
|
||||||
/** 展示排序,越大越靠前 */
|
/** 展示排序,越大越靠前 */
|
||||||
display_index: number;
|
display_index?: number;
|
||||||
/** 启用DDNS */
|
/** 启用DDNS */
|
||||||
enable_ddns: boolean;
|
enable_ddns?: boolean;
|
||||||
geoip: ModelGeoIP;
|
geoip?: ModelGeoIP;
|
||||||
/** 对游客隐藏 */
|
/** 对游客隐藏 */
|
||||||
hide_for_guest: boolean;
|
hide_for_guest?: boolean;
|
||||||
host: ModelHost;
|
host?: ModelHost;
|
||||||
id: number;
|
id?: number;
|
||||||
last_active: string;
|
last_active?: string;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 管理员可见备注 */
|
/** 管理员可见备注 */
|
||||||
note: string;
|
note?: string;
|
||||||
/** 公开备注 */
|
/** 公开备注 */
|
||||||
public_note: string;
|
public_note?: string;
|
||||||
state: ModelHostState;
|
state?: ModelHostState;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
uuid: string;
|
uuid?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServerForm {
|
export interface ModelServerForm {
|
||||||
@@ -492,12 +492,12 @@ export interface ModelServerForm {
|
|||||||
* 展示排序,越大越靠前
|
* 展示排序,越大越靠前
|
||||||
* @default 0
|
* @default 0
|
||||||
*/
|
*/
|
||||||
display_index: number;
|
display_index?: number;
|
||||||
/** 启用DDNS */
|
/** 启用DDNS */
|
||||||
enable_ddns?: boolean;
|
enable_ddns?: boolean;
|
||||||
/** 对游客隐藏 */
|
/** 对游客隐藏 */
|
||||||
hide_for_guest?: boolean;
|
hide_for_guest?: boolean;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 管理员可见备注 */
|
/** 管理员可见备注 */
|
||||||
note?: string;
|
note?: string;
|
||||||
/** 公开备注 */
|
/** 公开备注 */
|
||||||
@@ -505,95 +505,95 @@ export interface ModelServerForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServerGroup {
|
export interface ModelServerGroup {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServerGroupForm {
|
export interface ModelServerGroupForm {
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
servers: number[];
|
servers?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServerGroupResponseItem {
|
export interface ModelServerGroupResponseItem {
|
||||||
group: ModelServerGroup;
|
group?: ModelServerGroup;
|
||||||
servers: number[];
|
servers?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelService {
|
export interface ModelService {
|
||||||
cover: number;
|
cover?: number;
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
duration: number;
|
duration?: number;
|
||||||
enable_show_in_service: boolean;
|
enable_show_in_service?: boolean;
|
||||||
enable_trigger_task: boolean;
|
enable_trigger_task?: boolean;
|
||||||
/** 失败时执行的触发任务id */
|
/** 失败时执行的触发任务id */
|
||||||
fail_trigger_tasks: number[];
|
fail_trigger_tasks?: number[];
|
||||||
id: number;
|
id?: number;
|
||||||
latency_notify: boolean;
|
latency_notify?: boolean;
|
||||||
max_latency: number;
|
max_latency?: number;
|
||||||
min_latency: number;
|
min_latency?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 当前服务监控所属的通知组 ID */
|
/** 当前服务监控所属的通知组 ID */
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
notify: boolean;
|
notify?: boolean;
|
||||||
/** 恢复时执行的触发任务id */
|
/** 恢复时执行的触发任务id */
|
||||||
recover_trigger_tasks: number[];
|
recover_trigger_tasks?: number[];
|
||||||
skip_servers: Record<string, boolean>;
|
skip_servers?: Record<string, boolean>;
|
||||||
target: string;
|
target?: string;
|
||||||
type: number;
|
type?: number;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServiceForm {
|
export interface ModelServiceForm {
|
||||||
cover: number;
|
cover?: number;
|
||||||
duration: number;
|
duration?: number;
|
||||||
enable_show_in_service?: boolean;
|
enable_show_in_service?: boolean;
|
||||||
enable_trigger_task?: boolean;
|
enable_trigger_task?: boolean;
|
||||||
fail_trigger_tasks: number[];
|
fail_trigger_tasks?: number[];
|
||||||
latency_notify?: boolean;
|
latency_notify?: boolean;
|
||||||
/** @default 0 */
|
/** @default 0 */
|
||||||
max_latency: number;
|
max_latency?: number;
|
||||||
/** @default 0 */
|
/** @default 0 */
|
||||||
min_latency: number;
|
min_latency?: number;
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
name: string;
|
name?: string;
|
||||||
notification_group_id: number;
|
notification_group_id?: number;
|
||||||
notify?: boolean;
|
notify?: boolean;
|
||||||
recover_trigger_tasks: number[];
|
recover_trigger_tasks?: number[];
|
||||||
skip_servers: Record<string, boolean>;
|
skip_servers?: Record<string, boolean>;
|
||||||
target: string;
|
target?: string;
|
||||||
type: number;
|
type?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServiceInfos {
|
export interface ModelServiceInfos {
|
||||||
avg_delay: number[];
|
avg_delay?: number[];
|
||||||
created_at: number[];
|
created_at?: number[];
|
||||||
monitor_id: number;
|
monitor_id?: number;
|
||||||
monitor_name: string;
|
monitor_name?: string;
|
||||||
server_id: number;
|
server_id?: number;
|
||||||
server_name: string;
|
server_name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServiceResponse {
|
export interface ModelServiceResponse {
|
||||||
cycle_transfer_stats: Record<string, ModelCycleTransferStats>;
|
cycle_transfer_stats?: Record<string, ModelCycleTransferStats>;
|
||||||
services: Record<string, ModelServiceResponseItem>;
|
services?: Record<string, ModelServiceResponseItem>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelServiceResponseItem {
|
export interface ModelServiceResponseItem {
|
||||||
current_down: number;
|
current_down?: number;
|
||||||
current_up: number;
|
current_up?: number;
|
||||||
delay: number[];
|
delay?: number[];
|
||||||
down: number[];
|
down?: number[];
|
||||||
service: ModelService;
|
service?: ModelService;
|
||||||
total_down: number;
|
total_down?: number;
|
||||||
total_up: number;
|
total_up?: number;
|
||||||
up: number[];
|
up?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelSettingForm {
|
export interface ModelSettingForm {
|
||||||
cover: number;
|
cover?: number;
|
||||||
custom_code?: string;
|
custom_code?: string;
|
||||||
custom_code_dashboard?: string;
|
custom_code_dashboard?: string;
|
||||||
custom_nameservers?: string;
|
custom_nameservers?: string;
|
||||||
@@ -602,54 +602,54 @@ export interface ModelSettingForm {
|
|||||||
ignored_ip_notification?: string;
|
ignored_ip_notification?: string;
|
||||||
install_host?: string;
|
install_host?: string;
|
||||||
/** IP变更提醒的通知组 */
|
/** IP变更提醒的通知组 */
|
||||||
ip_change_notification_group_id: number;
|
ip_change_notification_group_id?: number;
|
||||||
/** @minLength 2 */
|
/** @minLength 2 */
|
||||||
language: string;
|
language?: string;
|
||||||
/** 真实IP */
|
/** 真实IP */
|
||||||
real_ip_header?: string;
|
real_ip_header?: string;
|
||||||
/** @minLength 1 */
|
/** @minLength 1 */
|
||||||
site_name: string;
|
site_name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelStreamServer {
|
export interface ModelStreamServer {
|
||||||
country_code: string;
|
country_code?: string;
|
||||||
/** 展示排序,越大越靠前 */
|
/** 展示排序,越大越靠前 */
|
||||||
display_index: number;
|
display_index?: number;
|
||||||
host: ModelHost;
|
host?: ModelHost;
|
||||||
id: number;
|
id?: number;
|
||||||
last_active: string;
|
last_active?: string;
|
||||||
name: string;
|
name?: string;
|
||||||
/** 公开备注,只第一个数据包有值 */
|
/** 公开备注,只第一个数据包有值 */
|
||||||
public_note: string;
|
public_note?: string;
|
||||||
state: ModelHostState;
|
state?: ModelHostState;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelStreamServerData {
|
export interface ModelStreamServerData {
|
||||||
now: number;
|
now?: number;
|
||||||
servers: ModelStreamServer[];
|
servers?: ModelStreamServer[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelTerminalForm {
|
export interface ModelTerminalForm {
|
||||||
protocol: string;
|
protocol?: string;
|
||||||
server_id: number;
|
server_id?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelUser {
|
export interface ModelUser {
|
||||||
created_at: string;
|
created_at?: string;
|
||||||
id: number;
|
id?: number;
|
||||||
password: string;
|
password?: string;
|
||||||
updated_at: string;
|
updated_at?: string;
|
||||||
username: string;
|
username?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelUserForm {
|
export interface ModelUserForm {
|
||||||
password: string;
|
password?: string;
|
||||||
username: string;
|
username?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModelWAF {
|
export interface ModelWAF {
|
||||||
count: number;
|
count?: number;
|
||||||
ip: number[];
|
ip?: number[];
|
||||||
last_block_reason: number;
|
last_block_reason?: number;
|
||||||
last_block_timestamp: number;
|
last_block_timestamp?: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { ConfigEssential } from "@/types";
|
|
||||||
|
|
||||||
export interface ConfigContextProps {
|
|
||||||
config?: ConfigEssential;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
export interface ConfigEssential {
|
|
||||||
language: string;
|
|
||||||
agent_secret_key: string;
|
|
||||||
install_host: string;
|
|
||||||
listen_port: number;
|
|
||||||
site_name: string;
|
|
||||||
tls: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ConfigStore {
|
|
||||||
config?: ConfigEssential;
|
|
||||||
setConfig: (config?: ConfigEssential) => void;
|
|
||||||
}
|
|
||||||
@@ -12,5 +12,3 @@ export * from './notificationStore';
|
|||||||
export * from './notificationContext';
|
export * from './notificationContext';
|
||||||
export * from './fm';
|
export * from './fm';
|
||||||
export * from './settings';
|
export * from './settings';
|
||||||
export * from './configStore';
|
|
||||||
export * from './configContext';
|
|
||||||
|
|||||||
Reference in New Issue
Block a user