blob: 9cb1c6aec46417aad7fc45dfb97cbee48ba30a64 [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"
Sukanya Pandeyfde429e2020-09-14 20:48:39 +05305 hover
SurenNeware307382e2020-07-27 20:45:14 +05306 show-empty
7 :items="systems"
8 :fields="fields"
9 :empty-text="$t('global.table.emptyMessage')"
10 >
Yoshie Muranaka56ee7692020-05-28 13:28:29 -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-expandSystem"
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 Muranaka56ee7692020-05-28 13:28:29 -070022 </b-button>
23 </template>
24
25 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050026 <template #cell(health)="{ value }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070027 <status-icon :status="statusIcon(value)" />
28 {{ value }}
29 </template>
30
Derick Montague602e98a2020-10-21 16:20:00 -050031 <template #row-details="{ item }">
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070032 <b-container fluid>
33 <b-row>
34 <b-col sm="6" xl="4">
35 <dl>
36 <!-- Asset tag -->
37 <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt>
38 <dd>{{ tableFormatter(item.assetTag) }}</dd>
39 <br />
40 <!-- Description -->
41 <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt>
42 <dd>{{ tableFormatter(item.description) }}</dd>
43 <br />
44 <!-- Indicator LED -->
45 <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt>
46 <dd>{{ tableFormatter(item.indicatorLed) }}</dd>
47 <br />
48 <!-- Model -->
49 <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt>
50 <dd>{{ tableFormatter(item.model) }}</dd>
51 </dl>
52 </b-col>
53 <b-col sm="6" xl="4">
54 <dl>
55 <!-- Power state -->
56 <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt>
57 <dd>{{ tableFormatter(item.powerState) }}</dd>
58 <br />
59 <!-- Health rollup -->
60 <dt>
61 {{ $t('pageHardwareStatus.table.statusHealthRollup') }}:
62 </dt>
63 <dd>{{ tableFormatter(item.healthRollup) }}</dd>
64 <br />
65 <!-- Status state -->
66 <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt>
67 <dd>{{ tableFormatter(item.statusState) }}</dd>
68 <br />
69 <!-- System type -->
70 <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt>
71 <dd>{{ tableFormatter(item.systemType) }}</dd>
72 </dl>
73 </b-col>
74 </b-row>
75 </b-container>
76 </template>
77 </b-table>
78 </page-section>
79</template>
80
81<script>
82import PageSection from '@/components/Global/PageSection';
83import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
84
85import StatusIcon from '@/components/Global/StatusIcon';
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050086
87import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070088import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070089
90export default {
91 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050092 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070093 data() {
94 return {
95 fields: [
96 {
97 key: 'expandRow',
98 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -050099 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700100 },
101 {
102 key: 'id',
103 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500104 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700105 },
106 {
107 key: 'health',
108 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500109 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500110 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700111 },
112 {
113 key: 'partNumber',
114 label: this.$t('pageHardwareStatus.table.partNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500115 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700116 },
117 {
118 key: 'serialNumber',
119 label: this.$t('pageHardwareStatus.table.serialNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500120 formatter: this.tableFormatter,
121 },
122 ],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700123 };
124 },
125 computed: {
126 systems() {
127 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500128 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700129 },
130 created() {
131 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500132 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530133 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700134 });
Derick Montague602e98a2020-10-21 16:20:00 -0500135 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700136};
137</script>