-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
97 lines (85 loc) · 2.01 KB
/
types.ts
File metadata and controls
97 lines (85 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
export enum Protocol {
RDP = '桌面远程 (RDP)',
SSH = 'SSH (Linux)',
VNC = 'VNC / VDI',
HTTPS = 'Web HTTPS',
HTTP = 'Web HTTP',
TODESK = 'ToDesk',
SUNLOGIN = '向日葵 (Sunlogin)',
TEAMVIEWER = 'TeamViewer',
ANYDESK = 'AnyDesk',
VPN = 'VPN'
}
export enum VpnType {
WEB = '网页登录 (Web Login)',
CLIENT = '客户端软件 (Client App)',
OPENVPN = 'OpenVPN 配置文件',
L2TP = 'L2TP/IPsec',
WIREGUARD = 'WireGuard'
}
export enum UserRole {
ADMIN = 'admin',
USER = 'user'
}
export interface User {
id: string;
username: string;
nickname: string;
role: UserRole;
passwordHash: string;
lastActiveAt: number;
createdAt: number;
}
export interface AuditMetadata {
createdBy: string;
createdById: string;
createdAt: string;
updatedBy: string;
updatedById: string;
updatedAt: string;
}
export interface Project extends AuditMetadata {
id: string;
name: string;
description?: string;
icon: string;
}
export interface RemoteConnection extends AuditMetadata {
id: string;
projectId: string;
name: string;
host: string;
port?: number;
username?: string;
password?: string;
protocol: Protocol;
vpnType?: VpnType;
vpnLoginUrl?: string;
requiredVpnId?: string;
notes?: string;
tags?: string[];
lastAccessed?: string;
}
// DTOs for Input (Forms) - Exclude server-managed audit fields
export type ProjectInput = Omit<Project, keyof AuditMetadata>;
export type ConnectionInput = Omit<RemoteConnection, keyof AuditMetadata>;
export type ToastType = 'success' | 'error' | 'info' | 'loading';
export interface ToastMessage {
id: string;
type: ToastType;
title: string;
message?: string;
duration?: number;
}
export interface ConfirmOptions {
title: string;
message: string;
confirmText?: string;
cancelText?: string;
variant?: 'danger' | 'info';
onConfirm: () => void;
}
export interface UIContextType {
toast: (type: ToastType, title: string, message?: string, duration?: number) => void;
confirm: (options: ConfirmOptions) => void;
}