订阅健康检查默认开启,编辑支持改名
内核没有默认的健康检查地址,url 为空时检查根本不会运行 (adapter/provider/healthcheck.go:196-199),所以默认值必须写全; 开关只翻 enable,手写的 url/interval 留着下次开启时还用。 改名和策略组 use: 的引用同步收在同一次变换里,链式副本由保存 链路的 syncGenerated 按新名字重建,缓存路径刻意不动——file 类型 的数据本体和副本认亲都靠它。
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 选中那个订阅的详情:地址、更新间隔、健康检查,和它带来的线路。
|
||||
* 选中那个订阅的详情:地址、更新间隔,和它带来的线路。
|
||||
*
|
||||
* 健康检查不在字段区展示,只是右上角一个开关动作:默认就是开着的,
|
||||
* 值得占一行的只有「被谁关掉了」这件事,而按钮文案本身已经说明了状态。
|
||||
*
|
||||
* 线路列表只读。这些线路不在内核的全局名字表里,不能被入站直接引用,
|
||||
* 只能经策略组的 `use:` 整批引入,所以这里没有「换线」可点。
|
||||
@@ -13,6 +16,7 @@ import IconEdit from '~icons/ri/edit-line'
|
||||
import IconDelete from '~icons/ri/delete-bin-line'
|
||||
import IconRefresh from '~icons/ri/refresh-line'
|
||||
import IconOffline from '~icons/ri/cloud-off-line'
|
||||
import IconPulse from '~icons/ri/pulse-line'
|
||||
|
||||
const props = defineProps<{
|
||||
subscription: Subscription
|
||||
@@ -30,6 +34,8 @@ const emit = defineEmits<{
|
||||
remove: []
|
||||
/** 让内核立刻重新拉取。运行时动作,不写配置文件 */
|
||||
refresh: []
|
||||
/** 开关健康检查。写配置文件,走保存链路 */
|
||||
toggleHealthCheck: []
|
||||
}>()
|
||||
|
||||
const lines = computed(() => props.info?.proxies ?? [])
|
||||
@@ -48,15 +54,13 @@ function delayClass(ms: number | null): string {
|
||||
<div class="title">
|
||||
<span class="name">{{ subscription.name }}</span>
|
||||
<div class="acts">
|
||||
<button type="button" :disabled="saving" @click="emit('toggleHealthCheck')">
|
||||
<IconPulse /> {{ subscription.healthCheck ? '关闭健康检查' : '开启健康检查' }}
|
||||
</button>
|
||||
<button type="button" :disabled="!online || refreshing" @click="emit('refresh')">
|
||||
<IconRefresh /> {{ refreshing ? '更新中' : '更新订阅' }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="saving || subscription.type === 'file'"
|
||||
:title="subscription.type === 'file' ? '文件导入的订阅没有可编辑的字段' : undefined"
|
||||
@click="emit('edit')"
|
||||
>
|
||||
<button type="button" :disabled="saving" @click="emit('edit')">
|
||||
<IconEdit /> 编辑
|
||||
</button>
|
||||
<button type="button" class="danger" :disabled="saving" @click="emit('remove')">
|
||||
@@ -78,14 +82,6 @@ function delayClass(ms: number | null): string {
|
||||
{{ subscription.interval !== null ? `每 ${subscription.interval} 秒` : '已关闭' }}
|
||||
</dd>
|
||||
</template>
|
||||
<dt>健康检查</dt>
|
||||
<dd class="mono">
|
||||
<template v-if="subscription.healthCheck">
|
||||
{{ subscription.healthCheck.url
|
||||
}}{{ subscription.healthCheck.interval !== null ? `,每 ${subscription.healthCheck.interval} 秒` : '' }}
|
||||
</template>
|
||||
<template v-else>未开启</template>
|
||||
</dd>
|
||||
</dl>
|
||||
</header>
|
||||
|
||||
@@ -221,6 +217,12 @@ h3 {
|
||||
padding: 0;
|
||||
max-height: 420px;
|
||||
overflow-y: auto;
|
||||
/* 细杆加透明轨道,别让系统滚动条压在延迟列上;gutter 常驻,
|
||||
线路数跨过滚动阈值时右缘不横跳 */
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--c-border-strong) transparent;
|
||||
scrollbar-gutter: stable;
|
||||
padding-right: var(--s-2);
|
||||
}
|
||||
|
||||
.row {
|
||||
|
||||
Reference in New Issue
Block a user