From a4d08892f720087dc8baa31f38b1e06bf6c86b87 Mon Sep 17 00:00:00 2001 From: Jz0ojiang Date: Tue, 11 Aug 2026 14:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=A1=B5=E4=B8=80=E8=BD=AE?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E7=BB=86=E5=8C=96=EF=BC=9A=E8=8D=89=E7=A8=BF?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E3=80=81=E9=A2=84=E9=80=89=E3=80=81=E8=8B=A5?= =?UTF-8?q?=E5=B9=B2=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上半部分收敛成一条规则:草稿和已保存一致时显示内核现状;不一致时显示 按草稿保存后的样子,将移除的画删除线、新增的虚线描边,即将被移除的当前 选中用危险色警示。点击语义只看卡片:现在就存在的成员点了立刻生效,保存 后才加入的点了是预选,保存成功后再作为运行时动作选上。预览的集合运算在 web/member-preview.ts,组件里只留接线。 其余:订阅选择器重写成可搜索多选(原平铺标签订阅一多就是一面墙);删除 入站换成页面内确认对话框;列表右列解析到最终出口并标注链式;「高级配置」 更名「配置」;表单重置改按内容比较(按引用的话任何一次运行时刷新都会冲掉 未保存的草稿,watch 传返回数组的 getter 同样触发这个问题);保存后先刷 运行时再换配置数据,避免卡片区闪空。 --- web/App.vue | 4 +- web/components/ConfirmDialog.vue | 80 +++++++++ web/components/InboundList.vue | 35 +++- web/components/OutboundCard.vue | 38 +++- web/components/SourcePicker.vue | 196 +++++++++++++------- web/member-preview.test.ts | 46 +++++ web/member-preview.ts | 37 ++++ web/runtime.ts | 2 +- web/views/InboundDetail.vue | 295 +++++++++++++++++++++++++------ web/views/RouterPage.vue | 57 +++++- 10 files changed, 658 insertions(+), 132 deletions(-) create mode 100644 web/components/ConfirmDialog.vue create mode 100644 web/member-preview.test.ts create mode 100644 web/member-preview.ts diff --git a/web/App.vue b/web/App.vue index 4683305..b103444 100644 --- a/web/App.vue +++ b/web/App.vue @@ -28,9 +28,11 @@ async function load() { refreshing.value = true loadError.value = '' try { + // 先刷运行时再换配置数据。反过来的话,保存后界面已经按新配置渲染, + // 而新建的组在运行时里还查不到,成员卡片会先闪空一下再出现。 + await reloadRuntime() snapshot.value = await api.readConfig() needsToken.value = false - await reloadRuntime() } catch (error) { if (error instanceof ApiError && error.unauthorized) { clearToken() diff --git a/web/components/ConfirmDialog.vue b/web/components/ConfirmDialog.vue new file mode 100644 index 0000000..98aece5 --- /dev/null +++ b/web/components/ConfirmDialog.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/web/components/InboundList.vue b/web/components/InboundList.vue index 17cbf71..bbaa40a 100644 --- a/web/components/InboundList.vue +++ b/web/components/InboundList.vue @@ -6,8 +6,10 @@ */ import { inboundTypeLabel, isUnsetOutbound, outboundLabel } from '@shared/inbounds.ts' import { displayName, isGenerated } from '@shared/inbound-groups.ts' +import { resolveChain } from '@shared/outbound-chain.ts' import type { Inbound } from '@shared/inbounds.ts' -import { runtime } from '../runtime' +import { isChainedLine, runtime } from '../runtime' +import IconLink from '~icons/ri/links-line' defineProps<{ inbounds: Inbound[] }>() const selected = defineModel('selected', { required: true }) @@ -15,13 +17,19 @@ const selected = defineModel('selected', { required: true }) /** * 这一行右侧显示什么。 * - * 指向 Patchbay 自动创建的代理组时显示那个组当前选中的线路,而不是组名——组名是 - * 「patchbay:」加入站名,和左边的名字列完全重复,等于一列没有信息。 + * 指向 Patchbay 自动创建的代理组时,顺着「当前选中」解析到最终出口——组名和左边的 + * 名字列完全重复,而组选中 AUTO 时「AUTO」也不是答案,用户要的是流量走哪条线。 + * 出口经过链式代理入口时带一个标记,和详情里的流量去向对得上。 */ -function outboundOf(inbound: Inbound): string { +function outboundOf(inbound: Inbound): { text: string; chained: boolean } { const mode = inbound.outbound - if (mode.kind !== 'named' || !isGenerated(mode.name)) return outboundLabel(mode) - return displayName(runtime.value[mode.name]?.now ?? '') || '未选择' + if (mode.kind !== 'named' || !isGenerated(mode.name)) + return { text: outboundLabel(mode), chained: false } + const exit = resolveChain(runtime.value, runtime.value[mode.name]?.now ?? null).at(-1) + return { + text: displayName(exit ?? '') || '未选择', + chained: exit !== undefined && isChainedLine(exit), + } } @@ -40,7 +48,10 @@ function outboundOf(inbound: Inbound): string { 默认 - {{ outboundOf(inbound) }} + + + + {{ outboundOf(inbound).text }} @@ -114,8 +125,16 @@ function outboundOf(inbound: Inbound): string { } .out { + display: flex; + align-items: center; + justify-content: flex-end; + gap: var(--s-1); font-size: var(--t-sm); - text-align: right; +} + +.chain { + display: flex; + color: var(--c-chain-text); } .out.is-muted { diff --git a/web/components/OutboundCard.vue b/web/components/OutboundCard.vue index 7cd865e..16b2c3b 100644 --- a/web/components/OutboundCard.vue +++ b/web/components/OutboundCard.vue @@ -19,6 +19,10 @@ defineProps<{ disabledReason?: string /** 这张卡的改动正在提交 */ pending?: boolean + /** 草稿预览里保存后才加入的成员 */ + draft?: boolean + /** 草稿预览里保存后将移除的成员 */ + removed?: boolean /** 这条线路正在测延迟 */ testing?: boolean /** 能不能测延迟。内置出站没得测 */ @@ -48,6 +52,9 @@ function delayClass(ms: number | null): string { selected && 'is-on', disabledReason && 'is-off', pending && 'is-pending', + draft && 'is-draft', + removed && 'is-removed', + !testable && !pending && 'no-foot', ]" > -
+ +