This commit is contained in:
Baobhan Sith
2025-05-16 22:49:07 +08:00
parent 084cc570f4
commit 56833d58e1
23 changed files with 89 additions and 194 deletions
@@ -235,9 +235,9 @@ export const useAppearanceStore = defineStore('appearance', () => {
* @param enabled 是否启用
*/
async function setTerminalBackgroundEnabled(enabled: boolean) {
console.log(`[AppearanceStore LOG] setTerminalBackgroundEnabled 调用,准备发送给后端的值: ${enabled}`); // 添加日志
console.log(`[AppearanceStore LOG] setTerminalBackgroundEnabled 调用,准备发送给后端的值: ${enabled}`);
await updateAppearanceSettings({ terminalBackgroundEnabled: enabled });
console.log(`[AppearanceStore LOG] setTerminalBackgroundEnabled 更新后端调用完成。`); // 添加日志
console.log(`[AppearanceStore LOG] setTerminalBackgroundEnabled 更新后端调用完成。`);
}
/**
+5 -5
View File
@@ -55,17 +55,17 @@ interface AuthState {
user: UserInfo | null;
isLoading: boolean;
error: string | null;
loginRequires2FA: boolean; // 新增状态:标记登录是否需要 2FA
loginRequires2FA: boolean;
// 存储 IP 黑名单数据 (虽然 actions 在这里,但 state 结构保持)
ipBlacklist: {
entries: any[]; // TODO: Define a proper type for blacklist entries
total: number;
};
needsSetup: boolean; // 是否需要初始设置
publicCaptchaConfig: PublicCaptchaConfig | null; // Public CAPTCHA config
passkeys: PasskeyInfo[] | null; // Store for user's passkeys
passkeysLoading: boolean; // Loading state for passkeys
hasPasskeysAvailable: boolean; // Indicates if passkeys are available for login
publicCaptchaConfig: PublicCaptchaConfig | null;
passkeys: PasskeyInfo[] | null;
passkeysLoading: boolean;
hasPasskeysAvailable: boolean;
}
export const useAuthStore = defineStore('auth', {
@@ -16,7 +16,7 @@ export interface ConnectionInfo {
created_at: number;
updated_at: number;
last_connected_at: number | null;
notes?: string | null; // 新增备注字段
notes?: string | null;
vncPassword?: string; // VNC specific password
}
+8 -8
View File
@@ -411,7 +411,7 @@ function ensureNodeIds(node: LayoutNode | null): LayoutNode | null {
}
// 新增 Action: 更新特定容器节点的子节点大小
// 更新特定容器节点的子节点大小
function updateNodeSizes(nodeId: string, childrenSizes: { index: number; size: number }[]) {
console.log(`[Layout Store] 请求更新节点 ${nodeId} 的子节点大小:`, childrenSizes);
const originalJson = JSON.stringify(layoutTree.value); // Store original state
@@ -426,14 +426,14 @@ function ensureNodeIds(node: LayoutNode | null): LayoutNode | null {
console.log(`[Layout Store] 未找到节点 ${nodeId} 或大小未改变。`);
}
}
// 新增 Action: 切换布局(Header/Footer)的可见性
// 切换布局(Header/Footer)的可见性
function toggleLayoutVisibility() {
isLayoutVisible.value = !isLayoutVisible.value;
console.log(`[Layout Store] 布局可见性切换为: ${isLayoutVisible.value}`);
// 注意:这个状态目前不与后端同步
}
// 新增 Action: 从后端加载主导航栏可见性设置
// 从后端加载主导航栏可见性设置
async function loadHeaderVisibility() {
console.log('[Layout Store] Attempting to load header visibility from backend...');
try {
@@ -453,7 +453,7 @@ function ensureNodeIds(node: LayoutNode | null): LayoutNode | null {
}
}
// 新增 Action: 切换主导航栏可见性并同步到后端
// 切换主导航栏可见性并同步到后端
async function toggleHeaderVisibility() {
const newValue = !isHeaderVisible.value;
console.log(`[Layout Store] Toggling header visibility to: ${newValue}`);
@@ -471,19 +471,19 @@ function ensureNodeIds(node: LayoutNode | null): LayoutNode | null {
}
}
// 新增 Action: 获取系统内置的默认布局
// 获取系统内置的默认布局
function getSystemDefaultLayout(): LayoutNode {
console.log('[Layout Store] Getting system default layout.');
return getDefaultLayout(); // 直接调用内部函数
}
// 新增 Action: 获取系统内置的默认侧栏配置
// 获取系统内置的默认侧栏配置
function getSystemDefaultSidebarPanes(): { left: PaneName[], right: PaneName[] } {
console.log('[Layout Store] Getting system default sidebar panes.');
return getDefaultSidebarPanes();
}
// 新增 Action: 将当前主布局树持久化到后端和 localStorage
// 将当前主布局树持久化到后端和 localStorage
async function persistLayoutTree() { // Make async
// ... (existing try/catch logic for backend and localStorage) ...
// Ensure apiClient calls are awaited if they return promises
@@ -504,7 +504,7 @@ function ensureNodeIds(node: LayoutNode | null): LayoutNode | null {
}
}
// 新增 Action: 将当前侧栏配置持久化到后端和 localStorage
// 将当前侧栏配置持久化到后端和 localStorage
async function persistSidebarPanes() { // Make async
// ... (existing try/catch logic for backend and localStorage) ...
try {