blob: 6599481020455f4689f9a2654068454472da96ad [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>
Sandeepa Singh81876782021-09-27 14:52:38 +053053 <!-- Toggle identify LED -->
54 <template #cell(identifyLed)="row">
55 <b-form-checkbox
56 v-model="row.item.identifyLed"
57 name="switch"
58 switch
59 @change="toggleIdentifyLedValue(row.item)"
60 >
61 <span v-if="row.item.identifyLed">
62 {{ $t('global.status.on') }}
63 </span>
64 <span v-else> {{ $t('global.status.off') }} </span>
65 </b-form-checkbox>
66 </template>
Derick Montague602e98a2020-10-21 16:20:00 -050067 <template #row-details="{ item }">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070068 <b-container fluid>
69 <b-row>
Sandeepa Singh81876782021-09-27 14:52:38 +053070 <b-col sm="6" xl="6">
Yoshie Muranakae24b17d2020-06-08 11:03:11 -070071 <dl>
Sandeepa Singh81876782021-09-27 14:52:38 +053072 <!-- Part Number -->
73 <dt>{{ $t('pageInventory.table.partNumber') }}:</dt>
74 <dd>{{ dataFormatter(item.partNumber) }}</dd>
75 </dl>
76 <dl>
77 <!-- Serial Number -->
78 <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt>
79 <dd>{{ dataFormatter(item.serialNumber) }}</dd>
80 </dl>
81 <dl>
82 <!-- Spare Part Number -->
83 <dt>{{ $t('pageInventory.table.sparePartNumber') }}:</dt>
84 <dd>{{ dataFormatter(item.sparePartNumber) }}</dd>
85 </dl>
86 <dl>
87 <!-- Model -->
88 <dt>{{ $t('pageInventory.table.model') }}:</dt>
89 <dd>{{ dataFormatter(item.model) }}</dd>
90 </dl>
Sandeepa Singh81876782021-09-27 14:52:38 +053091 </b-col>
92 <b-col sm="6" xl="6">
93 <dl>
94 <!-- Memory Size in kb -->
95 <dt>{{ $t('pageInventory.table.memorySize') }}:</dt>
96 <dd>{{ dataFormatter(item.memorySize) }} KB</dd>
97 </dl>
98 <dl>
99 <!-- Status-->
Sandeepa Singh7affc522021-07-06 16:29:10 +0530100 <dt>{{ $t('pageInventory.table.statusState') }}:</dt>
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500101 <dd>{{ dataFormatter(item.statusState) }}</dd>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700102 </dl>
Sandeepa Singh61fdd942021-12-27 17:40:32 +0530103 <dl>
104 <!-- Enabled-->
105 <dt>{{ $t('pageInventory.table.enabled') }}:</dt>
106 <dd>{{ dataFormatter(item.enabled) }}</dd>
107 </dl>
108 </b-col>
109 </b-row>
110 <div class="section-divider mb-3 mt-3"></div>
111 <b-row>
112 <b-col sm="6" xl="6">
113 <dl>
114 <!-- Description -->
115 <dt>{{ $t('pageInventory.table.description') }}:</dt>
116 <dd>{{ dataFormatter(item.description) }}</dd>
117 </dl>
118 <dl>
119 <!-- Memory Type -->
120 <dt>{{ $t('pageInventory.table.memoryType') }}:</dt>
121 <dd>{{ dataFormatter(item.memoryType) }}</dd>
122 </dl>
123 <dl>
124 <!-- Base Module Type -->
125 <dt>{{ $t('pageInventory.table.baseModuleType') }}:</dt>
126 <dd>{{ dataFormatter(item.baseModuleType) }}</dd>
127 </dl>
128 <dl>
129 <!-- Capacity MiB -->
130 <dt>{{ $t('pageInventory.table.capacityMiB') }}:</dt>
131 <dd>{{ dataFormatter(item.capacityMiB) }}</dd>
132 </dl>
133 </b-col>
134 <b-col sm="6" xl="6">
135 <dl>
136 <!-- Bus Width Bits -->
137 <dt>{{ $t('pageInventory.table.busWidthBits') }}:</dt>
138 <dd>{{ dataFormatter(item.busWidthBits) }}</dd>
139 </dl>
140 <dl>
141 <!-- Data Width Bits -->
142 <dt>{{ $t('pageInventory.table.dataWidthBits') }}:</dt>
143 <dd>{{ dataFormatter(item.dataWidthBits) }}</dd>
144 </dl>
145 <dl>
146 <!-- Operating Speed Mhz -->
147 <dt>{{ $t('pageInventory.table.operatingSpeedMhz') }}:</dt>
148 <dd>{{ dataFormatter(item.operatingSpeedMhz) }} MHz</dd>
149 </dl>
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700150 </b-col>
151 </b-row>
152 </b-container>
153 </template>
154 </b-table>
155 </page-section>
156</template>
157
158<script>
159import PageSection from '@/components/Global/PageSection';
160import IconChevron from '@carbon/icons-vue/es/chevron--down/20';
161
162import StatusIcon from '@/components/Global/StatusIcon';
Sukanya Pandey99010962020-07-27 21:44:47 +0530163import TableCellCount from '@/components/Global/TableCellCount';
164
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500165import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700166import TableSortMixin from '@/components/Mixins/TableSortMixin';
Yoshie Muranaka41770142020-06-18 14:00:55 -0700167import Search from '@/components/Global/Search';
SurenNewareba91c492020-10-27 14:18:54 +0530168import SearchFilterMixin, {
169 searchFilter,
170} from '@/components/Mixins/SearchFilterMixin';
171import TableRowExpandMixin, {
172 expandRowLabel,
173} from '@/components/Mixins/TableRowExpandMixin';
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700174
175export default {
Sukanya Pandey99010962020-07-27 21:44:47 +0530176 components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount },
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500177 mixins: [
178 TableRowExpandMixin,
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500179 DataFormatterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500180 TableSortMixin,
Derick Montague602e98a2020-10-21 16:20:00 -0500181 SearchFilterMixin,
Dixsie Wolmersb53e0862020-09-08 14:13:38 -0500182 ],
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700183 data() {
184 return {
Kenneth Fullbright41057852021-12-27 16:19:37 -0600185 isBusy: true,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700186 fields: [
187 {
188 key: 'expandRow',
189 label: '',
190 tdClass: 'table-row-expand',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700191 },
192 {
193 key: 'id',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530194 label: this.$t('pageInventory.table.id'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500195 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700196 },
197 {
198 key: 'health',
Sandeepa Singh7affc522021-07-06 16:29:10 +0530199 label: this.$t('pageInventory.table.health'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500200 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500201 tdClass: 'text-nowrap',
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700202 },
203 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530204 key: 'locationNumber',
205 label: this.$t('pageInventory.table.locationNumber'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500206 formatter: this.dataFormatter,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700207 },
208 {
Sandeepa Singh81876782021-09-27 14:52:38 +0530209 key: 'identifyLed',
210 label: this.$t('pageInventory.table.identifyLed'),
Dixsie Wolmers9726f9a2021-09-07 15:33:16 -0500211 formatter: this.dataFormatter,
Derick Montague602e98a2020-10-21 16:20:00 -0500212 },
Yoshie Muranaka41770142020-06-18 14:00:55 -0700213 ],
SurenNewareba91c492020-10-27 14:18:54 +0530214 searchFilter: searchFilter,
Derick Montague602e98a2020-10-21 16:20:00 -0500215 searchTotalFilteredRows: 0,
SurenNewareba91c492020-10-27 14:18:54 +0530216 expandRowLabel: expandRowLabel,
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700217 };
218 },
219 computed: {
Sukanya Pandey99010962020-07-27 21:44:47 +0530220 filteredRows() {
221 return this.searchFilter
222 ? this.searchTotalFilteredRows
223 : this.dimms.length;
224 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700225 dimms() {
226 return this.$store.getters['memory/dimms'];
Derick Montague602e98a2020-10-21 16:20:00 -0500227 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700228 },
229 created() {
230 this.$store.dispatch('memory/getDimms').finally(() => {
Gunnar Millsdefc9e22020-07-07 20:29:03 -0500231 // Emit initial data fetch complete to parent component
Sukanya Pandeyedb8a772020-10-29 11:33:42 +0530232 this.$root.$emit('hardware-status-dimm-slot-complete');
Kenneth Fullbright41057852021-12-27 16:19:37 -0600233 this.isBusy = false;
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700234 });
235 },
236 methods: {
237 sortCompare(a, b, key) {
238 if (key === 'health') {
239 return this.sortStatus(a, b, key);
240 }
Yoshie Muranaka41770142020-06-18 14:00:55 -0700241 },
Sukanya Pandey99010962020-07-27 21:44:47 +0530242 onFiltered(filteredItems) {
243 this.searchTotalFilteredRows = filteredItems.length;
Derick Montague602e98a2020-10-21 16:20:00 -0500244 },
Sandeepa Singh81876782021-09-27 14:52:38 +0530245 toggleIdentifyLedValue(row) {
246 this.$store
247 .dispatch('memory/updateIdentifyLedValue', {
248 uri: row.uri,
249 identifyLed: row.identifyLed,
250 })
251 .catch(({ message }) => this.errorToast(message));
252 },
Derick Montague602e98a2020-10-21 16:20:00 -0500253 },
Yoshie Muranakae24b17d2020-06-08 11:03:11 -0700254};
255</script>