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.

90 lines
2.1 KiB
Vue
Raw Normal View History

2022-03-02 08:16:31 +05:30
<script>
2022-08-27 11:52:29 +05:30
import RunnerSingleStat from '~/runner/components/stat/runner_single_stat.vue';
2022-10-11 01:57:18 +05:30
import {
I18N_STATUS_ONLINE,
I18N_STATUS_OFFLINE,
I18N_STATUS_STALE,
STATUS_ONLINE,
STATUS_OFFLINE,
STATUS_STALE,
} from '../../constants';
2022-03-02 08:16:31 +05:30
export default {
components: {
2022-08-27 11:52:29 +05:30
RunnerSingleStat,
RunnerUpgradeStatusStats: () =>
import('ee_component/runner/components/stat/runner_upgrade_status_stats.vue'),
2022-03-02 08:16:31 +05:30
},
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-27 11:52:29 +05:30
default: () => ({}),
2022-03-02 08:16:31 +05:30
},
2022-08-13 15:12:31 +05:30
},
2022-08-27 11:52:29 +05:30
computed: {
stats() {
return [
{
key: STATUS_ONLINE,
props: {
skip: this.statusCountSkip(STATUS_ONLINE),
variables: { ...this.variables, status: STATUS_ONLINE },
variant: 'success',
2022-10-11 01:57:18 +05:30
title: I18N_STATUS_ONLINE,
metaIcon: 'status-active',
2022-08-27 11:52:29 +05:30
},
},
{
key: STATUS_OFFLINE,
props: {
skip: this.statusCountSkip(STATUS_OFFLINE),
variables: { ...this.variables, status: STATUS_OFFLINE },
variant: 'muted',
2022-10-11 01:57:18 +05:30
title: I18N_STATUS_OFFLINE,
metaIcon: 'status-waiting',
2022-08-27 11:52:29 +05:30
},
},
{
key: STATUS_STALE,
props: {
skip: this.statusCountSkip(STATUS_STALE),
variables: { ...this.variables, status: STATUS_STALE },
variant: 'warning',
2022-10-11 01:57:18 +05:30
title: I18N_STATUS_STALE,
metaIcon: 'time-out',
2022-08-27 11:52:29 +05:30
},
},
];
2022-08-13 15:12:31 +05:30
},
2022-08-27 11:52:29 +05:30
},
methods: {
2022-08-13 15:12:31 +05:30
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
},
},
};
</script>
<template>
2022-08-27 11:52:29 +05:30
<div class="gl-display-flex gl-flex-wrap gl-py-6">
<runner-single-stat
v-for="stat in stats"
:key="stat.key"
:scope="scope"
v-bind="stat.props"
class="gl-px-5"
/>
<runner-upgrade-status-stats
class="gl-display-contents"
2022-08-13 15:12:31 +05:30
:scope="scope"
2022-08-27 11:52:29 +05:30
:variables="variables"
/>
2022-03-02 08:16:31 +05:30
</div>
</template>