first commit

This commit is contained in:
Awuqing
2026-03-17 13:29:09 +08:00
commit eadd3f8961
219 changed files with 22394 additions and 0 deletions

10
web/src/types/api.ts Normal file
View File

@@ -0,0 +1,10 @@
export interface ApiResponse<T> {
code: number;
message: string;
data: T;
}
export interface ApiErrorPayload {
code?: number;
message?: string;
}

18
web/src/types/auth.ts Normal file
View File

@@ -0,0 +1,18 @@
export interface AuthUser {
id: number;
username: string;
displayName: string;
role: string;
}
export interface LoginPayload {
username: string;
password: string;
}
export interface LoginResult {
token: string;
user: AuthUser;
}
export type AuthStatus = 'idle' | 'bootstrapping' | 'authenticated' | 'anonymous';

View File

@@ -0,0 +1,39 @@
export type BackupRecordStatus = 'running' | 'success' | 'failed'
export interface BackupLogEvent {
recordId: number
sequence: number
level: string
message: string
timestamp: string
completed: boolean
status: string
}
export interface BackupRecordSummary {
id: number
taskId: number
taskName: string
storageTargetId: number
storageTargetName: string
status: BackupRecordStatus
fileName: string
fileSize: number
storagePath: string
durationSeconds: number
errorMessage: string
startedAt: string
completedAt?: string
}
export interface BackupRecordDetail extends BackupRecordSummary {
logContent: string
logEvents?: BackupLogEvent[]
}
export interface BackupRecordListFilter {
taskId?: number
status?: BackupRecordStatus | ''
dateFrom?: string
dateTo?: string
}

View File

@@ -0,0 +1,61 @@
export type BackupTaskType = 'file' | 'mysql' | 'sqlite' | 'postgresql'
export type BackupTaskStatus = 'idle' | 'running' | 'success' | 'failed'
export type BackupCompression = 'gzip' | 'none'
export interface BackupTaskSummary {
id: number
name: string
type: BackupTaskType
enabled: boolean
cronExpr: string
storageTargetId: number
storageTargetName: string
nodeId: number
nodeName?: string
tags: string
retentionDays: number
compression: BackupCompression
encrypt: boolean
maxBackups: number
lastRunAt?: string
lastStatus: BackupTaskStatus
updatedAt: string
}
export interface BackupTaskDetail extends BackupTaskSummary {
sourcePath: string
excludePatterns: string[]
dbHost: string
dbPort: number
dbUser: string
dbName: string
dbPath: string
maskedFields?: string[]
createdAt: string
}
export interface BackupTaskPayload {
name: string
type: BackupTaskType
enabled: boolean
cronExpr: string
sourcePath: string
excludePatterns: string[]
dbHost: string
dbPort: number
dbUser: string
dbPassword: string
dbName: string
dbPath: string
storageTargetId: number
nodeId: number
tags: string
retentionDays: number
compression: BackupCompression
encrypt: boolean
maxBackups: number
}
export interface BackupTaskTogglePayload {
enabled?: boolean
}

View File

@@ -0,0 +1,25 @@
import type { BackupRecordSummary } from './backup-records'
export interface DashboardStorageUsageItem {
storageTargetId: number
targetName: string
totalSize: number
}
export interface BackupTimelinePoint {
date: string
total: number
success: number
failed: number
}
export interface DashboardStats {
totalTasks: number
enabledTasks: number
totalRecords: number
successRate: number
totalBackupBytes: number
lastBackupAt?: string
recentRecords: BackupRecordSummary[]
storageUsage: DashboardStorageUsageItem[]
}

20
web/src/types/nodes.ts Normal file
View File

@@ -0,0 +1,20 @@
export interface NodeSummary {
id: number
name: string
hostname: string
ipAddress: string
status: 'online' | 'offline'
isLocal: boolean
os: string
arch: string
agentVersion: string
lastSeen: string
createdAt: string
}
export interface DirEntry {
name: string
path: string
isDir: boolean
size: number
}

View File

@@ -0,0 +1,36 @@
export type NotificationType = 'email' | 'webhook' | 'telegram'
export type NotificationFieldType = 'input' | 'password' | 'number' | 'textarea'
export interface NotificationSummary {
id: number
name: string
type: NotificationType
enabled: boolean
onSuccess: boolean
onFailure: boolean
updatedAt: string
}
export interface NotificationDetail extends NotificationSummary {
config: Record<string, string | number>
maskedFields?: string[]
}
export interface NotificationPayload {
name: string
type: NotificationType
enabled: boolean
onSuccess: boolean
onFailure: boolean
config: Record<string, string | number>
}
export interface NotificationFieldConfig {
key: string
label: string
type: NotificationFieldType
required?: boolean
placeholder?: string
description?: string
sensitive?: boolean
}

View File

@@ -0,0 +1,54 @@
export type StorageTargetType = 'local_disk' | 'google_drive' | 's3' | 'webdav' | 'aliyun_oss' | 'tencent_cos' | 'qiniu_kodo'
export type StorageTestStatus = 'unknown' | 'success' | 'failed'
export type StorageFieldType = 'input' | 'password' | 'switch'
export interface StorageTargetSummary {
id: number
name: string
type: StorageTargetType
description: string
enabled: boolean
updatedAt: string
lastTestedAt?: string
lastTestStatus: StorageTestStatus
lastTestMessage?: string
}
export interface StorageTargetDetail extends StorageTargetSummary {
configVersion?: number
config: Record<string, string | boolean>
maskedFields?: string[]
}
export interface StorageTargetPayload {
name: string
type: StorageTargetType
description: string
enabled: boolean
config: Record<string, string | boolean>
}
export interface StorageConnectionTestResult {
success: boolean
message: string
}
export interface GoogleDriveAuthStartResult {
authUrl: string
}
export interface GoogleDriveCallbackResult {
success: boolean
message: string
target?: StorageTargetDetail
}
export interface StorageTargetFieldConfig {
key: string
label: string
type: StorageFieldType
required?: boolean
placeholder?: string
description?: string
sensitive?: boolean
}

7
web/src/types/system.ts Normal file
View File

@@ -0,0 +1,7 @@
export interface SystemInfo {
version: string;
mode: string;
startedAt: string;
uptimeSeconds: number;
databasePath: string;
}