summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/pipelines/jobs.vue
blob: a3a99ad457c4a54e226765d6fa07940f3fcb1818 (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
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import Icon from '../../../vue_shared/components/icon.vue';
import CiIcon from '../../../vue_shared/components/ci_icon.vue';
import Tabs from '../../../vue_shared/components/tabs/tabs';
import Tab from '../../../vue_shared/components/tabs/tab.vue';

export default {
  components: {
    Tabs,
    Tab,
    Icon,
    CiIcon,
  },
  computed: {
    ...mapGetters('pipelines', ['jobsCount', 'failedJobsCount']),
    ...mapState('pipelines', ['stages']),
  },
  mounted() {
    this.fetchStages();
  },
  methods: {
    ...mapActions('pipelines', ['fetchStages']),
  },
};
</script>

<template>
  <div>
    <tabs>
      <tab active>
        <template slot="title">
          Jobs <span class="badge">{{ jobsCount }}</span>
        </template>
        <div style="overflow: auto;">
          <div
            v-for="stage in stages"
            :key="stage.id"
            class="panel panel-default"
          >
            <div
              class="panel-heading"
              @click="() => stage.isCollapsed = !stage.isCollapsed"
            >
              <ci-icon :status="stage.status" />
              {{ stage.title }}
              <span class="badge">
                {{ stage.jobs.length }}
              </span>
              <icon
                :name="stage.isCollapsed ? 'angle-left' : 'angle-down'"
                css-classes="pull-right"
              />
            </div>
            <div
              class="panel-body"
              v-show="!stage.isCollapsed"
            >
              <div
                v-for="job in stage.jobs"
                :key="job.id"
              >
                <ci-icon :status="job.status" />
                {{ job.name }} #{{ job.id }}
              </div>
            </div>
          </div>
        </div>
      </tab>
      <tab>
        <template slot="title">
          Failed Jobs <span class="badge">{{ failedJobsCount }}</span>
        </template>
        List all failed jobs here
      </tab>
    </tabs>
  </div>
</template>