blob: 4d923e1f20d4ce01de43bd9f54a8099f3eca8ea0 [file] [log] [blame]
Dixsie Wolmers6a192d52021-09-02 15:26:58 -05001<template>
2 <overview-card
3 :title="$t('pageOverview.inventory')"
4 :to="`/hardware-status/inventory`"
5 >
6 <b-row class="mt-3">
7 <b-col sm="6">
8 <dl sm="6">
9 <dt>{{ $t('pageOverview.systemIdentifyLed') }}</dt>
10 <dd>
11 <b-form-checkbox
12 id="identifyLedSwitch"
13 v-model="systems.locationIndicatorActive"
14 data-test-id="overviewInventory-checkbox-identifyLed"
15 switch
16 @change="toggleIdentifyLedSwitch"
17 >
18 <span v-if="systems.locationIndicatorActive">
19 {{ $t('global.status.on') }}
20 </span>
21 <span v-else>{{ $t('global.status.off') }}</span>
22 </b-form-checkbox>
23 </dd>
24 </dl>
25 </b-col>
26 </b-row>
27 </overview-card>
28</template>
29
30<script>
31import OverviewCard from './OverviewCard';
Nikhil Ashokaf11a1902024-05-09 15:17:44 +053032import BVToastMixin from '@/components/Mixins/BVToastMixin';
Ed Tanous883a0d52024-03-23 14:56:34 -070033import { useI18n } from 'vue-i18n';
Dixsie Wolmers6a192d52021-09-02 15:26:58 -050034
35export default {
36 name: 'Inventory',
37 components: {
38 OverviewCard,
39 },
Nikhil Ashokaf11a1902024-05-09 15:17:44 +053040 mixins: [BVToastMixin],
Ed Tanous883a0d52024-03-23 14:56:34 -070041 data() {
42 return {
43 $t: useI18n().t,
44 };
45 },
Dixsie Wolmers6a192d52021-09-02 15:26:58 -050046 computed: {
47 systems() {
48 let systemData = this.$store.getters['system/systems'][0];
49 return systemData ? systemData : {};
50 },
51 },
52 created() {
53 this.$store.dispatch('system/getSystem').finally(() => {
54 this.$root.$emit('overview-inventory-complete');
55 });
56 },
57 methods: {
58 toggleIdentifyLedSwitch(state) {
59 this.$store
60 .dispatch('system/changeIdentifyLedState', state)
Nikhil Ashokaf11a1902024-05-09 15:17:44 +053061 .then((message) => this.successToast(message))
Dixsie Wolmers6a192d52021-09-02 15:26:58 -050062 .catch(({ message }) => this.errorToast(message));
63 },
64 },
65};
66</script>