1<template>
2  <overview-card
3    :title="$t('pageOverview.firmwareInformation')"
4    :to="`/operations/firmware`"
5  >
6    <b-row class="mt-3">
7      <b-col sm="6">
8        <dl>
9          <dt>{{ $t('pageOverview.runningVersion') }}</dt>
10          <dd>{{ dataFormatter(runningVersion) }}</dd>
11          <dt>{{ $t('pageOverview.backupVersion') }}</dt>
12          <dd>{{ dataFormatter(backupVersion) }}</dd>
13        </dl>
14      </b-col>
15      <b-col sm="6">
16        <dl>
17          <dt>{{ $t('pageOverview.firmwareVersion') }}</dt>
18          <dd>{{ dataFormatter(firmwareVersion) }}</dd>
19        </dl>
20      </b-col>
21    </b-row>
22  </overview-card>
23</template>
24
25<script>
26import OverviewCard from './OverviewCard';
27import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
28import { mapState } from 'vuex';
29import { useI18n } from 'vue-i18n';
30
31export default {
32  name: 'Firmware',
33  components: {
34    OverviewCard,
35  },
36  mixins: [DataFormatterMixin],
37  data() {
38    return {
39      $t: useI18n().t,
40    };
41  },
42  computed: {
43    ...mapState({
44      server: (state) => state.system.systems[0],
45      backupBmcFirmware() {
46        return this.$store.getters['firmware/backupBmcFirmware'];
47      },
48      backupVersion() {
49        return this.backupBmcFirmware?.version;
50      },
51      activeBmcFirmware() {
52        return this.$store.getters[`firmware/activeBmcFirmware`];
53      },
54      firmwareVersion() {
55        return this.server?.firmwareVersion;
56      },
57      runningVersion() {
58        return this.activeBmcFirmware?.version;
59      },
60    }),
61  },
62  created() {
63    this.$store.dispatch('firmware/getFirmwareInformation').finally(() => {
64      this.$root.$emit('overview-firmware-complete');
65    });
66  },
67};
68</script>
69