blob: 4bcab516d9d2ba967ce1310b3153fa029d9ed0d5 [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"
15 @click="row.toggleDetails"
16 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -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 <!-- Asset tag -->
33 <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
34 <dd>{{ tableFormatter(item.assetTag) }}</dd>
35 <br />
36 <!-- Description -->
37 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
38 <dd>{{ tableFormatter(item.description) }}</dd>
39 <br />
40 <!-- Indicator LED -->
41 <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt>
42 <dd>{{ tableFormatter(item.indicatorLed) }}</dd>
43 <br />
44 <!-- Model -->
45 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
46 <dd>{{ tableFormatter(item.model) }}</dd>
47 </dl>
48 </b-col>
49 <b-col sm="6" xl="4">
50 <dl>
51 <!-- Power state -->
52 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
53 <dd>{{ tableFormatter(item.powerState) }}</dd>
54 <br />
55 <!-- Health rollup -->
56 <dt>
57 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
58 </dt>
59 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
60 <br />
61 <!-- Status state -->
62 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
63 <dd>{{ tableFormatter(item.statusState) }}</dd>
64 <br />
65 <!-- System type -->
66 <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt>
67 <dd>{{ tableFormatter(item.systemType) }}</dd>
68 </dl>
69 </b-col>
70 </b-row>
71 </b-container>
72 </template>
73 </b-table>
74 </page-section>
75</template>
76
77<script>
78import PageSection from '@/components/Global/PageSection';
79import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
80
81import StatusIcon from '@/components/Global/StatusIcon';
Yoshie Muranaka386df452020-06-18 12:45:13 -070082import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070083
84export default {
85 components: { IconChevron, PageSection, StatusIcon },
Yoshie Muranaka386df452020-06-18 12:45:13 -070086 mixins: [TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070087 data() {
88 return {
89 fields: [
90 {
91 key: 'expandRow',
92 label: '',
93 tdClass: 'table-row-expand'
94 },
95 {
96 key: 'id',
97 label: this.$t('pageHardwareStatus.table.id'),
98 formatter: this.tableFormatter
99 },
100 {
101 key: 'health',
102 label: this.$t('pageHardwareStatus.table.health'),
103 formatter: this.tableFormatter
104 },
105 {
106 key: 'partNumber',
107 label: this.$t('pageHardwareStatus.table.partNumber'),
108 formatter: this.tableFormatter
109 },
110 {
111 key: 'serialNumber',
112 label: this.$t('pageHardwareStatus.table.serialNumber'),
113 formatter: this.tableFormatter
114 }
115 ]
116 };
117 },
118 computed: {
119 systems() {
120 return this.$store.getters['system/systems'];
121 }
122 },
123 created() {
124 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500125 // Emit initial data fetch complete to parent component
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700126 this.$root.$emit('hardwareStatus::system::complete');
127 });
128 }
129};
130</script>