blob: f3db133eb86ac61498665c4216a6f69195f90658 [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
19 no-sort-reset
Sukanya Pandeyfde429e2020-09-14 20:48:39 +053020 hover
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070021 sort-by="health"
SurenNeware5e25e282020-07-08 15:57:23 +053022 responsive="md"
SurenNeware307382e2020-07-27 20:45:14 +053023 show-empty
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070024 :items="dimms"
25 :fields="fields"
26 :sort-desc="true"
27 :sort-compare="sortCompare"
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"
38 data-test-id="hardwareStatus-button-expandDimms"
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060039 :title="expandRowLabel"
40 class="btn-icon-only"
Dixsie Wolmersb53e0862020-09-08 14:13:38 -050041 @click="toggleRowDetails(row)"
Dixsie Wolmers83133762020-07-15 08:45:19 -050042 >
Dixsie Wolmers30f11f82020-11-10 16:07:56 -060043 <icon-chevron />
SurenNeware6e2cb972020-12-24 20:58:16 +053044 <span class="sr-only">{{ expandRowLabel }}</span>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070045 </b-button>
46 </template>
47
48 <!-- Health -->
Derick Montague602e98a2020-10-21 16:20:00 -050049 <template #cell(health)="{ value }">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070050 <status-icon :status="statusIcon(value)" />
51 {{ value }}
52 </template>
HuyLe5d86af82023-10-09 14:32:28 +070053
54 <!-- StatusState -->
55 <template #cell(statusState)="{ value }">
56 <status-icon :status="statusStateIcon(value)" />
57 {{ value }}
58 </template>
59
Sandeepa Singh81876782021-09-27 14:52:38 +053060 <!-- Toggle identify LED -->
61 <template #cell(identifyLed)="row">
62 <b-form-checkbox
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +030063 v-if="hasIdentifyLed(row.item.identifyLed)"
Sandeepa Singh81876782021-09-27 14:52:38 +053064 v-model="row.item.identifyLed"
65 name="switch"
66 switch
67 @change="toggleIdentifyLedValue(row.item)"
68 >
69 <span v-if="row.item.identifyLed">
70 {{ $t('global.status.on') }}
71 </span>
72 <span v-else> {{ $t('global.status.off') }} </span>
73 </b-form-checkbox>
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +030074 <div v-else>--</div>
Sandeepa Singh81876782021-09-27 14:52:38 +053075 </template>
Derick Montague602e98a2020-10-21 16:20:00 -050076 <template #row-details="{ item }">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070077 <b-container fluid>
78 <b-row>
Sandeepa Singh81876782021-09-27 14:52:38 +053079 <b-col sm="6" xl="6">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070080 <dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -070081 <!-- Manufacturer -->
82 <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt>
83 <dd>{{ dataFormatter(item.manufacturer) }}</dd>
84 </dl>
85 <dl>
Sandeepa Singh81876782021-09-27 14:52:38 +053086 <!-- Part Number -->
87 <dt>{{ $t('pageInventory.table.partNumber') }}:</dt>
88 <dd>{{ dataFormatter(item.partNumber) }}</dd>
89 </dl>
90 <dl>
91 <!-- Serial Number -->
92 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
93 <dd>{{ dataFormatter(item.serialNumber) }}</dd>
94 </dl>
95 <dl>
96 <!-- Spare Part Number -->
97 <dt>{{ $t('pageInventory.table.sparePartNumber') }}:</dt>
98 <dd>{{ dataFormatter(item.sparePartNumber) }}</dd>
99 </dl>
100 <dl>
101 <!-- Model -->
102 <dt>{{ $t('pageInventory.table.model') }}:</dt>
103 <dd>{{ dataFormatter(item.model) }}</dd>
104 </dl>
Sandeepa Singh81876782021-09-27 14:52:38 +0530105 </b-col>
106 <b-col sm="6" xl="6">
107 <dl>
Glukhov Mikhailba60e9c2022-11-21 10:21:51 +0300108 <!-- Capacity MiB -->
109 <dt>{{ $t('pageInventory.table.capacityMiB') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300110 <dd>
111 {{ dataFormatter(item.capacityMiB) }}
112 {{ $t('unit.MiB') }}
113 </dd>
Sandeepa Singh81876782021-09-27 14:52:38 +0530114 </dl>
115 <dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -0700116 <!-- Rank Count -->
117 <dt>{{ $t('pageInventory.table.rankCount') }}:</dt>
118 <dd>{{ dataFormatter(item.rankCount) }}</dd>
119 </dl>
120 <dl>
Sandeepa Singh81876782021-09-27 14:52:38 +0530121 <!-- Status-->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530122 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500123 <dd>{{ dataFormatter(item.statusState) }}</dd>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700124 </dl>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530125 <dl>
126 <!-- Enabled-->
127 <dt>{{ $t('pageInventory.table.enabled') }}:</dt>
128 <dd>{{ dataFormatter(item.enabled) }}</dd>
129 </dl>
130 </b-col>
131 </b-row>
132 <div class="section-divider mb-3 mt-3"></div>
133 <b-row>
134 <b-col sm="6" xl="6">
135 <dl>
136 <!-- Description -->
137 <dt>{{ $t('pageInventory.table.description') }}:</dt>
138 <dd>{{ dataFormatter(item.description) }}</dd>
139 </dl>
140 <dl>
141 <!-- Memory Type -->
142 <dt>{{ $t('pageInventory.table.memoryType') }}:</dt>
143 <dd>{{ dataFormatter(item.memoryType) }}</dd>
144 </dl>
145 <dl>
146 <!-- Base Module Type -->
147 <dt>{{ $t('pageInventory.table.baseModuleType') }}:</dt>
148 <dd>{{ dataFormatter(item.baseModuleType) }}</dd>
149 </dl>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530150 </b-col>
151 <b-col sm="6" xl="6">
152 <dl>
153 <!-- Bus Width Bits -->
154 <dt>{{ $t('pageInventory.table.busWidthBits') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300155 <dd>
156 {{ dataFormatter(item.busWidthBits) }}
157 {{ $t('unit.bit') }}
158 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530159 </dl>
160 <dl>
161 <!-- Data Width Bits -->
162 <dt>{{ $t('pageInventory.table.dataWidthBits') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300163 <dd>
164 {{ dataFormatter(item.dataWidthBits) }}
165 {{ $t('unit.bit') }}
166 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530167 </dl>
168 <dl>
169 <!-- Operating Speed Mhz -->
170 <dt>{{ $t('pageInventory.table.operatingSpeedMhz') }}:</dt>
Glukhov Mikhaild0b078f2022-12-24 12:16:53 +0300171 <dd>
172 {{ dataFormatter(item.operatingSpeedMhz) }}
173 {{ $t('unit.MHz') }}
174 </dd>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530175 </dl>
Jason M. Billsaf76e2b2023-06-15 08:20:34 -0700176 <dl>
177 <!-- Error Correction -->
178 <dt>{{ $t('pageInventory.table.errorCorrection') }}:</dt>
179 <dd>{{ dataFormatter(item.errorCorrection) }}</dd>
180 </dl>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700181 </b-col>
182 </b-row>
183 </b-container>
184 </template>
185 </b-table>
186 </page-section>
187</template>
188
189<script>
190import PageSection from '@/components/Global/PageSection';
191import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
192
193import StatusIcon from '@/components/Global/StatusIcon';
Sukanya Pandey99010962020-07-27 21:44:47 +0530194import TableCellCount from '@/components/Global/TableCellCount';
195
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530196import BVToastMixin from '@/components/Mixins/BVToastMixin';
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500197import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700198import TableSortMixin from '@/components/Mixins/TableSortMixin';
Yoshie Muranaka41770142020-06-18 14:00:55 -0700199import Search from '@/components/Global/Search';
SurenNewareba91c492020-10-27 14:18:54 +0530200import SearchFilterMixin, {
201 searchFilter,
202} from '@/components/Mixins/SearchFilterMixin';
203import TableRowExpandMixin, {
204 expandRowLabel,
205} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700206
207export default {
Sukanya Pandey99010962020-07-27 21:44:47 +0530208 components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500209 mixins: [
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530210 BVToastMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500211 TableRowExpandMixin,
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500212 DataFormatterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500213 TableSortMixin,
Derick Montague602e98a2020-10-21 16:20:00 -0500214 SearchFilterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500215 ],
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700216 data() {
217 return {
Kenneth Fullbright41057852021-12-27 16:19:37 -0600218 isBusy: true,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700219 fields: [
220 {
221 key: 'expandRow',
222 label: '',
223 tdClass: 'table-row-expand',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700224 },
225 {
226 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530227 label: this.$t('pageInventory.table.id'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500228 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700229 },
230 {
231 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530232 label: this.$t('pageInventory.table.health'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500233 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500234 tdClass: 'text-nowrap',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700235 },
236 {
HuyLe5d86af82023-10-09 14:32:28 +0700237 key: 'statusState',
238 label: this.$t('pageInventory.table.state'),
239 formatter: this.dataFormatter,
240 tdClass: 'text-nowrap',
241 },
242 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530243 key: 'locationNumber',
244 label: this.$t('pageInventory.table.locationNumber'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500245 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700246 },
247 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530248 key: 'identifyLed',
249 label: this.$t('pageInventory.table.identifyLed'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500250 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500251 },
Yoshie Muranaka41770142020-06-18 14:00:55 -0700252 ],
SurenNewareba91c492020-10-27 14:18:54 +0530253 searchFilter: searchFilter,
Derick Montague602e98a2020-10-21 16:20:00 -0500254 searchTotalFilteredRows: 0,
SurenNewareba91c492020-10-27 14:18:54 +0530255 expandRowLabel: expandRowLabel,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700256 };
257 },
258 computed: {
Sukanya Pandey99010962020-07-27 21:44:47 +0530259 filteredRows() {
260 return this.searchFilter
261 ? this.searchTotalFilteredRows
262 : this.dimms.length;
263 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700264 dimms() {
265 return this.$store.getters['memory/dimms'];
Derick Montague602e98a2020-10-21 16:20:00 -0500266 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700267 },
268 created() {
269 this.$store.dispatch('memory/getDimms').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500270 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530271 this.$root.$emit('hardware-status-dimm-slot-complete');
Kenneth Fullbright41057852021-12-27 16:19:37 -0600272 this.isBusy = false;
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700273 });
274 },
275 methods: {
276 sortCompare(a, b, key) {
277 if (key === 'health') {
278 return this.sortStatus(a, b, key);
HuyLe5d86af82023-10-09 14:32:28 +0700279 } else if (key === 'statusState') {
280 return this.sortStatusState(a, b, key);
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700281 }
Yoshie Muranaka41770142020-06-18 14:00:55 -0700282 },
Sukanya Pandey99010962020-07-27 21:44:47 +0530283 onFiltered(filteredItems) {
284 this.searchTotalFilteredRows = filteredItems.length;
Derick Montague602e98a2020-10-21 16:20:00 -0500285 },
Sandeepa Singh81876782021-09-27 14:52:38 +0530286 toggleIdentifyLedValue(row) {
287 this.$store
288 .dispatch('memory/updateIdentifyLedValue', {
289 uri: row.uri,
290 identifyLed: row.identifyLed,
291 })
Nikhil Ashokaf11a1902024-05-09 15:17:44 +0530292 .then((message) => this.successToast(message))
Sandeepa Singh81876782021-09-27 14:52:38 +0530293 .catch(({ message }) => this.errorToast(message));
294 },
Konstantin Aladyshevb24a4832022-11-02 17:32:04 +0300295 hasIdentifyLed(identifyLed) {
296 return typeof identifyLed === 'boolean';
297 },
HuyLe5d86af82023-10-09 14:32:28 +0700298 statusStateIcon(status) {
299 switch (status) {
300 case 'Enabled':
301 return 'success';
302 case 'Absent':
303 return 'warning';
304 default:
305 return '';
306 }
307 },
308 sortStatusState(a, b, key) {
309 const statusState = ['Enabled', 'Absent'];
310 return statusState.indexOf(a[key]) - statusState.indexOf(b[key]);
311 },
Derick Montague602e98a2020-10-21 16:20:00 -0500312 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700313};
314</script>