内核没有默认的健康检查地址,url 为空时检查根本不会运行 (adapter/provider/healthcheck.go:196-199),所以默认值必须写全; 开关只翻 enable,手写的 url/interval 留着下次开启时还用。 改名和策略组 use: 的引用同步收在同一次变换里,链式副本由保存 链路的 syncGenerated 按新名字重建,缓存路径刻意不动——file 类型 的数据本体和副本认亲都靠它。
97 lines
2.2 KiB
Vue
97 lines
2.2 KiB
Vue
<script setup lang="ts">
|
|
/**
|
|
* 订阅列表。每行一个订阅:名字、当前线路数、上次更新时间。
|
|
*
|
|
* 只管显示和选中,不碰任何数据。
|
|
*/
|
|
|
|
defineProps<{
|
|
/** 一行要显示的东西,由页面按配置和运行时数据拼好 */
|
|
rows: Array<{
|
|
name: string
|
|
/** 当前有多少条线路。null 表示内核没给数据(没连接,或这个订阅还没拉取过) */
|
|
lines: number | null
|
|
/** 上次拉取成功的时刻。null 表示不知道或从没拉取过 */
|
|
updated: Date | null
|
|
}>
|
|
}>()
|
|
const selected = defineModel<string | null>('selected', { required: true })
|
|
|
|
const pad = (n: number) => String(n).padStart(2, '0')
|
|
|
|
function formatUpdated(at: Date): string {
|
|
return `${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${pad(at.getHours())}:${pad(at.getMinutes())}`
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<ol class="rows">
|
|
<li v-for="row in rows" :key="row.name">
|
|
<button
|
|
type="button"
|
|
:class="['line', selected === row.name && 'is-on']"
|
|
@click="selected = row.name"
|
|
>
|
|
<span class="name">{{ row.name }}</span>
|
|
<span class="lines mono">
|
|
<template v-if="row.lines !== null">{{ row.lines }} 条</template>
|
|
<template v-else>—</template>
|
|
</span>
|
|
<span class="updated mono">{{ row.updated ? formatUpdated(row.updated) : '—' }}</span>
|
|
</button>
|
|
</li>
|
|
</ol>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.rows {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
border: 1px solid var(--c-border);
|
|
border-radius: var(--r-md);
|
|
background: var(--c-surface);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.rows li + li {
|
|
border-top: 1px solid var(--c-border);
|
|
}
|
|
|
|
.line {
|
|
width: 100%;
|
|
display: grid;
|
|
grid-template-columns: minmax(0, 1fr) 4rem 6.5rem;
|
|
align-items: center;
|
|
gap: var(--s-3);
|
|
padding: var(--s-3) var(--s-4);
|
|
border: none;
|
|
background: none;
|
|
cursor: pointer;
|
|
text-align: left;
|
|
}
|
|
|
|
.line:hover {
|
|
background: var(--c-surface-sunken);
|
|
}
|
|
|
|
.line.is-on {
|
|
background: var(--c-accent-soft);
|
|
}
|
|
|
|
.name {
|
|
min-width: 0;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.lines,
|
|
.updated {
|
|
text-align: right;
|
|
font-size: var(--t-sm);
|
|
font-variant-numeric: tabular-nums;
|
|
color: var(--c-text-soft);
|
|
}
|
|
</style>
|