Welcome to mirror list, hosted at ThFree Co, Russian Federation.

jobs_table.vue « components « jobs_page « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d81d19cfd52e027f414930e4fb77c77348d63e63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<script>
import { GlTable } from '@gitlab/ui';
import { s__ } from '~/locale';
import ProjectCell from '~/ci/admin/jobs_table/components/cells/project_cell.vue';
import RunnerCell from '~/ci/admin/jobs_table/components/cells/runner_cell.vue';
import { JOBS_DEFAULT_FIELDS } from '../constants';
import ActionsCell from './job_cells/actions_cell.vue';
import StatusCell from './job_cells/status_cell.vue';
import JobCell from './job_cells/job_cell.vue';
import PipelineCell from './job_cells/pipeline_cell.vue';

export default {
  i18n: {
    emptyText: s__('Jobs|No jobs to show'),
  },
  components: {
    ActionsCell,
    StatusCell,
    JobCell,
    PipelineCell,
    ProjectCell,
    RunnerCell,
    GlTable,
  },
  props: {
    jobs: {
      type: Array,
      required: true,
    },
    tableFields: {
      type: Array,
      required: false,
      default: () => JOBS_DEFAULT_FIELDS,
    },
    admin: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  methods: {
    formatCoverage(coverage) {
      return coverage ? `${coverage}%` : '';
    },
  },
};
</script>

<template>
  <gl-table
    :items="jobs"
    :fields="tableFields"
    :tbody-tr-attr="{ 'data-testid': 'jobs-table-row' }"
    :empty-text="$options.i18n.emptyText"
    data-testid="jobs-table"
    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 }">
      <status-cell :job="item" />
    </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 v-if="item.stage" data-testid="job-stage-name" class="gl-text-secondary">{{
          item.stage.name
        }}</span>
      </div>
    </template>

    <template v-if="admin" #cell(project)="{ item }">
      <project-cell :job="item" />
    </template>

    <template v-if="admin" #cell(runner)="{ item }">
      <runner-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 }">
      <actions-cell class="gl-float-right" :job="item" />
    </template>
  </gl-table>
</template>