blob: 89ae5118287d10341dfc2a4ce7e5c4a9fb90c5d9 [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.system')">
SurenNeware307382e2020-07-27 20:45:14 +05303 <b-table
4 responsive="md"
Sukanya Pandeyfde429e2020-09-14 20:48:39 +05305 hover
SurenNeware307382e2020-07-27 20:45:14 +05306 show-empty
7 :items="systems"
8 :fields="fields"
9 :empty-text="$t('global.table.emptyMessage')"
10 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070011 <!-- Expand chevron icon -->
12 <template v-slot:cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -050013 <b-button
14 variant="link"
15 data-test-id="hardwareStatus-button-expandSystem"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050016 :aria-label="expandRowLabel"
17 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050018 >
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050019 <icon-chevron :title="expandRowLabel" />
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070020 </b-button>
21 </template>
22
23 <!-- Health -->
24 <template v-slot:cell(health)="{ value }">
25 <status-icon :status="statusIcon(value)" />
26 {{ value }}
27 </template>
28
29 <template v-slot:row-details="{ item }">
30 <b-container fluid>
31 <b-row>
32 <b-col sm="6" xl="4">
33 <dl>
34 <!-- Asset tag -->
35 <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
36 <dd>{{ tableFormatter(item.assetTag) }}</dd>
37 <br />
38 <!-- Description -->
39 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
40 <dd>{{ tableFormatter(item.description) }}</dd>
41 <br />
42 <!-- Indicator LED -->
43 <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt>
44 <dd>{{ tableFormatter(item.indicatorLed) }}</dd>
45 <br />
46 <!-- Model -->
47 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
48 <dd>{{ tableFormatter(item.model) }}</dd>
49 </dl>
50 </b-col>
51 <b-col sm="6" xl="4">
52 <dl>
53 <!-- Power state -->
54 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
55 <dd>{{ tableFormatter(item.powerState) }}</dd>
56 <br />
57 <!-- Health rollup -->
58 <dt>
59 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
60 </dt>
61 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
62 <br />
63 <!-- Status state -->
64 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
65 <dd>{{ tableFormatter(item.statusState) }}</dd>
66 <br />
67 <!-- System type -->
68 <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt>
69 <dd>{{ tableFormatter(item.systemType) }}</dd>
70 </dl>
71 </b-col>
72 </b-row>
73 </b-container>
74 </template>
75 </b-table>
76 </page-section>
77</template>
78
79<script>
80import PageSection from '@/components/Global/PageSection';
81import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
82
83import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050084
85import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070086import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070087
88export default {
89 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050090 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070091 data() {
92 return {
93 fields: [
94 {
95 key: 'expandRow',
96 label: '',
97 tdClass: 'table-row-expand'
98 },
99 {
100 key: 'id',
101 label: this.$t('pageHardwareStatus.table.id'),
102 formatter: this.tableFormatter
103 },
104 {
105 key: 'health',
106 label: this.$t('pageHardwareStatus.table.health'),
107 formatter: this.tableFormatter
108 },
109 {
110 key: 'partNumber',
111 label: this.$t('pageHardwareStatus.table.partNumber'),
112 formatter: this.tableFormatter
113 },
114 {
115 key: 'serialNumber',
116 label: this.$t('pageHardwareStatus.table.serialNumber'),
117 formatter: this.tableFormatter
118 }
119 ]
120 };
121 },
122 computed: {
123 systems() {
124 return this.$store.getters['system/systems'];
125 }
126 },
127 created() {
128 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500129 // Emit initial data fetch complete to parent component
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700130 this.$root.$emit('hardwareStatus::system::complete');
131 });
132 }
133};
134</script>