blob: c767726bb95c784acc6499638420fb8711e02e9c [file] [log] [blame]
Yoshie Muranakae24b17d2020-06-08 11:03:11 -07001<template>
Sandeepa Singh7affc522021-07-06 16:29:10 +05302 <page-section :section-title="$t('pageInventory.dimmSlot')">
SurenNeware787635a2020-11-24 22:42:42 +05303 <b-row class="align-items-end">
Yoshie Muranaka41770142020-06-18 14:00:55 -07004 <b-col sm="6" md="5" xl="4">
Dixsie Wolmers9b22b492020-09-07 21:26:06 -05005 <search
Sukanya Pandeyedb8a772020-10-29 11:33:42 +05306 @change-search="onChangeSearchInput"
7 @clear-search="onClearSearchInput"
Dixsie Wolmers9b22b492020-09-07 21:26:06 -05008 />
Yoshie Muranaka41770142020-06-18 14:00:55 -07009 </b-col>
Sukanya Pandey99010962020-07-27 21:44:47 +053010 <b-col sm="6" md="3" xl="2">
11 <table-cell-count
12 :filtered-items-count="filteredRows"
13 :total-number-of-cells="dimms.length"
14 ></table-cell-count>
15 </b-col>
Yoshie Muranaka41770142020-06-18 14:00:55 -070016 </b-row>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070017 <b-table
18 sort-icon-left
jason westoverd36ac8a2025-11-03 20:58:59 -060019 must-sort
Sukanya Pandeyfde429e2020-09-14 20:48:39 +053020 hover
jason westoverd36ac8a2025-11-03 20:58:59 -060021 thead-class="table-light"
22 :sort-by="['health']"
SurenNeware5e25e282020-07-08 15:57:23 +053023 responsive="md"
SurenNeware307382e2020-07-27 20:45:14 +053024 show-empty
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070025 :items="dimms"
26 :fields="fields"
jason westoverd36ac8a2025-11-03 20:58:59 -060027 :sort-desc="[true]"
Yoshie Muranaka41770142020-06-18 14:00:55 -070028 :filter="searchFilter"
SurenNeware307382e2020-07-27 20:45:14 +053029 :empty-text="$t('global.table.emptyMessage')"
SurenNeware156a0e62020-08-28 19:20:03 +053030 :empty-filtered-text="$t('global.table.emptySearchMessage')"
Kenneth Fullbright41057852021-12-27 16:19:37 -060031 :busy="isBusy"
Sukanya Pandey99010962020-07-27 21:44:47 +053032 @filtered="onFiltered"
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070033 >
34 <!-- Expand chevron icon -->
Derick Montague602e98a2020-10-21 16:20:00 -050035 <template #cell(expandRow)="row">
Dixsie Wolmers83133762020-07-15 08:45:19 -050036 <b-button
37 variant="link"
jason westoverd36ac8a2025-11-03 20:58:59 -060038 data-test-id="hardwareStatus-button-expandDimmSlot"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060039 :title="expandRowLabel"
40 class="btn-icon-only"
jason westoverd36ac8a2025-11-03 20:58:59 -060041 :class="{ collapsed: !row.detailsShowing }"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050042 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050043 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060044 <icon-chevron />
jason westoverd36ac8a2025-11-03 20:58:59 -060045 <span class="visually-hidden">{{ expandRowLabel }}</span>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070046 </b-button>
47 </template>
48
49 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050050 <template #cell(health)="{ value }">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070051 <status-icon :status="statusIcon(value)" />
52 {{ value }}
53 </template>
HuyLe5d86af82023-10-09 14:32:28 +070054
55 <!-- StatusState -->
56 <template #cell(statusState)="{ value }">
57 <status-icon :status="statusStateIcon(value)" />
58 {{ value }}
59 </template>
60
Sandeepa Singh81876782021-09-27 14:52:38 +053061 <!-- Toggle identify LED -->
62 <template #cell(identifyLed)="row">
63 <b-form-checkbox
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +030064 v-if="hasIdentifyLed(row.item.identifyLed)"
Sandeepa Singh81876782021-09-27 14:52:38 +053065 v-model="row.item.identifyLed"
66 name="switch"
67 switch
68 @change="toggleIdentifyLedValue(row.item)"
69 >
70 <span v-if="row.item.identifyLed">
71 {{ $t('global.status.on') }}
72 </span>
73 <span v-else> {{ $t('global.status.off') }} </span>
74 </b-form-checkbox>
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +030075 <div v-else>--</div>
Sandeepa Singh81876782021-09-27 14:52:38 +053076 </template>
Derick Montague602e98a2020-10-21 16:20:00 -050077 <template #row-details="{ item }">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070078 <b-container fluid>
79 <b-row>
Sandeepa Singh81876782021-09-27 14:52:38 +053080 <b-col sm="6" xl="6">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070081 <dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -070082 <!-- Manufacturer -->
83 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
84 <dd>{{ dataFormatter(item.manufacturer) }}</dd>
85 </dl>
86 <dl>
Sandeepa Singh81876782021-09-27 14:52:38 +053087 <!-- Part Number -->
88 <dt>{{ $t('pageInventory.table.partNumber') }}:</dt>
89 <dd>{{ dataFormatter(item.partNumber) }}</dd>
90 </dl>
91 <dl>
92 <!-- Serial Number -->
93 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
94 <dd>{{ dataFormatter(item.serialNumber) }}</dd>
95 </dl>
96 <dl>
97 <!-- Spare Part Number -->
98 <dt>{{ $t('pageInventory.table.sparePartNumber') }}:</dt>
jason westoverd36ac8a2025-11-03 20:58:59 -060099 <dd>
100 {{ dataFormatter(item.sparePartNumber) }}
101 </dd>
Sandeepa Singh81876782021-09-27 14:52:38 +0530102 </dl>
103 <dl>
104 <!-- Model -->
105 <dt>{{ $t('pageInventory.table.model') }}:</dt>
106 <dd>{{ dataFormatter(item.model) }}</dd>
107 </dl>
Sandeepa Singh81876782021-09-27 14:52:38 +0530108 </b-col>
109 <b-col sm="6" xl="6">
110 <dl>
Glukhov Mikhailba60e9c2022-11-21 10:21:51 +0300111 <!-- Capacity MiB -->
112 <dt>{{ $t('pageInventory.table.capacityMiB') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300113 <dd>
114 {{ dataFormatter(item.capacityMiB) }}
115 {{ $t('unit.MiB') }}
116 </dd>
Sandeepa Singh81876782021-09-27 14:52:38 +0530117 </dl>
118 <dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -0700119 <!-- Rank Count -->
120 <dt>{{ $t('pageInventory.table.rankCount') }}:</dt>
121 <dd>{{ dataFormatter(item.rankCount) }}</dd>
122 </dl>
123 <dl>
Sandeepa Singh81876782021-09-27 14:52:38 +0530124 <!-- Status-->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530125 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500126 <dd>{{ dataFormatter(item.statusState) }}</dd>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700127 </dl>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530128 <dl>
129 <!-- Enabled-->
130 <dt>{{ $t('pageInventory.table.enabled') }}:</dt>
131 <dd>{{ dataFormatter(item.enabled) }}</dd>
132 </dl>
133 </b-col>
134 </b-row>
135 <div class="section-divider mb-3 mt-3"></div>
136 <b-row>
137 <b-col sm="6" xl="6">
138 <dl>
139 <!-- Description -->
140 <dt>{{ $t('pageInventory.table.description') }}:</dt>
141 <dd>{{ dataFormatter(item.description) }}</dd>
142 </dl>
143 <dl>
144 <!-- Memory Type -->
145 <dt>{{ $t('pageInventory.table.memoryType') }}:</dt>
146 <dd>{{ dataFormatter(item.memoryType) }}</dd>
147 </dl>
148 <dl>
149 <!-- Base Module Type -->
150 <dt>{{ $t('pageInventory.table.baseModuleType') }}:</dt>
jason westoverd36ac8a2025-11-03 20:58:59 -0600151 <dd>
152 {{ dataFormatter(item.baseModuleType) }}
153 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530154 </dl>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530155 </b-col>
156 <b-col sm="6" xl="6">
157 <dl>
158 <!-- Bus Width Bits -->
159 <dt>{{ $t('pageInventory.table.busWidthBits') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300160 <dd>
161 {{ dataFormatter(item.busWidthBits) }}
162 {{ $t('unit.bit') }}
163 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530164 </dl>
165 <dl>
166 <!-- Data Width Bits -->
167 <dt>{{ $t('pageInventory.table.dataWidthBits') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300168 <dd>
169 {{ dataFormatter(item.dataWidthBits) }}
170 {{ $t('unit.bit') }}
171 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530172 </dl>
173 <dl>
174 <!-- Operating Speed Mhz -->
175 <dt>{{ $t('pageInventory.table.operatingSpeedMhz') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300176 <dd>
177 {{ dataFormatter(item.operatingSpeedMhz) }}
178 {{ $t('unit.MHz') }}
179 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530180 </dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -0700181 <dl>
182 <!-- Error Correction -->
183 <dt>{{ $t('pageInventory.table.errorCorrection') }}:</dt>
jason westoverd36ac8a2025-11-03 20:58:59 -0600184 <dd>
185 {{ dataFormatter(item.errorCorrection) }}
186 </dd>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -0700187 </dl>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700188 </b-col>
189 </b-row>
190 </b-container>
191 </template>
192 </b-table>
193 </page-section>
194</template>
195
196<script>
197import PageSection from '@/components/Global/PageSection';
198import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
199
200import StatusIcon from '@/components/Global/StatusIcon';
Sukanya Pandey99010962020-07-27 21:44:47 +0530201import TableCellCount from '@/components/Global/TableCellCount';
202
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530203import BVToastMixin from '@/components/Mixins/BVToastMixin';
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500204import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700205import TableSortMixin from '@/components/Mixins/TableSortMixin';
Yoshie Muranaka41770142020-06-18 14:00:55 -0700206import Search from '@/components/Global/Search';
SurenNewareba91c492020-10-27 14:18:54 +0530207import SearchFilterMixin, {
208 searchFilter,
209} from '@/components/Mixins/SearchFilterMixin';
210import TableRowExpandMixin, {
211 expandRowLabel,
212} from '@/components/Mixins/TableRowExpandMixin';
Surya Vde23ea22024-07-11 15:19:46 +0530213import { useI18n } from 'vue-i18n';
214import i18n from '@/i18n';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700215
216export default {
jason westoverd36ac8a2025-11-03 20:58:59 -0600217 components: {
218 IconChevron,
219 PageSection,
220 StatusIcon,
221 Search,
222 TableCellCount,
223 },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500224 mixins: [
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530225 BVToastMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500226 TableRowExpandMixin,
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500227 DataFormatterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500228 TableSortMixin,
Derick Montague602e98a2020-10-21 16:20:00 -0500229 SearchFilterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500230 ],
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700231 data() {
232 return {
Surya Vde23ea22024-07-11 15:19:46 +0530233 $t: useI18n().t,
Kenneth Fullbright41057852021-12-27 16:19:37 -0600234 isBusy: true,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700235 fields: [
236 {
237 key: 'expandRow',
238 label: '',
239 tdClass: 'table-row-expand',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700240 },
241 {
242 key: 'id',
Surya Vde23ea22024-07-11 15:19:46 +0530243 label: i18n.global.t('pageInventory.table.id'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500244 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700245 },
246 {
247 key: 'health',
Surya Vde23ea22024-07-11 15:19:46 +0530248 label: i18n.global.t('pageInventory.table.health'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500249 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500250 tdClass: 'text-nowrap',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700251 },
252 {
HuyLe5d86af82023-10-09 14:32:28 +0700253 key: 'statusState',
Surya Vde23ea22024-07-11 15:19:46 +0530254 label: i18n.global.t('pageInventory.table.state'),
HuyLe5d86af82023-10-09 14:32:28 +0700255 formatter: this.dataFormatter,
256 tdClass: 'text-nowrap',
257 },
258 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530259 key: 'locationNumber',
Surya Vde23ea22024-07-11 15:19:46 +0530260 label: i18n.global.t('pageInventory.table.locationNumber'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500261 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700262 },
263 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530264 key: 'identifyLed',
Surya Vde23ea22024-07-11 15:19:46 +0530265 label: i18n.global.t('pageInventory.table.identifyLed'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500266 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500267 },
Yoshie Muranaka41770142020-06-18 14:00:55 -0700268 ],
SurenNewareba91c492020-10-27 14:18:54 +0530269 searchFilter: searchFilter,
Derick Montague602e98a2020-10-21 16:20:00 -0500270 searchTotalFilteredRows: 0,
SurenNewareba91c492020-10-27 14:18:54 +0530271 expandRowLabel: expandRowLabel,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700272 };
273 },
274 computed: {
Sukanya Pandey99010962020-07-27 21:44:47 +0530275 filteredRows() {
276 return this.searchFilter
277 ? this.searchTotalFilteredRows
278 : this.dimms.length;
279 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700280 dimms() {
281 return this.$store.getters['memory/dimms'];
Derick Montague602e98a2020-10-21 16:20:00 -0500282 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700283 },
284 created() {
285 this.$store.dispatch('memory/getDimms').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500286 // Emit initial data fetch complete to parent component
jason westoverd36ac8a2025-11-03 20:58:59 -0600287 require('@/eventBus').default.$emit('hardware-status-dimm-slot-complete');
Kenneth Fullbright41057852021-12-27 16:19:37 -0600288 this.isBusy = false;
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700289 });
290 },
291 methods: {
292 sortCompare(a, b, key) {
293 if (key === 'health') {
294 return this.sortStatus(a, b, key);
HuyLe5d86af82023-10-09 14:32:28 +0700295 } else if (key === 'statusState') {
296 return this.sortStatusState(a, b, key);
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700297 }
Yoshie Muranaka41770142020-06-18 14:00:55 -0700298 },
Sukanya Pandey99010962020-07-27 21:44:47 +0530299 onFiltered(filteredItems) {
300 this.searchTotalFilteredRows = filteredItems.length;
Derick Montague602e98a2020-10-21 16:20:00 -0500301 },
Sandeepa Singh81876782021-09-27 14:52:38 +0530302 toggleIdentifyLedValue(row) {
303 this.$store
304 .dispatch('memory/updateIdentifyLedValue', {
305 uri: row.uri,
306 identifyLed: row.identifyLed,
307 })
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530308 .then((message) => this.successToast(message))
Sandeepa Singh81876782021-09-27 14:52:38 +0530309 .catch(({ message }) => this.errorToast(message));
310 },
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +0300311 hasIdentifyLed(identifyLed) {
312 return typeof identifyLed === 'boolean';
313 },
HuyLe5d86af82023-10-09 14:32:28 +0700314 statusStateIcon(status) {
315 switch (status) {
316 case 'Enabled':
317 return 'success';
318 case 'Absent':
319 return 'warning';
320 default:
321 return '';
322 }
323 },
324 sortStatusState(a, b, key) {
325 const statusState = ['Enabled', 'Absent'];
326 return statusState.indexOf(a[key]) - statusState.indexOf(b[key]);
327 },
Derick Montague602e98a2020-10-21 16:20:00 -0500328 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700329};
330</script>