blob: 724f1c8aa25ab2ed36e335f0be3ee63b9a9cab7c [file] [log] [blame]
Yoshie Muranaka56ee7692020-05-28 13:28:29 -07001<template>
2 <page-section :section-title="$t('pageHardwareStatus.system')">
SurenNeware307382e2020-07-27 20:45:14 +05303 <b-table
4 responsive="md"
5 show-empty
6 :items="systems"
7 :fields="fields"
8 :empty-text="$t('global.table.emptyMessage')"
9 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -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-expandSystem"
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 Muranaka56ee7692020-05-28 13:28:29 -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 <!-- Asset tag -->
34 <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
35 <dd>{{ tableFormatter(item.assetTag) }}</dd>
36 <br />
37 <!-- Description -->
38 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
39 <dd>{{ tableFormatter(item.description) }}</dd>
40 <br />
41 <!-- Indicator LED -->
42 <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt>
43 <dd>{{ tableFormatter(item.indicatorLed) }}</dd>
44 <br />
45 <!-- Model -->
46 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
47 <dd>{{ tableFormatter(item.model) }}</dd>
48 </dl>
49 </b-col>
50 <b-col sm="6" xl="4">
51 <dl>
52 <!-- Power state -->
53 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
54 <dd>{{ tableFormatter(item.powerState) }}</dd>
55 <br />
56 <!-- Health rollup -->
57 <dt>
58 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
59 </dt>
60 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
61 <br />
62 <!-- Status state -->
63 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
64 <dd>{{ tableFormatter(item.statusState) }}</dd>
65 <br />
66 <!-- System type -->
67 <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt>
68 <dd>{{ tableFormatter(item.systemType) }}</dd>
69 </dl>
70 </b-col>
71 </b-row>
72 </b-container>
73 </template>
74 </b-table>
75 </page-section>
76</template>
77
78<script>
79import PageSection from '@/components/Global/PageSection';
80import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
81
82import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050083
84import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070085import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070086
87export default {
88 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050089 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070090 data() {
91 return {
92 fields: [
93 {
94 key: 'expandRow',
95 label: '',
96 tdClass: 'table-row-expand'
97 },
98 {
99 key: 'id',
100 label: this.$t('pageHardwareStatus.table.id'),
101 formatter: this.tableFormatter
102 },
103 {
104 key: 'health',
105 label: this.$t('pageHardwareStatus.table.health'),
106 formatter: this.tableFormatter
107 },
108 {
109 key: 'partNumber',
110 label: this.$t('pageHardwareStatus.table.partNumber'),
111 formatter: this.tableFormatter
112 },
113 {
114 key: 'serialNumber',
115 label: this.$t('pageHardwareStatus.table.serialNumber'),
116 formatter: this.tableFormatter
117 }
118 ]
119 };
120 },
121 computed: {
122 systems() {
123 return this.$store.getters['system/systems'];
124 }
125 },
126 created() {
127 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500128 // Emit initial data fetch complete to parent component
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700129 this.$root.$emit('hardwareStatus::system::complete');
130 });
131 }
132};
133</script>