diff --git a/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue b/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue index e08470c62beec96913cb776e98ce05d8c62d1faa..d2f63eef9ced1d774b5f1c0c1a7b36f88eee8b73 100644 --- a/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue +++ b/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue @@ -5,16 +5,15 @@ import { GlLink, GlButtonGroup, GlButton, - GlBadge, GlIcon, GlPagination, GlFormCheckbox, GlTooltipDirective, } from '@gitlab/ui'; +import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue'; import { createAlert } from '~/alert'; import { getIdFromGraphQLId, convertToGraphQLId } from '~/graphql_shared/utils'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; -import CiIcon from '~/vue_shared/components/ci_icon.vue'; import { TYPENAME_PROJECT } from '~/graphql_shared/constants'; import getJobArtifactsQuery from '../graphql/queries/get_job_artifacts.query.graphql'; import { totalArtifactsSizeForJob, mapArchivesToJobNodes, mapBooleansToJobNodes } from '../utils'; @@ -65,12 +64,11 @@ export default { GlLink, GlButtonGroup, GlButton, - GlBadge, GlIcon, GlPagination, GlFormCheckbox, - CiIcon, TimeAgo, + CiBadgeLink, JobCheckbox, ArtifactsBulkDelete, BulkDeleteModal, @@ -328,7 +326,7 @@ export default { { key: 'artifacts', label: I18N_ARTIFACTS, - thClass: 'gl-w-quarter', + thClass: 'gl-w-eighth', }, { key: 'job', @@ -350,7 +348,7 @@ export default { { key: 'actions', label: '', - thClass: 'gl-w-eighth', + thClass: 'gl-w-20p', tdClass: 'gl-text-right', }, ], @@ -441,45 +439,37 @@ export default { - + - - - {{ item.detailedStatus.label }} - + - + {{ item.name }} - - + + - + {{ pipelineId(item) }} - - - {{ item.refName }} - - - - {{ item.shortSha }} - - + + + + {{ item.shortSha }} + + + + + + + + {{ item.refName }} + + + {{ artifactsSize(item) }} diff --git a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue index 1f45b4c5c9dd63afb22dd6a2b4c52975f23bcc23..101ebcd1c48cce4ecb461421d5ccdc04f2a0231a 100644 --- a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue +++ b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue @@ -121,7 +121,7 @@ export default { { const findStatuses = () => wrapper.findAllByTestId('job-artifacts-job-status'); const findSuccessfulJobStatus = () => findStatuses().at(0); - const findFailedJobStatus = () => findStatuses().at(1); + const findCiBadgeLink = () => findSuccessfulJobStatus().findComponent(CiBadgeLink); const findLinks = () => wrapper.findAllComponents(GlLink); const findJobLink = () => findLinks().at(0); const findPipelineLink = () => findLinks().at(1); - const findRefLink = () => findLinks().at(2); - const findCommitLink = () => findLinks().at(3); + const findCommitLink = () => findLinks().at(2); + const findRefLink = () => findLinks().at(3); const findSize = () => wrapper.findByTestId('job-artifacts-size'); const findCreated = () => wrapper.findByTestId('job-artifacts-created'); @@ -209,13 +201,13 @@ describe('JobArtifactsTable component', () => { }); it('shows the job status as an icon for a successful job', () => { - expect(findSuccessfulJobStatus().findComponent(CiIcon).exists()).toBe(true); - expect(findSuccessfulJobStatus().findComponent(GlBadge).exists()).toBe(false); - }); - - it('shows the job status as a badge for other job statuses', () => { - expect(findFailedJobStatus().findComponent(GlBadge).exists()).toBe(true); - expect(findFailedJobStatus().findComponent(CiIcon).exists()).toBe(false); + expect(findCiBadgeLink().props()).toMatchObject({ + status: { + group: 'success', + }, + size: 'sm', + showText: false, + }); }); it('shows links to the job, pipeline, ref, and commit', () => { diff --git a/spec/frontend/vue_shared/components/ci_badge_link_spec.js b/spec/frontend/vue_shared/components/ci_badge_link_spec.js index c74964c13f53487878ef23c1f71067b1fdc80a6c..fa42e87ec7054868d5044b066dbf57ab3554f0d5 100644 --- a/spec/frontend/vue_shared/components/ci_badge_link_spec.js +++ b/spec/frontend/vue_shared/components/ci_badge_link_spec.js @@ -149,4 +149,10 @@ describe('CI Badge Link Component', () => { expect(findBadge().props('size')).toBe('lg'); }); + + it('should have class `gl-p-2!` when `showText` is false', () => { + createComponent({ status: statuses.success, size: 'lg', showText: false }); + + expect(findBadge().classes()).toContain('gl-p-2!'); + }); });