blob: d40870162f74b2dda97e4b5ea78cb27d50a53abe [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 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 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
SurenNewareba91c492020-10-27 14:18:54 +053087import TableRowExpandMixin, {
88 expandRowLabel,
89} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranaka386df452020-06-18 12:45:13 -070090import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin';
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070091
92export default {
93 components: { IconChevron, PageSection, StatusIcon },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050094 mixins: [TableRowExpandMixin, TableDataFormatterMixin],
Yoshie Muranaka56ee7692020-05-28 13:28:29 -070095 data() {
96 return {
97 fields: [
98 {
99 key: 'expandRow',
100 label: '',
Derick Montague602e98a2020-10-21 16:20:00 -0500101 tdClass: 'table-row-expand',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700102 },
103 {
104 key: 'id',
105 label: this.$t('pageHardwareStatus.table.id'),
Derick Montague602e98a2020-10-21 16:20:00 -0500106 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700107 },
108 {
109 key: 'health',
110 label: this.$t('pageHardwareStatus.table.health'),
Dixsie Wolmersa04d46f2020-10-22 06:34:56 -0500111 formatter: this.tableFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500112 tdClass: 'text-nowrap',
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700113 },
114 {
115 key: 'partNumber',
116 label: this.$t('pageHardwareStatus.table.partNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500117 formatter: this.tableFormatter,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700118 },
119 {
120 key: 'serialNumber',
121 label: this.$t('pageHardwareStatus.table.serialNumber'),
Derick Montague602e98a2020-10-21 16:20:00 -0500122 formatter: this.tableFormatter,
123 },
124 ],
SurenNewareba91c492020-10-27 14:18:54 +0530125 expandRowLabel: expandRowLabel,
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700126 };
127 },
128 computed: {
129 systems() {
130 return this.$store.getters['system/systems'];
Derick Montague602e98a2020-10-21 16:20:00 -0500131 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700132 },
133 created() {
134 this.$store.dispatch('system/getSystem').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500135 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530136 this.$root.$emit('hardware-status-system-complete');
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700137 });
Derick Montague602e98a2020-10-21 16:20:00 -0500138 },
Yoshie Muranaka56ee7692020-05-28 13:28:29 -0700139};
140</script>