blob: 0b56a9fe0a9485a53a65b48aac44fb36bc32f8b2 [file] [log] [blame]
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.chassis')">
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 :items="chassis"
7 :fields="fields"
8 show-empty
9 :empty-text="$t('global.table.emptyMessage')"
10 >
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -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-expandChassis"
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 Muranaka09e8b5d2020-06-08 07:36:59 -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 <!-- Chassis type -->
35 <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
36 <dd>{{ tableFormatter(item.chassisType) }}</dd>
37 <br />
38 <!-- Manufacturer -->
39 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
40 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
41 <br />
42 <!-- Power state -->
43 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
44 <dd>{{ tableFormatter(item.powerState) }}</dd>
45 </dl>
46 </b-col>
47 <b-col sm="6" xl="4">
48 <dl>
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 </dl>
59 </b-col>
60 </b-row>
61 </b-container>
62 </template>
63 </b-table>
64 </page-section>
65</template>
66
67<script>
68import PageSection from '@/components/Global/PageSection';
69import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
70
71import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050072
73import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070074import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070075
76export default {
77 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050078 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070079 data() {
80 return {
81 fields: [
82 {
83 key: 'expandRow',
84 label: '',
85 tdClass: 'table-row-expand'
86 },
87 {
88 key: 'id',
89 label: this.$t('pageHardwareStatus.table.id'),
90 formatter: this.tableFormatter
91 },
92 {
93 key: 'health',
94 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -050095 formatter: this.tableFormatter,
96 tdClass: 'text-nowrap'
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070097 },
98 {
99 key: 'partNumber',
100 label: this.$t('pageHardwareStatus.table.partNumber'),
101 formatter: this.tableFormatter
102 },
103 {
104 key: 'serialNumber',
105 label: this.$t('pageHardwareStatus.table.serialNumber'),
106 formatter: this.tableFormatter
107 }
108 ]
109 };
110 },
111 computed: {
112 chassis() {
113 return this.$store.getters['chassis/chassis'];
114 }
115 },
116 created() {
117 this.$store.dispatch('chassis/getChassisInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500118 // Emit initial data fetch complete to parent component
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700119 this.$root.$emit('hardwareStatus::chassis::complete');
120 });
121 }
122};
123</script>