feat(sourcemap): 隐藏文件路径,显示 Build ID,添加删除按钮,倒序排列

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-06-23 12:04:55 +08:00
父节点 d05874bc15
当前提交 9413a5ea5c
共有 2 个文件被更改,包括 42 次插入5 次删除

查看文件

@ -107,7 +107,7 @@ export interface BugCollectSourcemap {
platform: string
appVersion: string
bundleName: string
storageKey: string
buildId: string | null
uploadedAt: string
}
@ -251,5 +251,9 @@ export const bugCollectApi = {
sourcemaps: {
list: (appKey: string) =>
client.get<{ data: BugCollectSourcemap[] }>('/bugcollect/v1/sourcemaps', { params: { appKey } }),
delete: (id: number) =>
client.delete(`/bugcollect/v1/sourcemaps/${id}`),
pruneAll: () =>
client.post<{ data: string }>('/bugcollect/v1/sourcemaps/prune-all'),
},
}

查看文件

@ -39,11 +39,30 @@
</template>
</el-table-column>
<el-table-column prop="appVersion" label="应用版本" width="120" />
<el-table-column prop="bundleName" label="Bundle 名称" width="120" />
<el-table-column prop="storageKey" label="文件路径" min-width="300" show-overflow-tooltip />
<el-table-column prop="bundleName" label="Bundle" width="120" />
<el-table-column prop="buildId" label="Build ID" width="160" show-overflow-tooltip>
<template #default="{ row }">
<span class="buildid-text">{{ row.buildId ?? '—' }}</span>
</template>
</el-table-column>
<el-table-column prop="uploadedAt" label="上传时间" width="170">
<template #default="{ row }">{{ formatTime(row.uploadedAt) }}</template>
</el-table-column>
<el-table-column label="操作" width="80" fixed="right">
<template #default="{ row }">
<el-popconfirm
title="确认删除该 Sourcemap?"
confirm-button-text="删除"
cancel-button-text="取消"
confirm-button-type="danger"
@confirm="handleDelete(row.id)"
>
<template #reference>
<el-button type="danger" size="small" link>删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<el-empty v-if="!loading && sourcemaps.length === 0" description="暂无 Sourcemap 文件" />
@ -97,7 +116,7 @@ import { ref, onMounted, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { bugCollectApi, type BugCollectSourcemap } from '@/api/bugcollect'
import { useBugCollectApp } from '@/composables/useBugCollectApp'
import { levelTag, statusTag, statusLabel, formatTime } from '@/utils/bugCollect'
import { formatTime } from '@/utils/bugCollect'
const { apps, loadingApps, appKey, setApp, gateStatus, applyDialogVisible, applyReason, applyLoading, submitActivation } = useBugCollectApp()
@ -113,7 +132,6 @@ function platformTagType(platform: string): '' | 'success' | 'warning' | 'info'
return map[platform?.toLowerCase()] ?? 'info'
}
async function loadData() {
if (!appKey.value || gateStatus.value !== 'enabled') return
loading.value = true
@ -128,6 +146,16 @@ async function loadData() {
}
}
async function handleDelete(id: number) {
try {
await bugCollectApi.sourcemaps.delete(id)
ElMessage.success('已删除')
sourcemaps.value = sourcemaps.value.filter(s => s.id !== id)
} catch {
ElMessage.error('删除失败')
}
}
watch(gateStatus, (s) => { if (s === 'enabled') loadData() })
onMounted(loadData)
</script>
@ -140,6 +168,11 @@ onMounted(loadData)
justify-content: space-between;
align-items: center;
}
.buildid-text {
font-family: monospace;
font-size: 12px;
color: #606266;
}
.usage-guide h4 {
margin: 16px 0 8px;
font-size: 14px;