Loading src/assets/images/erased-log_empty.svg 0 → 100644 +55 −0 Original line number Diff line number Diff line <svg width="430" height="172" viewBox="0 0 430 172" xmlns="http://www.w3.org/2000/svg"> <title> erased-log_empty </title> <g fill="none" fill-rule="evenodd"> <g transform="translate(155 16)"> <path d="M116 81.2328125C132.892681 83.2125242 146 97.5755729 146 115c0 18.777681-15.222319 34-34 34-9.409998 0-17.9271447-3.82275-24.0831896-10H10c-5.5228475 0-10-4.477153-10-10V15C0 9.4771525 4.4771525 5 10 5h96c5.522847 0 10 4.4771525 10 10v66.2328125z" fill="#FAFAFA"/> <rect fill="#FFF" x="5" width="116" height="134" rx="10"/> <path d="M15 2c-4.418278 0-8 3.581722-8 8v114c0 4.418278 3.581722 8 8 8h96c4.418278 0 8-3.581722 8-8V10c0-4.418278-3.581722-8-8-8H15zm0-4h96c6.627417 0 12 5.372583 12 12v114c0 6.627417-5.372583 12-12 12H15c-6.627417 0-12-5.372583-12-12V10C3 3.372583 8.372583-2 15-2z" fill="#EEE" fill-rule="nonzero"/> <g transform="translate(23 23)"> <rect fill="#E1DBF1" width="16" height="4" rx="2"/> <rect fill="#E1DBF1" x="32" y="12" width="16" height="4" rx="2"/> <rect fill="#EEE" x="44" width="16" height="4" rx="2"/> <rect fill="#E1DBF1" x="12" y="24" width="16" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" y="36" width="16" height="4" rx="2"/> <rect fill="#FEE1D3" x="20" width="8" height="4" rx="2"/> <rect fill="#FC6D26" x="32" y="36" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="52" y="12" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" width="8" height="4" rx="2"/> <rect fill="#E1DBF1" x="16" y="48" width="12" height="4" rx="2"/> <rect fill="#FC6D26" x="44" y="36" width="8" height="4" rx="2"/> <rect fill="#E1DBF1" x="56" y="36" width="4" height="4" rx="2"/> <rect fill="#FC6D26" x="72" y="60" width="4" height="4" rx="2"/> <rect fill="#FC6D26" x="32" width="8" height="4" rx="2"/> <rect fill="#EEE" y="36" width="28" height="4" rx="2"/> <rect fill="#EEE" x="44" y="48" width="28" height="4" rx="2"/> <rect fill="#EFEDF8" x="32" y="60" width="28" height="4" rx="2"/> <rect fill="#6B4FBB" y="12" width="28" height="4" rx="2"/> <rect fill="#C3B8E3" x="32" y="24" width="28" height="4" rx="2"/> <rect fill="#FEF0E8" y="24" width="8" height="4" rx="2"/> <rect fill="#6B4FBB" x="32" y="48" width="8" height="4" rx="2"/> <rect fill="#FC6D26" y="48" width="12" height="4" rx="2"/> <rect fill="#FEF0E8" y="60" width="12" height="4" rx="2"/> <rect fill="#FEF0E8" x="16" y="60" width="12" height="4" rx="2"/> </g> <g transform="translate(23 95)"> <rect fill="#EFEDF8" width="16" height="4" rx="2"/> <rect fill="#FC6D26" x="18" y="12" width="16" height="4" rx="2"/> <rect fill="#FEE1D3" x="20" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="38" y="12" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" width="8" height="4" rx="2"/> <rect fill="#FC6D26" x="32" width="8" height="4" rx="2"/> <rect fill="#EEE" y="12" width="14" height="4" rx="2"/> </g> </g> <g transform="translate(235 92)"> <circle fill="#FFF" cx="34" cy="34" r="34"/> <path d="M34 70C14.117749 70-2 53.882251-2 34S14.117749-2 34-2s36 16.117749 36 36-16.117749 36-36 36zm0-4c17.673112 0 32-14.326888 32-32S51.673112 2 34 2 2 16.326888 2 34s14.326888 32 32 32z" fill="#EEE" fill-rule="nonzero"/> <path d="M47 22v22c0 4.418278-3.581722 8-8 8H29c-4.418278 0-8-3.581722-8-8V22h26zm-22 4v18c0 2.209139 1.790861 4 4 4h10c2.209139 0 4-1.790861 4-4V26H25z" fill="#E1DBF1" fill-rule="nonzero"/> <rect fill="#C3B8E3" x="28" y="31" width="4" height="12" rx="2"/> <rect fill="#C3B8E3" x="36" y="31" width="4" height="12" rx="2"/> <path d="M29.0354444 22c.2426149-1.6961471 1.7013196-3 3.4645556-3h3c1.763236 0 3.2219407 1.3038529 3.4645556 3H49c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2H19c-1.1045695 0-2-.8954305-2-2s.8954305-2 2-2h10.0354444z" fill="#6B4FBB"/> </g> </g> </svg> src/ci/pending_job_webview_controller.ts +3 −2 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import { JobItemModel } from '../tree_view/items/job_item_model'; import { cancelJob, executeJob, retryJob } from '../commands/job_actions'; import { toJobLogUri } from './job_log_uri'; import { log } from '../log'; import { hasTraceAvailable } from '../utils/has_trace_available'; const buttonTexts = { executable: 'Trigger this manual action', Loading Loading @@ -72,7 +73,7 @@ export class PendingJobWebviewController { const updatedPanelJob = state.jobs.find(j => j.id === panel.jobItemModel.job.id); if (updatedPanelJob && panel.jobItemModel.job.status !== updatedPanelJob.status) { const jobItemModel = new JobItemModel(state.projectInRepository, updatedPanelJob); if (updatedPanelJob.started_at) { if (hasTraceAvailable(updatedPanelJob)) { await replaceWebviewWithTraceview(jobItemModel, panel); } else { await this.createOrUpdateWebview(jobItemModel, panel); Loading Loading @@ -132,7 +133,7 @@ export class PendingJobWebviewController { if (!panel.visible) return; const { job: newJob } = panel.jobItemModel; if (newJob.started_at) { if (hasTraceAvailable(newJob)) { await replaceWebviewWithTraceview(panel.jobItemModel, panel); } }); Loading src/gitlab/ci_status_metadata.test.ts +7 −0 Original line number Diff line number Diff line import dayjs from 'dayjs'; import { job, pipeline } from '../test_utils/entities'; import { getJobMetadata, getPipelineMetadata } from './ci_status_metadata'; Loading Loading @@ -44,6 +45,12 @@ describe('CI Status Metadata', () => { expect(result.icon.id).toBe('gear'); expect(result.name).toBe('Manual'); }); it('returns erased job metadata', () => { const result = getJobMetadata({ ...job, erased_at: dayjs().toString() }); expect(result.name).toBe('Passed'); expect(result.illustration?.title).toContain('erased'); }); }); describe('getPipelineMetadata', () => { Loading src/gitlab/ci_status_metadata.ts +19 −2 Original line number Diff line number Diff line Loading @@ -145,9 +145,26 @@ const FAILED_ALLOWED: CiStatusMetadata = { contextAction: 'retryable', }; const ERASED: Partial<CiStatusMetadata> = { illustration: { image: 'src/assets/images/erased-log_empty.svg', title: 'Job has been erased', description: '', }, }; export const getJobMetadata = (job: RestJob): CiStatusMetadata => { if (job.status === 'failed' && job.allow_failure) return FAILED_ALLOWED; return STATUS_METADATA[job.status] || UNKNOWN_STATUS; let data: CiStatusMetadata; if (job.status === 'failed' && job.allow_failure) { data = FAILED_ALLOWED; } else { data = STATUS_METADATA[job.status] || UNKNOWN_STATUS; } if (job.erased_at) { data = { ...data, ...ERASED }; } return data; }; export const getPipelineMetadata = (pipeline: RestPipeline): CiStatusMetadata => Loading src/tree_view/items/job_item_model.test.ts +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ describe('item created by JobItemModel', () => { expect(itemWithArtifacts.contextValue).toBe('retryable-job,with-artifacts,with-trace,with-url'); }); it('has contextValue if log is erased', () => { const itemWithArtifacts = new JobItemModel(projectInRepository, { ...job, erased_at: dayjs().toString(), }).getTreeItem(); expect(itemWithArtifacts.contextValue).toBe('retryable-job,pending-job,with-url'); }); describe('showing relative time', () => { const threeYearsAgo = dayjs().subtract(3, 'year').toString(); const twoYearsAgo = dayjs().subtract(2, 'year').toString(); Loading Loading
src/assets/images/erased-log_empty.svg 0 → 100644 +55 −0 Original line number Diff line number Diff line <svg width="430" height="172" viewBox="0 0 430 172" xmlns="http://www.w3.org/2000/svg"> <title> erased-log_empty </title> <g fill="none" fill-rule="evenodd"> <g transform="translate(155 16)"> <path d="M116 81.2328125C132.892681 83.2125242 146 97.5755729 146 115c0 18.777681-15.222319 34-34 34-9.409998 0-17.9271447-3.82275-24.0831896-10H10c-5.5228475 0-10-4.477153-10-10V15C0 9.4771525 4.4771525 5 10 5h96c5.522847 0 10 4.4771525 10 10v66.2328125z" fill="#FAFAFA"/> <rect fill="#FFF" x="5" width="116" height="134" rx="10"/> <path d="M15 2c-4.418278 0-8 3.581722-8 8v114c0 4.418278 3.581722 8 8 8h96c4.418278 0 8-3.581722 8-8V10c0-4.418278-3.581722-8-8-8H15zm0-4h96c6.627417 0 12 5.372583 12 12v114c0 6.627417-5.372583 12-12 12H15c-6.627417 0-12-5.372583-12-12V10C3 3.372583 8.372583-2 15-2z" fill="#EEE" fill-rule="nonzero"/> <g transform="translate(23 23)"> <rect fill="#E1DBF1" width="16" height="4" rx="2"/> <rect fill="#E1DBF1" x="32" y="12" width="16" height="4" rx="2"/> <rect fill="#EEE" x="44" width="16" height="4" rx="2"/> <rect fill="#E1DBF1" x="12" y="24" width="16" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" y="36" width="16" height="4" rx="2"/> <rect fill="#FEE1D3" x="20" width="8" height="4" rx="2"/> <rect fill="#FC6D26" x="32" y="36" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="52" y="12" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" width="8" height="4" rx="2"/> <rect fill="#E1DBF1" x="16" y="48" width="12" height="4" rx="2"/> <rect fill="#FC6D26" x="44" y="36" width="8" height="4" rx="2"/> <rect fill="#E1DBF1" x="56" y="36" width="4" height="4" rx="2"/> <rect fill="#FC6D26" x="72" y="60" width="4" height="4" rx="2"/> <rect fill="#FC6D26" x="32" width="8" height="4" rx="2"/> <rect fill="#EEE" y="36" width="28" height="4" rx="2"/> <rect fill="#EEE" x="44" y="48" width="28" height="4" rx="2"/> <rect fill="#EFEDF8" x="32" y="60" width="28" height="4" rx="2"/> <rect fill="#6B4FBB" y="12" width="28" height="4" rx="2"/> <rect fill="#C3B8E3" x="32" y="24" width="28" height="4" rx="2"/> <rect fill="#FEF0E8" y="24" width="8" height="4" rx="2"/> <rect fill="#6B4FBB" x="32" y="48" width="8" height="4" rx="2"/> <rect fill="#FC6D26" y="48" width="12" height="4" rx="2"/> <rect fill="#FEF0E8" y="60" width="12" height="4" rx="2"/> <rect fill="#FEF0E8" x="16" y="60" width="12" height="4" rx="2"/> </g> <g transform="translate(23 95)"> <rect fill="#EFEDF8" width="16" height="4" rx="2"/> <rect fill="#FC6D26" x="18" y="12" width="16" height="4" rx="2"/> <rect fill="#FEE1D3" x="20" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="38" y="12" width="8" height="4" rx="2"/> <rect fill="#FEF0E8" x="64" width="8" height="4" rx="2"/> <rect fill="#FC6D26" x="32" width="8" height="4" rx="2"/> <rect fill="#EEE" y="12" width="14" height="4" rx="2"/> </g> </g> <g transform="translate(235 92)"> <circle fill="#FFF" cx="34" cy="34" r="34"/> <path d="M34 70C14.117749 70-2 53.882251-2 34S14.117749-2 34-2s36 16.117749 36 36-16.117749 36-36 36zm0-4c17.673112 0 32-14.326888 32-32S51.673112 2 34 2 2 16.326888 2 34s14.326888 32 32 32z" fill="#EEE" fill-rule="nonzero"/> <path d="M47 22v22c0 4.418278-3.581722 8-8 8H29c-4.418278 0-8-3.581722-8-8V22h26zm-22 4v18c0 2.209139 1.790861 4 4 4h10c2.209139 0 4-1.790861 4-4V26H25z" fill="#E1DBF1" fill-rule="nonzero"/> <rect fill="#C3B8E3" x="28" y="31" width="4" height="12" rx="2"/> <rect fill="#C3B8E3" x="36" y="31" width="4" height="12" rx="2"/> <path d="M29.0354444 22c.2426149-1.6961471 1.7013196-3 3.4645556-3h3c1.763236 0 3.2219407 1.3038529 3.4645556 3H49c1.1045695 0 2 .8954305 2 2s-.8954305 2-2 2H19c-1.1045695 0-2-.8954305-2-2s.8954305-2 2-2h10.0354444z" fill="#6B4FBB"/> </g> </g> </svg>
src/ci/pending_job_webview_controller.ts +3 −2 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import { JobItemModel } from '../tree_view/items/job_item_model'; import { cancelJob, executeJob, retryJob } from '../commands/job_actions'; import { toJobLogUri } from './job_log_uri'; import { log } from '../log'; import { hasTraceAvailable } from '../utils/has_trace_available'; const buttonTexts = { executable: 'Trigger this manual action', Loading Loading @@ -72,7 +73,7 @@ export class PendingJobWebviewController { const updatedPanelJob = state.jobs.find(j => j.id === panel.jobItemModel.job.id); if (updatedPanelJob && panel.jobItemModel.job.status !== updatedPanelJob.status) { const jobItemModel = new JobItemModel(state.projectInRepository, updatedPanelJob); if (updatedPanelJob.started_at) { if (hasTraceAvailable(updatedPanelJob)) { await replaceWebviewWithTraceview(jobItemModel, panel); } else { await this.createOrUpdateWebview(jobItemModel, panel); Loading Loading @@ -132,7 +133,7 @@ export class PendingJobWebviewController { if (!panel.visible) return; const { job: newJob } = panel.jobItemModel; if (newJob.started_at) { if (hasTraceAvailable(newJob)) { await replaceWebviewWithTraceview(panel.jobItemModel, panel); } }); Loading
src/gitlab/ci_status_metadata.test.ts +7 −0 Original line number Diff line number Diff line import dayjs from 'dayjs'; import { job, pipeline } from '../test_utils/entities'; import { getJobMetadata, getPipelineMetadata } from './ci_status_metadata'; Loading Loading @@ -44,6 +45,12 @@ describe('CI Status Metadata', () => { expect(result.icon.id).toBe('gear'); expect(result.name).toBe('Manual'); }); it('returns erased job metadata', () => { const result = getJobMetadata({ ...job, erased_at: dayjs().toString() }); expect(result.name).toBe('Passed'); expect(result.illustration?.title).toContain('erased'); }); }); describe('getPipelineMetadata', () => { Loading
src/gitlab/ci_status_metadata.ts +19 −2 Original line number Diff line number Diff line Loading @@ -145,9 +145,26 @@ const FAILED_ALLOWED: CiStatusMetadata = { contextAction: 'retryable', }; const ERASED: Partial<CiStatusMetadata> = { illustration: { image: 'src/assets/images/erased-log_empty.svg', title: 'Job has been erased', description: '', }, }; export const getJobMetadata = (job: RestJob): CiStatusMetadata => { if (job.status === 'failed' && job.allow_failure) return FAILED_ALLOWED; return STATUS_METADATA[job.status] || UNKNOWN_STATUS; let data: CiStatusMetadata; if (job.status === 'failed' && job.allow_failure) { data = FAILED_ALLOWED; } else { data = STATUS_METADATA[job.status] || UNKNOWN_STATUS; } if (job.erased_at) { data = { ...data, ...ERASED }; } return data; }; export const getPipelineMetadata = (pipeline: RestPipeline): CiStatusMetadata => Loading
src/tree_view/items/job_item_model.test.ts +8 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,14 @@ describe('item created by JobItemModel', () => { expect(itemWithArtifacts.contextValue).toBe('retryable-job,with-artifacts,with-trace,with-url'); }); it('has contextValue if log is erased', () => { const itemWithArtifacts = new JobItemModel(projectInRepository, { ...job, erased_at: dayjs().toString(), }).getTreeItem(); expect(itemWithArtifacts.contextValue).toBe('retryable-job,pending-job,with-url'); }); describe('showing relative time', () => { const threeYearsAgo = dayjs().subtract(3, 'year').toString(); const twoYearsAgo = dayjs().subtract(2, 'year').toString(); Loading