轻提示铺开到全部页面;内核状态悬停变重启;GEO 支持单文件下载
侧栏动作排撤掉重启图标,内核状态(圆点加版本号)本身变成按钮:悬停 换层显示「重启内核」,不在线时只当状态看。行高压成 1 修掉圆点和等宽 字体不居中的问题。 四个页面的一次性反馈(保存、删除、更新订阅、断开连接、测延迟结论) 全部改走 toast,commit() 改返回成败给「失败不关对话框」用;持续状态 (连接页轮询失败、请求页日志流失败)留在页内,会自动消失的提示装不下 需要一直可见的信息。toast 加 info 类别给中性结论用。 GEO 每行的更新改成单独下载那一个文件:内核只有全量更新的口子,单文件 只能服务端自己下(POST /api/geo/sync),代价是只有形状校验(MaxMind 末尾标记、geodata 首字节,shared/geo.ts 带测试)且内核重启后才换用新 文件;「更新全部」文字按钮保留内核的全量口子,有完整校验和热加载。 上传两行的按钮改「选择或拖放文件」,投放区拖入高亮,恢复策略挪到 恢复行下方。
This commit is contained in:
@@ -20,16 +20,17 @@ import {
|
||||
import type { ConnectionSnapshot, SortKey } from '@shared/connections.ts'
|
||||
import { formatBytes } from '@shared/format.ts'
|
||||
import { ApiError, api } from '../api'
|
||||
import { toast, toastError } from '../toast'
|
||||
import { kernel } from '../runtime'
|
||||
import ConfirmDialog from '../components/ConfirmDialog.vue'
|
||||
import IconClose from '~icons/ri/close-line'
|
||||
|
||||
const snapshot = ref<ConnectionSnapshot | null>(null)
|
||||
/** 断开动作的失败。只被下一次动作覆盖,轮询不碰它 */
|
||||
const failure = ref('')
|
||||
/** 轮询取数的失败。轮询自己成功时清掉 */
|
||||
/**
|
||||
* 轮询取数的失败,成功时自己清掉。这是持续状态所以留在页内;
|
||||
* 断开动作的失败是一次性事件,走右上角轻提示。
|
||||
*/
|
||||
const pollFailure = ref('')
|
||||
const shownFailure = computed(() => failure.value || pollFailure.value)
|
||||
/** 表格里的持续时间按这一刻算。跟着轮询节拍走,不单独开秒表 */
|
||||
const now = ref(Date.now())
|
||||
const query = ref('')
|
||||
@@ -94,12 +95,11 @@ const totalSize = computed(() => virtualizer.value.getTotalSize())
|
||||
async function closeOne(id: string) {
|
||||
if (closing.value.includes(id) || closingAll.value) return
|
||||
closing.value = [...closing.value, id]
|
||||
failure.value = ''
|
||||
try {
|
||||
await api.closeConnection(id)
|
||||
await refresh()
|
||||
} catch (error) {
|
||||
failure.value = error instanceof ApiError ? error.message : String(error)
|
||||
toastError(error)
|
||||
} finally {
|
||||
closing.value = closing.value.filter((item) => item !== id)
|
||||
}
|
||||
@@ -109,12 +109,12 @@ async function closeAllConfirmed() {
|
||||
askAll.value = false
|
||||
if (closingAll.value) return
|
||||
closingAll.value = true
|
||||
failure.value = ''
|
||||
try {
|
||||
await api.closeAllConnections()
|
||||
await refresh()
|
||||
toast('已断开所有连接')
|
||||
} catch (error) {
|
||||
failure.value = error instanceof ApiError ? error.message : String(error)
|
||||
toastError(error)
|
||||
} finally {
|
||||
closingAll.value = false
|
||||
}
|
||||
@@ -152,14 +152,9 @@ async function closeAllConfirmed() {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="shownFailure" class="failure">
|
||||
<strong class="failure-text">{{ shownFailure }}</strong>
|
||||
<button
|
||||
type="button"
|
||||
class="failure-x"
|
||||
title="关闭提示"
|
||||
@click="((failure = ''), (pollFailure = ''))"
|
||||
>
|
||||
<div v-if="pollFailure" class="failure">
|
||||
<strong class="failure-text">{{ pollFailure }}</strong>
|
||||
<button type="button" class="failure-x" title="关闭提示" @click="pollFailure = ''">
|
||||
<IconClose />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user