diff --git a/frontend/src/__tests__/HistoryView.test.js b/frontend/src/__tests__/HistoryView.test.js index 3e9b509..96c2da9 100644 --- a/frontend/src/__tests__/HistoryView.test.js +++ b/frontend/src/__tests__/HistoryView.test.js @@ -7,7 +7,7 @@ global.fetch = vi.fn() window.open = vi.fn() 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: '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('失败') }) + 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 () => { const router = createMockRouter() router.push = vi.fn() diff --git a/frontend/src/views/HistoryView.vue b/frontend/src/views/HistoryView.vue index 1b7d2bc..0243059 100644 --- a/frontend/src/views/HistoryView.vue +++ b/frontend/src/views/HistoryView.vue @@ -45,7 +45,7 @@ {{ task.build_type }} - {{ task.scheme_name }} + {{ task.scheme_name }} {{ statusText(task.status) }} @@ -308,7 +308,7 @@ const deleteTask = async (taskId) => { const formatTime = (t) => { if (!t) return '-' 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) => { @@ -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 { background: #fafafa; font-weight: 500; color: #666; font-size: 13px; } .config-table td { font-size: 14px; } -.config-table th:nth-child(1) { width: 14%; } -.config-table th:nth-child(2) { width: 14%; } -.config-table th:nth-child(3) { width: 8%; } -.config-table th:nth-child(4) { width: 10%; } -.config-table th:nth-child(5) { width: 12%; } -.config-table th:nth-child(6) { width: 16%; } -.config-table th:nth-child(7) { width: 26%; } +.config-table th:nth-child(1) { width: 10%; } +.config-table th:nth-child(2) { width: 12%; } +.config-table th:nth-child(3) { width: 9%; } +.config-table th:nth-child(4) { width: 18%; } +.config-table th:nth-child(5) { width: 17%; } +.config-table th:nth-child(6) { width: 12%; } +.config-table th:nth-child(7) { width: 22%; } .config-table tr:hover { background: #fafafa; } .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 .action-btn { margin-right: 6px; margin-bottom: 4px; display: inline-block; vertical-align: middle; } .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:hover { border-color: #1890ff; color: #1890ff; } .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-pending { background: #f0f0f0; color: #666; } .status-running { background: #e6f7ff; color: #1890ff; }