list.vue 2.2 KB
Newer Older
P
Phil Hughes 已提交
1
<script>
P
Phil Hughes 已提交
2
import { mapActions, mapGetters, mapState } from 'vuex';
P
Phil Hughes 已提交
3 4
import LoadingIcon from '../../../vue_shared/components/loading_icon.vue';
import CiIcon from '../../../vue_shared/components/ci_icon.vue';
P
Phil Hughes 已提交
5 6 7
import Tabs from '../../../vue_shared/components/tabs/tabs';
import Tab from '../../../vue_shared/components/tabs/tab.vue';
import JobsList from '../jobs/list.vue';
P
Phil Hughes 已提交
8 9 10 11 12

export default {
  components: {
    LoadingIcon,
    CiIcon,
P
Phil Hughes 已提交
13 14
    Tabs,
    Tab,
P
Phil Hughes 已提交
15
    JobsList,
P
Phil Hughes 已提交
16 17
  },
  computed: {
P
Phil Hughes 已提交
18 19
    ...mapGetters('pipelines', ['jobsCount', 'failedJobsCount', 'failedStages']),
    ...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']),
P
Phil Hughes 已提交
20
  },
P
Phil Hughes 已提交
21
  created() {
22
    this.fetchLatestPipeline();
P
Phil Hughes 已提交
23 24
  },
  methods: {
25
    ...mapActions('pipelines', ['fetchLatestPipeline']),
P
Phil Hughes 已提交
26 27 28 29 30 31 32
  },
};
</script>

<template>
  <div>
    <loading-icon
P
Phil Hughes 已提交
33
      v-if="isLoadingPipeline && !latestPipeline"
P
Phil Hughes 已提交
34 35 36 37
      class="prepend-top-default"
      size="2"
    />
    <template v-else-if="latestPipeline">
P
Phil Hughes 已提交
38 39 40 41
      <header
        class="ide-tree-header ide-pipeline-header"
      >
        <ci-icon
42
          :status="latestPipeline.details.status"
P
Phil Hughes 已提交
43
          :size="24"
P
Phil Hughes 已提交
44 45 46 47 48 49
        />
        <span class="prepend-left-8">
          <strong>
            Pipeline
          </strong>
          <a
P
Phil Hughes 已提交
50
            :href="latestPipeline.path"
P
Phil Hughes 已提交
51 52 53 54 55 56
            target="_blank"
          >
            #{{ latestPipeline.id }}
          </a>
        </span>
      </header>
P
Phil Hughes 已提交
57 58 59 60 61
      <tabs>
        <tab active>
          <template slot="title">
            Jobs
            <span
62
              v-if="jobsCount"
P
Phil Hughes 已提交
63 64 65 66 67 68 69 70 71 72 73 74 75 76
              class="badge"
            >
              {{ jobsCount }}
            </span>
          </template>
          <jobs-list
            :loading="isLoadingJobs"
            :stages="stages"
          />
        </tab>
        <tab>
          <template slot="title">
            Failed Jobs
            <span
77
              v-if="failedJobsCount"
P
Phil Hughes 已提交
78 79 80 81 82 83 84 85 86 87 88
              class="badge"
            >
              {{ failedJobsCount }}
            </span>
          </template>
          <jobs-list
            :loading="isLoadingJobs"
            :stages="failedStages"
          />
        </tab>
      </tabs>
P
Phil Hughes 已提交
89 90 91 92 93
    </template>
  </div>
</template>

<style>
P
Phil Hughes 已提交
94 95 96
.ide-pipeline-header .ci-status-icon {
  display: flex;
}
P
Phil Hughes 已提交
97
</style>