debian-mirror-gitlab/app/assets/javascripts/jobs/components/table/jobs_table.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.3 KiB
Vue
Raw Normal View History

2021-04-29 21:17:54 +05:30
<script>
import { GlTable } from '@gitlab/ui';
2022-01-26 12:08:38 +05:30
import { s__ } from '~/locale';
2023-03-17 16:20:25 +05:30
import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue';
2021-06-08 01:23:25 +05:30
import ActionsCell from './cells/actions_cell.vue';
import DurationCell from './cells/duration_cell.vue';
import JobCell from './cells/job_cell.vue';
import PipelineCell from './cells/pipeline_cell.vue';
2022-01-26 12:08:38 +05:30
import { DEFAULT_FIELDS } from './constants';
2021-04-29 21:17:54 +05:30
export default {
2021-06-08 01:23:25 +05:30
i18n: {
emptyText: s__('Jobs|No jobs to show'),
},
2021-04-29 21:17:54 +05:30
components: {
2021-06-08 01:23:25 +05:30
ActionsCell,
2023-03-17 16:20:25 +05:30
CiBadgeLink,
2021-06-08 01:23:25 +05:30
DurationCell,
2021-04-29 21:17:54 +05:30
GlTable,
2021-06-08 01:23:25 +05:30
JobCell,
PipelineCell,
2021-04-29 21:17:54 +05:30
},
props: {
jobs: {
type: Array,
required: true,
},
2022-01-26 12:08:38 +05:30
tableFields: {
type: Array,
required: false,
default: () => DEFAULT_FIELDS,
},
2021-04-29 21:17:54 +05:30
},
2021-06-08 01:23:25 +05:30
methods: {
formatCoverage(coverage) {
return coverage ? `${coverage}%` : '';
},
},
2021-04-29 21:17:54 +05:30
};
</script>
<template>
2021-06-08 01:23:25 +05:30
<gl-table
:items="jobs"
2022-01-26 12:08:38 +05:30
:fields="tableFields"
2021-06-08 01:23:25 +05:30
:tbody-tr-attr="{ 'data-testid': 'jobs-table-row' }"
:empty-text="$options.i18n.emptyText"
2022-08-13 15:12:31 +05:30
data-testid="jobs-table"
2021-06-08 01:23:25 +05:30
show-empty
stacked="lg"
fixed
>
<template #table-colgroup="{ fields }">
<col v-for="field in fields" :key="field.key" :class="field.columnClass" />
</template>
<template #cell(status)="{ item }">
2023-03-17 16:20:25 +05:30
<ci-badge-link :status="item.detailedStatus" />
2021-06-08 01:23:25 +05:30
</template>
<template #cell(job)="{ item }">
<job-cell :job="item" />
</template>
<template #cell(pipeline)="{ item }">
<pipeline-cell :job="item" />
</template>
<template #cell(stage)="{ item }">
<div class="gl-text-truncate">
<span data-testid="job-stage-name">{{ item.stage.name }}</span>
</div>
</template>
<template #cell(name)="{ item }">
<div class="gl-text-truncate">
<span data-testid="job-name">{{ item.name }}</span>
</div>
</template>
<template #cell(duration)="{ item }">
<duration-cell :job="item" />
</template>
<template #cell(coverage)="{ item }">
<span v-if="item.coverage" data-testid="job-coverage">{{
formatCoverage(item.coverage)
}}</span>
</template>
<template #cell(actions)="{ item }">
2021-11-11 11:23:49 +05:30
<actions-cell class="gl-float-right" :job="item" />
2021-06-08 01:23:25 +05:30
</template>
</gl-table>
2021-04-29 21:17:54 +05:30
</template>