Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 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> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 14 | <dd class="h3">{{ dataFormatter(dumps.length) }}</dd> |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 15 | </dl> |
| 16 | </b-col> |
| 17 | </b-row> |
| 18 | </overview-card> |
| 19 | </template> |
| 20 | |
| 21 | <script> |
| 22 | import OverviewCard from './OverviewCard'; |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 23 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 24 | |
| 25 | export default { |
| 26 | name: 'Dumps', |
| 27 | components: { |
| 28 | OverviewCard, |
| 29 | }, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 30 | mixins: [DataFormatterMixin], |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 31 | computed: { |
| 32 | dumps() { |
Kenneth | c2c53aa | 2021-11-30 17:04:58 -0600 | [diff] [blame] | 33 | return this.$store.getters['dumps/allDumps']; |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 34 | }, |
| 35 | }, |
| 36 | created() { |
Kenneth | c2c53aa | 2021-11-30 17:04:58 -0600 | [diff] [blame] | 37 | this.$store.dispatch('dumps/getBmcDumpEntries').finally(() => { |
Dixsie Wolmers | 6a192d5 | 2021-09-02 15:26:58 -0500 | [diff] [blame] | 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> |