路由页一轮交互细化:草稿预览、预选、若干修正
上半部分收敛成一条规则:草稿和已保存一致时显示内核现状;不一致时显示 按草稿保存后的样子,将移除的画删除线、新增的虚线描边,即将被移除的当前 选中用危险色警示。点击语义只看卡片:现在就存在的成员点了立刻生效,保存 后才加入的点了是预选,保存成功后再作为运行时动作选上。预览的集合运算在 web/member-preview.ts,组件里只留接线。 其余:订阅选择器重写成可搜索多选(原平铺标签订阅一多就是一面墙);删除 入站换成页面内确认对话框;列表右列解析到最终出口并标注链式;「高级配置」 更名「配置」;表单重置改按内容比较(按引用的话任何一次运行时刷新都会冲掉 未保存的草稿,watch 传返回数组的 getter 同样触发这个问题);保存后先刷 运行时再换配置数据,避免卡片区闪空。
This commit is contained in:
@@ -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<string | null>('selected', { required: true })
|
||||
@@ -15,13 +17,19 @@ const selected = defineModel<string | null>('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),
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -40,7 +48,10 @@ function outboundOf(inbound: Inbound): string {
|
||||
<span v-if="inbound.isDefault" class="tag">默认</span>
|
||||
</span>
|
||||
<span :class="['out mono', isUnsetOutbound(inbound.outbound) && 'is-muted']">
|
||||
{{ outboundOf(inbound) }}
|
||||
<span v-if="outboundOf(inbound).chained" class="chain" title="经过链式代理">
|
||||
<IconLink />
|
||||
</span>
|
||||
{{ outboundOf(inbound).text }}
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user