blob: 68f5de5aae8167045b2dd4b7778731caebdd5969 [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.system')">
3 <b-table :items="systems" :fields="fields">
4 <!-- Expand chevron icon -->
5 <template v-slot:cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -05006 <b-button
7 variant="link"
8 data-test-id="hardwareStatus-button-expandSystem"
9 @click="row.toggleDetails"
10 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070011 <icon-chevron />
12 </b-button>
13 </template>
14
15 <!-- Health -->
16 <template v-slot:cell(health)="{ value }">
17 <status-icon :status="statusIcon(value)" />
18 {{ value }}
19 </template>
20
21 <template v-slot:row-details="{ item }">
22 <b-container fluid>
23 <b-row>
24 <b-col sm="6" xl="4">
25 <dl>
26 <!-- Asset tag -->
27 <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
28 <dd>{{ tableFormatter(item.assetTag) }}</dd>
29 <br />
30 <!-- Description -->
31 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
32 <dd>{{ tableFormatter(item.description) }}</dd>
33 <br />
34 <!-- Indicator LED -->
35 <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt>
36 <dd>{{ tableFormatter(item.indicatorLed) }}</dd>
37 <br />
38 <!-- Model -->
39 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
40 <dd>{{ tableFormatter(item.model) }}</dd>
41 </dl>
42 </b-col>
43 <b-col sm="6" xl="4">
44 <dl>
45 <!-- Power state -->
46 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
47 <dd>{{ tableFormatter(item.powerState) }}</dd>
48 <br />
49 <!-- Health rollup -->
50 <dt>
51 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
52 </dt>
53 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
54 <br />
55 <!-- Status state -->
56 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
57 <dd>{{ tableFormatter(item.statusState) }}</dd>
58 <br />
59 <!-- System type -->
60 <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt>
61 <dd>{{ tableFormatter(item.systemType) }}</dd>
62 </dl>
63 </b-col>
64 </b-row>
65 </b-container>
66 </template>
67 </b-table>
68 </page-section>
69</template>
70
71<script>
72import PageSection from '@/components/Global/PageSection';
73import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
74
75import StatusIcon from '@/components/Global/StatusIcon';
Yoshie Muranaka386df452020-06-18 12:45:13 -070076import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070077
78export default {
79 components: { IconChevron, PageSection, StatusIcon },
Yoshie Muranaka386df452020-06-18 12:45:13 -070080 mixins: [TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070081 data() {
82 return {
83 fields: [
84 {
85 key: 'expandRow',
86 label: '',
87 tdClass: 'table-row-expand'
88 },
89 {
90 key: 'id',
91 label: this.$t('pageHardwareStatus.table.id'),
92 formatter: this.tableFormatter
93 },
94 {
95 key: 'health',
96 label: this.$t('pageHardwareStatus.table.health'),
97 formatter: this.tableFormatter
98 },
99 {
100 key: 'partNumber',
101 label: this.$t('pageHardwareStatus.table.partNumber'),
102 formatter: this.tableFormatter
103 },
104 {
105 key: 'serialNumber',
106 label: this.$t('pageHardwareStatus.table.serialNumber'),
107 formatter: this.tableFormatter
108 }
109 ]
110 };
111 },
112 computed: {
113 systems() {
114 return this.$store.getters['system/systems'];
115 }
116 },
117 created() {
118 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500119 // Emit initial data fetch complete to parent component
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700120 this.$root.$emit('hardwareStatus::system::complete');
121 });
122 }
123};
124</script>