feat: 更新后端平台模块、前端组件及构建产物,新增工作计划文档
- 更新 backend 平台 API endpoints 及 platform_store - 更新前端 ComputeNodesView、DataProcessCreateView、FineTuneCreateView 等组件 - 更新前端 API 模块(compute、fineTune) - 重构 frontend/dist 构建产物(新 hash) - 新增 docs/2026-07-24-work-plan.md 工作计划文档 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
getComputeGpus,
|
||||
getComputeNodes,
|
||||
getComputeQueue,
|
||||
getComputeSyncJob,
|
||||
getNodeReplicas,
|
||||
repairNodeReplicas,
|
||||
testComputeNode,
|
||||
@@ -19,6 +20,7 @@ import {
|
||||
type ComputeNode,
|
||||
type ComputeQueueItem,
|
||||
type ResourceReplica,
|
||||
type ResourceSyncJob,
|
||||
} from '@/api/modules/compute'
|
||||
import { statusLabel, statusTagType } from '@/utils/status'
|
||||
|
||||
@@ -34,6 +36,7 @@ const nodes = ref<ComputeNode[]>([])
|
||||
const gpus = ref<ComputeGpu[]>([])
|
||||
const queue = ref<ComputeQueueItem[]>([])
|
||||
const replicas = ref<ResourceReplica[]>([])
|
||||
const activeSyncJob = ref<ResourceSyncJob | null>(null)
|
||||
const selectedNodeId = ref('')
|
||||
const lastUpdated = ref('')
|
||||
const nodeDialogVisible = ref(false)
|
||||
@@ -91,6 +94,7 @@ async function load(options: { showLoading?: boolean; showButtonLoading?: boolea
|
||||
if ((!selectedNodeId.value || !nodeList.some((item) => item.id === selectedNodeId.value)) && nodeList.length) {
|
||||
selectedNodeId.value = nodeList[0].id
|
||||
}
|
||||
await pollActiveSyncJob()
|
||||
await loadReplicas()
|
||||
lastUpdated.value = new Date().toLocaleTimeString('zh-CN', { hour12: false })
|
||||
} finally {
|
||||
@@ -100,6 +104,19 @@ async function load(options: { showLoading?: boolean; showButtonLoading?: boolea
|
||||
}
|
||||
}
|
||||
|
||||
async function pollActiveSyncJob() {
|
||||
if (!activeSyncJob.value?.id) return
|
||||
try {
|
||||
const sync = await getComputeSyncJob(activeSyncJob.value.id)
|
||||
activeSyncJob.value = sync
|
||||
if (['completed', 'failed', 'stopped', 'cancelled'].includes(sync.status)) {
|
||||
await loadReplicas()
|
||||
}
|
||||
} catch {
|
||||
activeSyncJob.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadReplicas() {
|
||||
if (!selectedNodeId.value) {
|
||||
replicas.value = []
|
||||
@@ -150,8 +167,11 @@ async function handleReplicaRepair() {
|
||||
repairingReplicas.value = true
|
||||
try {
|
||||
const result = await repairNodeReplicas(selectedNodeId.value, targets.map((item) => item.id))
|
||||
activeSyncJob.value = result.sync
|
||||
replicas.value = result.replicas || []
|
||||
if (result.failed?.length) {
|
||||
if (result.async) {
|
||||
ElMessage.success('副本修复任务已提交,页面将自动刷新进度')
|
||||
} else if (result.failed?.length) {
|
||||
ElMessage.warning(`修复完成,失败 ${result.failed.length} 个`)
|
||||
} else {
|
||||
ElMessage.success('副本修复完成')
|
||||
@@ -407,6 +427,13 @@ onUnmounted(() => {
|
||||
<el-button :loading="checkingReplicas" @click="handleReplicaDriftCheck">漂移检测</el-button>
|
||||
<el-button type="primary" :loading="repairingReplicas" @click="handleReplicaRepair">修复副本</el-button>
|
||||
</div>
|
||||
<div v-if="activeSyncJob" class="sync-progress">
|
||||
<div>
|
||||
<strong>同步任务 {{ activeSyncJob.id }}</strong>
|
||||
<el-tag :type="statusTagType(activeSyncJob.status)" size="small">{{ statusLabel(activeSyncJob.status) }}</el-tag>
|
||||
</div>
|
||||
<el-progress :percentage="Number(activeSyncJob.progress || 0)" :stroke-width="8" />
|
||||
</div>
|
||||
<el-table :data="replicas" height="100%">
|
||||
<el-table-column prop="resource_type" label="资源类型" width="110" />
|
||||
<el-table-column prop="resource_id" label="资源 ID" min-width="180" />
|
||||
@@ -582,6 +609,22 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.sync-progress {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
background: #f8fafc;
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.node-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
Reference in New Issue
Block a user