blob: 01f4a446501e1c3d6f7cb4558a8e1e3f124c1c98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
<template>
<page-section
:section-title="$t('pageInventory.systemIndicator.sectionTitle')"
>
<div class="form-background pl-4 pt-4 pb-1">
<b-row>
<b-col sm="6" md="3">
<dl>
<dt>{{ $t('pageInventory.systemIndicator.powerStatus') }}</dt>
<dd>
{{ $t(powerStatus) }}
</dd>
</dl>
</b-col>
<b-col sm="6" md="3">
<dl>
<dt>
{{ $t('pageInventory.systemIndicator.identifyLed') }}
</dt>
<dd>
<b-form-checkbox
id="identifyLedSwitchService"
v-model="systems.locationIndicatorActive"
data-test-id="inventoryService-toggle-identifyLed"
switch
@change="toggleIdentifyLedSwitch"
>
<span v-if="systems.locationIndicatorActive">
{{ $t('global.status.on') }}
</span>
<span v-else>{{ $t('global.status.off') }}</span>
</b-form-checkbox>
</dd>
</dl>
</b-col>
</b-row>
</div>
</page-section>
</template>
<script>
import PageSection from '@/components/Global/PageSection';
import BVToastMixin from '@/components/Mixins/BVToastMixin';
export default {
components: { PageSection },
mixins: [BVToastMixin],
computed: {
systems() {
let systemData = this.$store.getters['system/systems'][0];
return systemData ? systemData : {};
},
serverStatus() {
return this.$store.getters['global/serverStatus'];
},
powerStatus() {
if (this.serverStatus === 'unreachable') {
return `global.status.off`;
}
return `global.status.${this.serverStatus}`;
},
},
created() {
this.$store.dispatch('system/getSystem').finally(() => {
// Emit initial data fetch complete to parent component
this.$root.$emit('hardware-status-service-complete');
});
},
methods: {
toggleIdentifyLedSwitch(state) {
this.$store
.dispatch('system/changeIdentifyLedState', state)
.catch(({ message }) => this.errorToast(message));
},
},
};
</script>
|