1<template>
2  <overview-card
3    :data="dumps"
4    :disabled="dumps.length === 0"
5    :download-button="true"
6    :file-name="exportFileNameByDate()"
7    :title="$t('pageOverview.dumps')"
8    :to="`/logs/dumps`"
9  >
10    <b-row class="mt-3">
11      <b-col sm="6">
12        <dl>
13          <dt>{{ $t('pageOverview.total') }}</dt>
14          <dd class="h3">{{ dataFormatter(dumps.length) }}</dd>
15        </dl>
16      </b-col>
17    </b-row>
18  </overview-card>
19</template>
20
21<script>
22import OverviewCard from './OverviewCard';
23import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
24
25export default {
26  name: 'Dumps',
27  components: {
28    OverviewCard,
29  },
30  mixins: [DataFormatterMixin],
31  computed: {
32    dumps() {
33      return this.$store.getters['dumps/bmcDumps'];
34    },
35  },
36  created() {
37    this.$store.dispatch('dumps/getBmcDumps').finally(() => {
38      this.$root.$emit('overview-dumps-complete');
39    });
40  },
41  methods: {
42    exportFileNameByDate() {
43      // Create export file name based on date
44      let date = new Date();
45      date =
46        date.toISOString().slice(0, 10) +
47        '_' +
48        date.toString().split(':').join('-').split(' ')[4];
49      let fileName = 'all_dumps_';
50      return fileName + date;
51    },
52  },
53};
54</script>
55