From 4746f8cac26fecd2da00c28a9c39a9acfc613ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Mon, 28 Sep 2026 14:42:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=20=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6=E9=A1=B9=E8=83=8C=E6=99=AF=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E5=B9=B6=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E5=85=A8=E8=BF=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 置顶项背景改用 --color-primary-light-1 对齐服务器列表焦点色 - 服务器管理菜单新增一键全连,全连后恢复原焦点 - 修复连 B 失败后焦点回落 A 状态点误染红(改用 per-profile 状态) --- .../FileSystem/components/Sidebar.vue | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/FileSystem/components/Sidebar.vue b/frontend/src/components/FileSystem/components/Sidebar.vue index 710e980..0197cbb 100644 --- a/frontend/src/components/FileSystem/components/Sidebar.vue +++ b/frontend/src/components/FileSystem/components/Sidebar.vue @@ -209,6 +209,9 @@
添加服务器
+
+ 一键全连 +
启动时自动连接所有服务器 @@ -238,7 +241,7 @@ import type { SidebarConfig, FavoriteFile } from '@/types/file-system' import type { SystemInfo } from '@/api/connection-manager' import { connectionManager } from '@/api/connection-manager' import { useConfigStore } from '@/stores/config' -import { IconStar, IconClose, IconPushpin, IconEdit, IconMore, IconDown, IconRight, IconStorage, IconComputer, IconDesktop, IconPlus, IconCheckCircle } from '@arco-design/web-vue/es/icon' +import { IconStar, IconClose, IconPushpin, IconEdit, IconMore, IconDown, IconRight, IconStorage, IconComputer, IconDesktop, IconPlus, IconCheckCircle, IconLink } from '@arco-design/web-vue/es/icon' import { getFileIcon } from '@/utils/fileUtils' const configStore = useConfigStore() @@ -379,6 +382,25 @@ function toggleServerVisibility(id: string) { localStorage.setItem('desk:hiddenServers', JSON.stringify(hiddenServerIds.value)) } +// 一键全连:并发连接所有可见的非本地服务器(连接池模式,已连的探测复用), +// 全部落地后恢复原焦点,不打扰当前视图 +const connectingAll = ref(false) +async function connectAllServers() { + if (connectingAll.value) return + settingsOpen.value = false + connectingAll.value = true + const prevActive = activeId.value + try { + const targets = visibleProfiles.value.filter(p => p.type !== 'local') + await Promise.allSettled(targets.map(p => connectionManager.connect(p.id))) + if (prevActive && profiles.value.some(p => p.id === prevActive)) { + await connectionManager.connect(prevActive).catch(() => {}) + } + } finally { + connectingAll.value = false + } +} + // 监听连接变化 + 系统信息变化 connectionManager.onStateChange(() => { profiles.value = connectionManager.profiles @@ -541,7 +563,9 @@ function sysInfo(profileId: string): SystemInfo | undefined { function stateDotClass(profileId: string): string { if (profileId === activeId.value) { - const state = connectionManager.state + // 用 per-profile 状态而非全局 state:全局 state 只描述最近一次连接尝试, + // 连 B 失败后全局停在 error,焦点回落 A 会把 A 误染红 + const state = connectionManager.getProfileState(profileId).state if (state === 'connected') return 'connected' if (state === 'connecting') return 'connecting' if (state === 'error') return 'error' @@ -602,7 +626,8 @@ function formatBytes(n: number): string { function stateText(profileId: string): string { if (profileId === activeId.value) { - const s = connectionManager.state + // 同 stateDotClass:per-profile 状态不随连接尝试漂移 + const s = connectionManager.getProfileState(profileId).state if (s === 'connected') return '已连接' if (s === 'connecting') return '连接中...' if (s === 'error') return '连接失败' @@ -964,7 +989,7 @@ function onSrvCtxVisible(index: number, visible: boolean) { } .sidebar-item-pinned { - background: var(--arcoblue-1); + background: var(--color-primary-light-1); border-radius: 0; }