fix: 完整显示打包历史信息

This commit is contained in:
shenlei 2026-07-20 14:57:49 +09:00
parent 3e3e4123d0
commit f0c6a2d9b6
2 changed files with 24 additions and 11 deletions

View File

@ -7,7 +7,7 @@ global.fetch = vi.fn()
window.open = vi.fn() window.open = vi.fn()
const mockTasks = [ const mockTasks = [
{ id: '1', app_name: 'App1', build_type: 'Ad_Hoc', scheme_name: 'sch1', status: 'completed', created_at: '2024-01-01T10:00:00', dsym_path: '/path/dsym', oss_url: 'https://oss.com/app1.ipa', qr_code_path: '/path/qr.png' }, { id: '1', app_name: 'App1', build_type: 'Ad_Hoc', scheme_name: 'readoor31OtherPayLongSchemeName', status: 'completed', created_at: '2024-01-01T10:00:00', dsym_path: '/path/dsym', oss_url: 'https://oss.com/app1.ipa', qr_code_path: '/path/qr.png' },
{ id: '2', app_name: 'App2', build_type: 'App_Store', scheme_name: 'sch2', status: 'failed', created_at: '2024-01-02T10:00:00', error_message: '构建失败', error_category: 'compilation' }, { id: '2', app_name: 'App2', build_type: 'App_Store', scheme_name: 'sch2', status: 'failed', created_at: '2024-01-02T10:00:00', error_message: '构建失败', error_category: 'compilation' },
{ id: '3', app_name: 'App3', build_type: 'Ad_Hoc', scheme_name: 'sch1', status: 'pending', created_at: '2024-01-03T10:00:00' }, { id: '3', app_name: 'App3', build_type: 'Ad_Hoc', scheme_name: 'sch1', status: 'pending', created_at: '2024-01-03T10:00:00' },
] ]
@ -148,6 +148,18 @@ describe('HistoryView.vue', () => {
expect(wrapper.vm.statusText('failed')).toBe('失败') expect(wrapper.vm.statusText('failed')).toBe('失败')
}) })
it('时间仅显示月和日Scheme 与状态单元格允许完整换行', async () => {
const router = createMockRouter()
const wrapper = mount(HistoryView, {
global: { plugins: [router] },
})
await flushPromises()
expect(wrapper.vm.formatTime('2024-07-20T10:00:00')).toBe('7/20')
expect(wrapper.find('.scheme-cell').text()).toBe('readoor31OtherPayLongSchemeName')
expect(wrapper.find('.status-cell').text()).toContain('已完成')
})
it('点击查看日志跳转', async () => { it('点击查看日志跳转', async () => {
const router = createMockRouter() const router = createMockRouter()
router.push = vi.fn() router.push = vi.fn()

View File

@ -45,7 +45,7 @@
{{ task.build_type }} {{ task.build_type }}
</span> </span>
</td> </td>
<td>{{ task.scheme_name }}</td> <td class="scheme-cell">{{ task.scheme_name }}</td>
<td class="status-cell"> <td class="status-cell">
<span :class="['task-status', `status-${task.status}`]">{{ statusText(task.status) }}</span> <span :class="['task-status', `status-${task.status}`]">{{ statusText(task.status) }}</span>
<span v-if="task.status === 'failed' && task.error_category" class="error-cat-badge"> <span v-if="task.status === 'failed' && task.error_category" class="error-cat-badge">
@ -308,7 +308,7 @@ const deleteTask = async (taskId) => {
const formatTime = (t) => { const formatTime = (t) => {
if (!t) return '-' if (!t) return '-'
const d = t.endsWith('Z') || t.includes('+') ? new Date(t) : new Date(t + 'Z') const d = t.endsWith('Z') || t.includes('+') ? new Date(t) : new Date(t + 'Z')
return d.toLocaleString() return `${d.getMonth() + 1}/${d.getDate()}`
} }
const formatDuration = (started, completed) => { const formatDuration = (started, completed) => {
@ -361,13 +361,13 @@ const errorCategoryLabel = (cat) => {
.config-table th, .config-table td { padding: 12px; text-align: left; border-bottom: 1px solid #f0f0f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .config-table th, .config-table td { padding: 12px; text-align: left; border-bottom: 1px solid #f0f0f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.config-table th { background: #fafafa; font-weight: 500; color: #666; font-size: 13px; } .config-table th { background: #fafafa; font-weight: 500; color: #666; font-size: 13px; }
.config-table td { font-size: 14px; } .config-table td { font-size: 14px; }
.config-table th:nth-child(1) { width: 14%; } .config-table th:nth-child(1) { width: 10%; }
.config-table th:nth-child(2) { width: 14%; } .config-table th:nth-child(2) { width: 12%; }
.config-table th:nth-child(3) { width: 8%; } .config-table th:nth-child(3) { width: 9%; }
.config-table th:nth-child(4) { width: 10%; } .config-table th:nth-child(4) { width: 18%; }
.config-table th:nth-child(5) { width: 12%; } .config-table th:nth-child(5) { width: 17%; }
.config-table th:nth-child(6) { width: 16%; } .config-table th:nth-child(6) { width: 12%; }
.config-table th:nth-child(7) { width: 26%; } .config-table th:nth-child(7) { width: 22%; }
.config-table tr:hover { background: #fafafa; } .config-table tr:hover { background: #fafafa; }
.build-type-badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; } .build-type-badge { padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
@ -377,11 +377,12 @@ const errorCategoryLabel = (cat) => {
.action-btns { white-space: normal; } .action-btns { white-space: normal; }
.action-btns .action-btn { margin-right: 6px; margin-bottom: 4px; display: inline-block; vertical-align: middle; } .action-btns .action-btn { margin-right: 6px; margin-bottom: 4px; display: inline-block; vertical-align: middle; }
.download-cell { white-space: normal; } .download-cell { white-space: normal; }
.scheme-cell { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; }
.action-btn { padding: 4px 12px; border: 1px solid #d9d9d9; border-radius: 4px; background: white; cursor: pointer; font-size: 12px; } .action-btn { padding: 4px 12px; border: 1px solid #d9d9d9; border-radius: 4px; background: white; cursor: pointer; font-size: 12px; }
.action-btn:hover { border-color: #1890ff; color: #1890ff; } .action-btn:hover { border-color: #1890ff; color: #1890ff; }
.task-status { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; } .task-status { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-cell { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; } .status-cell { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; }
.status-cell .task-status, .status-cell .error-cat-badge { display: inline-block; margin-bottom: 4px; } .status-cell .task-status, .status-cell .error-cat-badge { display: inline-block; margin-bottom: 4px; }
.status-pending { background: #f0f0f0; color: #666; } .status-pending { background: #f0f0f0; color: #666; }
.status-running { background: #e6f7ff; color: #1890ff; } .status-running { background: #e6f7ff; color: #1890ff; }