blob: eb4c000a17c97d342174feb3baf2f2209cba2530 [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"
15 @click="row.toggleDetails"
16 >
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070017 <icon-chevron />
18 </b-button>
19 </template>
20
21 <!-- Health -->
22 <template v-slot:cell(health)="{ value }">
23 <status-icon :status="statusIcon(value)" />
24 {{ value }}
25 </template>
26
27 <template v-slot:row-details="{ item }">
28 <b-container fluid>
29 <b-row>
30 <b-col sm="6" xl="4">
31 <dl>
32 <!-- Chassis type -->
33 <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
34 <dd>{{ tableFormatter(item.chassisType) }}</dd>
35 <br />
36 <!-- Manufacturer -->
37 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
38 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
39 <br />
40 <!-- Power state -->
41 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
42 <dd>{{ tableFormatter(item.powerState) }}</dd>
43 </dl>
44 </b-col>
45 <b-col sm="6" xl="4">
46 <dl>
47 <!-- Health rollup -->
48 <dt>
49 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
50 </dt>
51 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
52 <br />
53 <!-- Status state -->
54 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
55 <dd>{{ tableFormatter(item.statusState) }}</dd>
56 </dl>
57 </b-col>
58 </b-row>
59 </b-container>
60 </template>
61 </b-table>
62 </page-section>
63</template>
64
65<script>
66import PageSection from '@/components/Global/PageSection';
67import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
68
69import StatusIcon from '@/components/Global/StatusIcon';
Yoshie Muranaka386df452020-06-18 12:45:13 -070070import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070071
72export default {
73 components: { IconChevron, PageSection, StatusIcon },
Yoshie Muranaka386df452020-06-18 12:45:13 -070074 mixins: [TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070075 data() {
76 return {
77 fields: [
78 {
79 key: 'expandRow',
80 label: '',
81 tdClass: 'table-row-expand'
82 },
83 {
84 key: 'id',
85 label: this.$t('pageHardwareStatus.table.id'),
86 formatter: this.tableFormatter
87 },
88 {
89 key: 'health',
90 label: this.$t('pageHardwareStatus.table.health'),
91 formatter: this.tableFormatter
92 },
93 {
94 key: 'partNumber',
95 label: this.$t('pageHardwareStatus.table.partNumber'),
96 formatter: this.tableFormatter
97 },
98 {
99 key: 'serialNumber',
100 label: this.$t('pageHardwareStatus.table.serialNumber'),
101 formatter: this.tableFormatter
102 }
103 ]
104 };
105 },
106 computed: {
107 chassis() {
108 return this.$store.getters['chassis/chassis'];
109 }
110 },
111 created() {
112 this.$store.dispatch('chassis/getChassisInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500113 // Emit initial data fetch complete to parent component
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700114 this.$root.$emit('hardwareStatus::chassis::complete');
115 });
116 }
117};
118</script>