summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ci/pipeline_schedules/components/table/pipeline_schedules_table.vue
blob: e8cfc5b29f39a39012dd5d03ef5ce3d507e16f91 (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
103
<script>
import { GlTableLite } from '@gitlab/ui';
import { s__ } from '~/locale';
import PipelineScheduleActions from './cells/pipeline_schedule_actions.vue';
import PipelineScheduleLastPipeline from './cells/pipeline_schedule_last_pipeline.vue';
import PipelineScheduleNextRun from './cells/pipeline_schedule_next_run.vue';
import PipelineScheduleOwner from './cells/pipeline_schedule_owner.vue';
import PipelineScheduleTarget from './cells/pipeline_schedule_target.vue';

export default {
  fields: [
    {
      key: 'description',
      label: s__('PipelineSchedules|Description'),
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-40p',
    },
    {
      key: 'target',
      label: s__('PipelineSchedules|Target'),
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-10p',
    },
    {
      key: 'pipeline',
      label: s__('PipelineSchedules|Last Pipeline'),
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-10p',
    },
    {
      key: 'next',
      label: s__('PipelineSchedules|Next Run'),
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-15p',
    },
    {
      key: 'owner',
      label: s__('PipelineSchedules|Owner'),
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-10p',
    },
    {
      key: 'actions',
      label: '',
      thClass: 'gl-border-t-none!',
      columnClass: 'gl-w-15p',
    },
  ],
  components: {
    GlTableLite,
    PipelineScheduleActions,
    PipelineScheduleLastPipeline,
    PipelineScheduleNextRun,
    PipelineScheduleOwner,
    PipelineScheduleTarget,
  },
  props: {
    schedules: {
      type: Array,
      required: true,
    },
  },
};
</script>

<template>
  <gl-table-lite :fields="$options.fields" :items="schedules" stacked="md">
    <template #table-colgroup="{ fields }">
      <col v-for="field in fields" :key="field.key" :class="field.columnClass" />
    </template>

    <template #cell(description)="{ item }">
      <span data-testid="pipeline-schedule-description">
        {{ item.description }}
      </span>
    </template>

    <template #cell(target)="{ item }">
      <pipeline-schedule-target :schedule="item" />
    </template>

    <template #cell(pipeline)="{ item }">
      <pipeline-schedule-last-pipeline :schedule="item" />
    </template>

    <template #cell(next)="{ item }">
      <pipeline-schedule-next-run :schedule="item" />
    </template>

    <template #cell(owner)="{ item }">
      <pipeline-schedule-owner :schedule="item" />
    </template>

    <template #cell(actions)="{ item }">
      <pipeline-schedule-actions
        :schedule="item"
        @showTakeOwnershipModal="$emit('showTakeOwnershipModal', $event)"
        @showDeleteModal="$emit('showDeleteModal', $event)"
        @playPipelineSchedule="$emit('playPipelineSchedule', $event)"
      />
    </template>
  </gl-table-lite>
</template>