xref: /openbmc/webui-vue/src/views/Overview/OverviewPower.vue (revision 883a0d597962dfd30d6c48319b8b33e2d0f98606)
16a192d52SDixsie Wolmers<template>
26a192d52SDixsie Wolmers  <overview-card
36a192d52SDixsie Wolmers    :title="$t('pageOverview.powerInformation')"
46a192d52SDixsie Wolmers    :to="`/resource-management/power`"
56a192d52SDixsie Wolmers  >
66a192d52SDixsie Wolmers    <b-row class="mt-3">
76a192d52SDixsie Wolmers      <b-col sm="6">
86a192d52SDixsie Wolmers        <dl>
96a192d52SDixsie Wolmers          <dt>{{ $t('pageOverview.powerConsumption') }}</dt>
106a192d52SDixsie Wolmers          <dd v-if="powerConsumptionValue == null">
116a192d52SDixsie Wolmers            {{ $t('global.status.notAvailable') }}
126a192d52SDixsie Wolmers          </dd>
136a192d52SDixsie Wolmers          <dd v-else>{{ powerConsumptionValue }} W</dd>
146a192d52SDixsie Wolmers          <dt>{{ $t('pageOverview.powerCap') }}</dt>
156a192d52SDixsie Wolmers          <dd v-if="powerCapValue == null">
166a192d52SDixsie Wolmers            {{ $t('global.status.disabled') }}
176a192d52SDixsie Wolmers          </dd>
186a192d52SDixsie Wolmers          <dd v-else>{{ powerCapValue }} W</dd>
196a192d52SDixsie Wolmers        </dl>
206a192d52SDixsie Wolmers      </b-col>
216a192d52SDixsie Wolmers    </b-row>
226a192d52SDixsie Wolmers  </overview-card>
236a192d52SDixsie Wolmers</template>
246a192d52SDixsie Wolmers
256a192d52SDixsie Wolmers<script>
266a192d52SDixsie Wolmersimport OverviewCard from './OverviewCard';
279726f9a7SDixsie Wolmersimport DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
286a192d52SDixsie Wolmersimport { mapGetters } from 'vuex';
29*883a0d59SEd Tanousimport { useI18n } from 'vue-i18n';
306a192d52SDixsie Wolmers
316a192d52SDixsie Wolmersexport default {
326a192d52SDixsie Wolmers  name: 'Power',
336a192d52SDixsie Wolmers  components: {
346a192d52SDixsie Wolmers    OverviewCard,
356a192d52SDixsie Wolmers  },
369726f9a7SDixsie Wolmers  mixins: [DataFormatterMixin],
37*883a0d59SEd Tanous  data() {
38*883a0d59SEd Tanous    return {
39*883a0d59SEd Tanous      $t: useI18n().t,
40*883a0d59SEd Tanous    };
41*883a0d59SEd Tanous  },
426a192d52SDixsie Wolmers  computed: {
436a192d52SDixsie Wolmers    ...mapGetters({
446a192d52SDixsie Wolmers      powerCapValue: 'powerControl/powerCapValue',
456a192d52SDixsie Wolmers      powerConsumptionValue: 'powerControl/powerConsumptionValue',
466a192d52SDixsie Wolmers    }),
476a192d52SDixsie Wolmers  },
486a192d52SDixsie Wolmers  created() {
496a192d52SDixsie Wolmers    this.$store.dispatch('powerControl/getPowerControl').finally(() => {
506a192d52SDixsie Wolmers      this.$root.$emit('overview-power-complete');
516a192d52SDixsie Wolmers    });
526a192d52SDixsie Wolmers  },
536a192d52SDixsie Wolmers};
546a192d52SDixsie Wolmers</script>
55