debian-mirror-gitlab/app/assets/javascripts/runner/components/stat/runner_stats.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.2 KiB
Vue
Raw Normal View History

2022-03-02 08:16:31 +05:30
<script>
import { STATUS_ONLINE, STATUS_OFFLINE, STATUS_STALE } from '../../constants';
2022-08-13 15:12:31 +05:30
import RunnerCount from './runner_count.vue';
2022-03-02 08:16:31 +05:30
import RunnerStatusStat from './runner_status_stat.vue';
export default {
components: {
2022-08-13 15:12:31 +05:30
RunnerCount,
2022-03-02 08:16:31 +05:30
RunnerStatusStat,
},
props: {
2022-08-13 15:12:31 +05:30
scope: {
type: String,
required: true,
2022-03-02 08:16:31 +05:30
},
2022-08-13 15:12:31 +05:30
variables: {
type: Object,
2022-03-02 08:16:31 +05:30
required: false,
2022-08-13 15:12:31 +05:30
default: () => {},
2022-03-02 08:16:31 +05:30
},
2022-08-13 15:12:31 +05:30
},
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;
2022-03-02 08:16:31 +05:30
},
},
2022-08-13 15:12:31 +05:30
STATUS_LIST: [STATUS_ONLINE, STATUS_OFFLINE, STATUS_STALE],
2022-03-02 08:16:31 +05:30
};
</script>
<template>
<div class="gl-display-flex gl-py-6">
2022-08-13 15:12:31 +05:30
<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>
2022-03-02 08:16:31 +05:30
</div>
</template>