blob: 8fdcbfde827dc6cfed8155e0d479531dc91ca1c2 [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"
5 :items="chassis"
6 :fields="fields"
7 show-empty
8 :empty-text="$t('global.table.emptyMessage')"
9 >
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070010 <!-- Expand chevron icon -->
11 <template v-slot:cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -050012 <b-button
13 variant="link"
14 data-test-id="hardwareStatus-button-expandChassis"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050015 :aria-label="expandRowLabel"
16 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050017 >
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050018 <icon-chevron :title="expandRowLabel" />
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070019 </b-button>
20 </template>
21
22 <!-- Health -->
23 <template v-slot:cell(health)="{ value }">
24 <status-icon :status="statusIcon(value)" />
25 {{ value }}
26 </template>
27
28 <template v-slot:row-details="{ item }">
29 <b-container fluid>
30 <b-row>
31 <b-col sm="6" xl="4">
32 <dl>
33 <!-- Chassis type -->
34 <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
35 <dd>{{ tableFormatter(item.chassisType) }}</dd>
36 <br />
37 <!-- Manufacturer -->
38 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
39 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
40 <br />
41 <!-- Power state -->
42 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
43 <dd>{{ tableFormatter(item.powerState) }}</dd>
44 </dl>
45 </b-col>
46 <b-col sm="6" xl="4">
47 <dl>
48 <!-- Health rollup -->
49 <dt>
50 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
51 </dt>
52 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
53 <br />
54 <!-- Status state -->
55 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
56 <dd>{{ tableFormatter(item.statusState) }}</dd>
57 </dl>
58 </b-col>
59 </b-row>
60 </b-container>
61 </template>
62 </b-table>
63 </page-section>
64</template>
65
66<script>
67import PageSection from '@/components/Global/PageSection';
68import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
69
70import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050071
72import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070073import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070074
75export default {
76 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050077 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070078 data() {
79 return {
80 fields: [
81 {
82 key: 'expandRow',
83 label: '',
84 tdClass: 'table-row-expand'
85 },
86 {
87 key: 'id',
88 label: this.$t('pageHardwareStatus.table.id'),
89 formatter: this.tableFormatter
90 },
91 {
92 key: 'health',
93 label: this.$t('pageHardwareStatus.table.health'),
94 formatter: this.tableFormatter
95 },
96 {
97 key: 'partNumber',
98 label: this.$t('pageHardwareStatus.table.partNumber'),
99 formatter: this.tableFormatter
100 },
101 {
102 key: 'serialNumber',
103 label: this.$t('pageHardwareStatus.table.serialNumber'),
104 formatter: this.tableFormatter
105 }
106 ]
107 };
108 },
109 computed: {
110 chassis() {
111 return this.$store.getters['chassis/chassis'];
112 }
113 },
114 created() {
115 this.$store.dispatch('chassis/getChassisInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500116 // Emit initial data fetch complete to parent component
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700117 this.$root.$emit('hardwareStatus::chassis::complete');
118 });
119 }
120};
121</script>