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

runner_stats.vue « stat « components « runner « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9e1ca9ba4ee3c1266cdfa11536d3eb95ed4b34e2 (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
<script>
import { STATUS_ONLINE, STATUS_OFFLINE, STATUS_STALE } from '../../constants';
import RunnerCount from './runner_count.vue';
import RunnerStatusStat from './runner_status_stat.vue';

export default {
  components: {
    RunnerCount,
    RunnerStatusStat,
  },
  props: {
    scope: {
      type: String,
      required: true,
    },
    variables: {
      type: Object,
      required: false,
      default: () => {},
    },
  },
  methods: {
    countVariables(vars) {
      return { ...this.variables, ...vars };
    },
    statusCountSkip(status) {
      // Show an empty result when we already filter by another status
      return this.variables.status && this.variables.status !== status;
    },
  },
  STATUS_LIST: [STATUS_ONLINE, STATUS_OFFLINE, STATUS_STALE],
};
</script>
<template>
  <div class="gl-display-flex gl-py-6">
    <runner-count
      v-for="status in $options.STATUS_LIST"
      #default="{ count }"
      :key="status"
      :scope="scope"
      :variables="countVariables({ status })"
      :skip="statusCountSkip(status)"
    >
      <runner-status-stat class="gl-px-5" :status="status" :value="count" />
    </runner-count>
  </div>
</template>