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

app.vue « components « statistics_panel « admin « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e7b7e959e00407922a8a371c5772211522c7e3c (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 { GlCard, GlLoadingIcon } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapState, mapGetters, mapActions } from 'vuex';
import statisticsLabels from '../constants';

export default {
  components: {
    GlCard,
    GlLoadingIcon,
  },
  data() {
    return {
      statisticsLabels,
    };
  },
  computed: {
    ...mapState(['isLoading', 'statistics']),
    ...mapGetters(['getStatistics']),
  },
  mounted() {
    this.fetchStatistics();
  },
  methods: {
    ...mapActions(['fetchStatistics']),
  },
};
</script>

<template>
  <gl-card>
    <h4 class="gl-heading-4">{{ __('Statistics') }}</h4>
    <slot name="footer">
      <gl-loading-icon v-if="isLoading" size="lg" class="my-3" />
      <template v-else>
        <p
          v-for="statistic in getStatistics(statisticsLabels)"
          :key="statistic.key"
          class="js-stats"
        >
          {{ statistic.label }}
          <span class="light float-right">{{ statistic.value }}</span>
        </p>
      </template>
    </slot>
  </gl-card>
</template>