blob: 4fdda5060b66abfc167b69e1316e856e5aa41534 [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 -->
Derick Montague602e98a2020-10-21 16:20:00 -050012 <template #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"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060017 :title="expandRowLabel"
18 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050019 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050020 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060021 <icon-chevron />
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070022 </b-button>
23 </template>
24
25 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050026 <template #cell(health)="{ value }">
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070027 <status-icon :status="statusIcon(value)" />
28 {{ value }}
29 </template>
30
Derick Montague602e98a2020-10-21 16:20:00 -050031 <template #row-details="{ item }">
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070032 <b-container fluid>
33 <b-row>
34 <b-col sm="6" xl="4">
35 <dl>
36 <!-- Chassis type -->
37 <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt>
38 <dd>{{ tableFormatter(item.chassisType) }}</dd>
39 <br />
40 <!-- Manufacturer -->
41 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
42 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
43 <br />
44 <!-- Power state -->
45 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
46 <dd>{{ tableFormatter(item.powerState) }}</dd>
47 </dl>
48 </b-col>
49 <b-col sm="6" xl="4">
50 <dl>
51 <!-- Health rollup -->
52 <dt>
53 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
54 </dt>
55 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
56 <br />
57 <!-- Status state -->
58 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
59 <dd>{{ tableFormatter(item.statusState) }}</dd>
60 </dl>
61 </b-col>
62 </b-row>
63 </b-container>
64 </template>
65 </b-table>
66 </page-section>
67</template>
68
69<script>
70import PageSection from '@/components/Global/PageSection';
71import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
72
73import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050074
75import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070076import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070077
78export default {
79 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050080 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070081 data() {
82 return {
83 fields: [
84 {
85 key: 'expandRow',
86 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -050087 tdClass: 'table-row-expand',
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070088 },
89 {
90 key: 'id',
91 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -050092 formatter: this.tableFormatter,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070093 },
94 {
95 key: 'health',
96 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -050097 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -050098 tdClass: 'text-nowrap',
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070099 },
100 {
101 key: 'partNumber',
102 label: this.$t('pageHardwareStatus.table.partNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500103 formatter: this.tableFormatter,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700104 },
105 {
106 key: 'serialNumber',
107 label: this.$t('pageHardwareStatus.table.serialNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500108 formatter: this.tableFormatter,
109 },
110 ],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700111 };
112 },
113 computed: {
114 chassis() {
115 return this.$store.getters['chassis/chassis'];
Derick Montague602e98a2020-10-21 16:20:00 -0500116 },
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700117 },
118 created() {
119 this.$store.dispatch('chassis/getChassisInfo').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500120 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530121 this.$root.$emit('hardware-status-chassis-complete');
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700122 });
Derick Montague602e98a2020-10-21 16:20:00 -0500123 },
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700124};
125</script>