blob: c7e409a4372525e3c2d36ae52ee87fdaccb05a34 [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 Wolmers30f11f82020-11-10 16:07:56 -060016 :title="expandRowLabel"
17 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050018 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050019 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060020 <icon-chevron />
SurenNeware6e2cb972020-12-24 20:58:16 +053021 <span class="sr-only">{{ expandRowLabel }}</span>
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>
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070039 <!-- Manufacturer -->
40 <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt>
41 <dd>{{ tableFormatter(item.manufacturer) }}</dd>
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070042 <!-- 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>
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070054 <!-- 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
SurenNewareba91c492020-10-27 14:18:54 +053072import TableRowExpandMixin, {
73 expandRowLabel,
74} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070075import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070076
77export default {
78 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050079 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070080 data() {
81 return {
82 fields: [
83 {
84 key: 'expandRow',
85 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -050086 tdClass: 'table-row-expand',
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070087 },
88 {
89 key: 'id',
90 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -050091 formatter: this.tableFormatter,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070092 },
93 {
94 key: 'health',
95 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -050096 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -050097 tdClass: 'text-nowrap',
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -070098 },
99 {
100 key: 'partNumber',
101 label: this.$t('pageHardwareStatus.table.partNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500102 formatter: this.tableFormatter,
Yoshie Muranaka09e8b5d2020-06-08 07:36:59 -0700103 },
104 {
105 key: 'serialNumber',
106 label: this.$t('pageHardwareStatus.table.serialNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500107 formatter: this.tableFormatter,
108 },
109 ],
SurenNewareba91c492020-10-27 14:18:54 +0530110 expandRowLabel: expandRowLabel,
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>