blob: fdf58de496f0f1b8d481288dc6336503800db9d1 [file] [log] [blame]
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.chassis')">
3 <b-table :items="chassis" :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-expandChassis"
9 @click="row.toggleDetails"
10 >
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -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 <!-- Chassis type -->
27 <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
28 <dd>{{ tableFormatter(item.chassisType) }}</dd>
29 <br />
30 <!-- Manufacturer -->
31 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
32 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
33 <br />
34 <!-- Power state -->
35 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
36 <dd>{{ tableFormatter(item.powerState) }}</dd>
37 </dl>
38 </b-col>
39 <b-col sm="6" xl="4">
40 <dl>
41 <!-- Health rollup -->
42 <dt>
43 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
44 </dt>
45 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
46 <br />
47 <!-- Status state -->
48 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
49 <dd>{{ tableFormatter(item.statusState) }}</dd>
50 </dl>
51 </b-col>
52 </b-row>
53 </b-container>
54 </template>
55 </b-table>
56 </page-section>
57</template>
58
59<script>
60import PageSection from '@/components/Global/PageSection';
61import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
62
63import StatusIcon from '@/components/Global/StatusIcon';
Yoshie Muranaka386df452020-06-18 12:45:13 -070064import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070065
66export default {
67 components: { IconChevron, PageSection, StatusIcon },
Yoshie Muranaka386df452020-06-18 12:45:13 -070068 mixins: [TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070069 data() {
70 return {
71 fields: [
72 {
73 key: 'expandRow',
74 label: '',
75 tdClass: 'table-row-expand'
76 },
77 {
78 key: 'id',
79 label: this.$t('pageHardwareStatus.table.id'),
80 formatter: this.tableFormatter
81 },
82 {
83 key: 'health',
84 label: this.$t('pageHardwareStatus.table.health'),
85 formatter: this.tableFormatter
86 },
87 {
88 key: 'partNumber',
89 label: this.$t('pageHardwareStatus.table.partNumber'),
90 formatter: this.tableFormatter
91 },
92 {
93 key: 'serialNumber',
94 label: this.$t('pageHardwareStatus.table.serialNumber'),
95 formatter: this.tableFormatter
96 }
97 ]
98 };
99 },
100 computed: {
101 chassis() {
102 return this.$store.getters['chassis/chassis'];
103 }
104 },
105 created() {
106 this.$store.dispatch('chassis/getChassisInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500107 // Emit initial data fetch complete to parent component
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700108 this.$root.$emit('hardwareStatus::chassis::complete');
109 });
110 }
111};
112</script>