summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/pipelines/list.vue
blob: e76ea0b50af3adff75e4d1025f3a37e97b3294c6 (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
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import LoadingIcon from '../../../vue_shared/components/loading_icon.vue';
import CiIcon from '../../../vue_shared/components/ci_icon.vue';
import JobsList from './jobs.vue';

export default {
  components: {
    LoadingIcon,
    CiIcon,
    JobsList,
  },
  computed: {
    ...mapGetters(['currentProject']),
    ...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline']),
    statusIcon() {
      return {
        group: this.latestPipeline.status,
        icon: `status_${this.latestPipeline.status}`,
      };
    },
  },
  mounted() {
    this.fetchLatestPipeline();
  },
  methods: {
    ...mapActions('pipelines', ['fetchLatestPipeline']),
  },
};
</script>

<template>
  <div>
    <loading-icon
      v-if="isLoadingPipeline"
      class="prepend-top-default"
      size="2"
    />
    <template v-else-if="latestPipeline">
      <header
        class="ide-tree-header ide-pipeline-header"
      >
        <ci-icon
          :status="statusIcon"
        />
        <span class="prepend-left-8">
          <strong>
            Pipeline
          </strong>
          <a
            :href="currentProject.web_url + '/pipelines/' + latestPipeline.id"
            target="_blank"
          >
            #{{ latestPipeline.id }}
          </a>
        </span>
      </header>
      <jobs-list />
    </template>
  </div>
</template>

<style>
.ide-pipeline-header .ci-status-icon {
  display: flex;
}
</style>