refactor: 删除版本更新功能 + 报表页自动刷新
删除版本与更新功能: - routes/admin_api/update.py: 删除整个文件 - routes/admin_api/__init__.py: 移除 update 模块注册 - admin-frontend/src/pages/SystemPage.vue: 移除版本更新UI区块 - admin-frontend/src/api/update.js: 删除整个文件 - 删除 static/admin/assets/update-*.js 报表页自动刷新: - admin-frontend/src/pages/ReportPage.vue: 添加 setInterval 每1秒刷新 - 在 onMounted 启动定时器,onUnmounted 清除 - 覆盖统计数据、运行中任务、系统信息等所有动态数据 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { computed, inject, onMounted, ref } from 'vue'
|
||||
import { computed, inject, onMounted, onUnmounted, ref } from 'vue'
|
||||
import {
|
||||
Calendar,
|
||||
ChatLineSquare,
|
||||
@@ -19,7 +19,6 @@ import { fetchFeedbackStats } from '../api/feedbacks'
|
||||
import { fetchEmailStats } from '../api/email'
|
||||
import { fetchDockerStats, fetchRunningTasks, fetchServerInfo, fetchTaskStats } from '../api/tasks'
|
||||
import { fetchSystemConfig } from '../api/system'
|
||||
import { fetchUpdateResult, fetchUpdateStatus } from '../api/update'
|
||||
|
||||
const refreshStats = inject('refreshStats', null)
|
||||
const adminStats = inject('adminStats', null)
|
||||
@@ -34,9 +33,6 @@ const feedbackStats = ref(null)
|
||||
const serverInfo = ref(null)
|
||||
const dockerStats = ref(null)
|
||||
const systemConfig = ref(null)
|
||||
const updateStatus = ref(null)
|
||||
const updateStatusError = ref('')
|
||||
const updateResult = ref(null)
|
||||
const queueTab = ref('running')
|
||||
|
||||
function recordUpdatedAt() {
|
||||
@@ -63,12 +59,6 @@ function parsePercent(value) {
|
||||
return n
|
||||
}
|
||||
|
||||
function shortCommit(value) {
|
||||
const text = String(value ?? '').trim()
|
||||
if (!text) return '-'
|
||||
return text.length > 12 ? `${text.slice(0, 12)}…` : text
|
||||
}
|
||||
|
||||
function sourceLabel(source) {
|
||||
const raw = String(source ?? '').trim()
|
||||
if (!raw) return '手动'
|
||||
@@ -155,9 +145,6 @@ const runningCountsLabel = computed(() => {
|
||||
return `运行中 ${runningCount} / 排队 ${queuingCount} / 并发上限 ${maxGlobal || maxConcurrentGlobal.value || '-'}`
|
||||
})
|
||||
|
||||
const updateAvailable = computed(() => Boolean(updateStatus.value?.update_available))
|
||||
const updateRunning = computed(() => updateResult.value?.status === 'running')
|
||||
|
||||
async function refreshAll() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
@@ -170,8 +157,6 @@ async function refreshAll() {
|
||||
serverResult,
|
||||
dockerResult,
|
||||
configResult,
|
||||
updateStatusResult,
|
||||
updateResultResult,
|
||||
] = await Promise.allSettled([
|
||||
fetchTaskStats(),
|
||||
fetchRunningTasks(),
|
||||
@@ -180,8 +165,6 @@ async function refreshAll() {
|
||||
fetchServerInfo(),
|
||||
fetchDockerStats(),
|
||||
fetchSystemConfig(),
|
||||
fetchUpdateStatus(),
|
||||
fetchUpdateResult(),
|
||||
])
|
||||
|
||||
taskStats.value = taskResult.status === 'fulfilled' ? taskResult.value : null
|
||||
@@ -192,22 +175,6 @@ async function refreshAll() {
|
||||
dockerStats.value = dockerResult.status === 'fulfilled' ? dockerResult.value : null
|
||||
systemConfig.value = configResult.status === 'fulfilled' ? configResult.value : null
|
||||
|
||||
if (updateStatusResult.status === 'fulfilled') {
|
||||
const res = updateStatusResult.value
|
||||
if (res?.ok) {
|
||||
updateStatus.value = res.data || null
|
||||
updateStatusError.value = ''
|
||||
} else {
|
||||
updateStatus.value = null
|
||||
updateStatusError.value = res?.error || '未发现更新状态(Update-Agent 可能未运行)'
|
||||
}
|
||||
} else {
|
||||
updateStatus.value = null
|
||||
updateStatusError.value = ''
|
||||
}
|
||||
|
||||
updateResult.value = updateResultResult.status === 'fulfilled' && updateResultResult.value?.ok ? updateResultResult.value.data : null
|
||||
|
||||
await refreshStats?.()
|
||||
recordUpdatedAt()
|
||||
} finally {
|
||||
@@ -215,7 +182,19 @@ async function refreshAll() {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(refreshAll)
|
||||
let refreshTimer = null
|
||||
|
||||
onMounted(() => {
|
||||
refreshAll()
|
||||
refreshTimer = setInterval(refreshAll, 1000)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (refreshTimer) {
|
||||
clearInterval(refreshTimer)
|
||||
refreshTimer = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -225,10 +204,6 @@ onMounted(refreshAll)
|
||||
<div class="hero-title">
|
||||
<div class="hero-title-row">
|
||||
<h2>报表中心</h2>
|
||||
<el-tag v-if="updateStatusError" type="info" effect="dark">更新状态未知</el-tag>
|
||||
<el-tag v-else-if="updateAvailable" type="warning" effect="dark">新版本可更新</el-tag>
|
||||
<el-tag v-else type="success" effect="dark">已是最新</el-tag>
|
||||
<el-tag v-if="updateRunning" type="warning" effect="plain">更新中</el-tag>
|
||||
</div>
|
||||
<div class="hero-meta app-muted">
|
||||
<span v-if="lastUpdatedAt">更新时间:{{ lastUpdatedAt }}</span>
|
||||
@@ -584,21 +559,12 @@ onMounted(refreshAll)
|
||||
<el-icon><Tools /></el-icon>
|
||||
</div>
|
||||
<div class="head-text">
|
||||
<div class="panel-title">配置与更新</div>
|
||||
<div class="panel-sub app-muted">定时/代理/并发与版本</div>
|
||||
<div class="panel-title">配置概览</div>
|
||||
<div class="panel-sub app-muted">定时 / 代理 / 并发</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-tag v-if="updateAvailable" effect="dark" type="warning">可更新</el-tag>
|
||||
</div>
|
||||
|
||||
<el-alert
|
||||
v-if="updateStatusError"
|
||||
type="info"
|
||||
:closable="false"
|
||||
:title="updateStatusError"
|
||||
style="margin-bottom: 12px"
|
||||
/>
|
||||
|
||||
<div class="config-grid">
|
||||
<div class="config-item">
|
||||
<div class="config-k app-muted">定时任务</div>
|
||||
@@ -631,18 +597,6 @@ onMounted(refreshAll)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="sub-title">版本信息</div>
|
||||
<el-descriptions border :column="1" size="small">
|
||||
<el-descriptions-item label="本地版本(commit)">{{ shortCommit(updateStatus?.local_commit) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="远端版本(commit)">{{ shortCommit(updateStatus?.remote_commit) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="最近检查时间">{{ updateStatus?.checked_at || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item v-if="updateResult?.job_id" label="最近更新">
|
||||
<span>job {{ updateResult.job_id }} / {{ updateResult?.status || '-' }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
Reference in New Issue
Block a user