Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 1 | <template> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 2 | <page-section :section-title="$t('pageInventory.dimmSlot')"> |
SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 3 | <b-row class="align-items-end"> |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 4 | <b-col sm="6" md="5" xl="4"> |
Dixsie Wolmers | 9b22b49 | 2020-09-07 21:26:06 -0500 | [diff] [blame] | 5 | <search |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 6 | @change-search="onChangeSearchInput" |
| 7 | @clear-search="onClearSearchInput" |
Dixsie Wolmers | 9b22b49 | 2020-09-07 21:26:06 -0500 | [diff] [blame] | 8 | /> |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 9 | </b-col> |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 10 | <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 Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 16 | </b-row> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 17 | <b-table |
| 18 | sort-icon-left |
| 19 | no-sort-reset |
Sukanya Pandey | fde429e | 2020-09-14 20:48:39 +0530 | [diff] [blame] | 20 | hover |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 21 | sort-by="health" |
SurenNeware | 5e25e28 | 2020-07-08 15:57:23 +0530 | [diff] [blame] | 22 | responsive="md" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 23 | show-empty |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 24 | :items="dimms" |
| 25 | :fields="fields" |
| 26 | :sort-desc="true" |
| 27 | :sort-compare="sortCompare" |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 28 | :filter="searchFilter" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 29 | :empty-text="$t('global.table.emptyMessage')" |
SurenNeware | 156a0e6 | 2020-08-28 19:20:03 +0530 | [diff] [blame] | 30 | :empty-filtered-text="$t('global.table.emptySearchMessage')" |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 31 | :busy="isBusy" |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 32 | @filtered="onFiltered" |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 33 | > |
| 34 | <!-- Expand chevron icon --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 35 | <template #cell(expandRow)="row"> |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 36 | <b-button |
| 37 | variant="link" |
| 38 | data-test-id="hardwareStatus-button-expandDimms" |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 39 | :title="expandRowLabel" |
| 40 | class="btn-icon-only" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 41 | @click="toggleRowDetails(row)" |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 42 | > |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 43 | <icon-chevron /> |
SurenNeware | 6e2cb97 | 2020-12-24 20:58:16 +0530 | [diff] [blame] | 44 | <span class="sr-only">{{ expandRowLabel }}</span> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 45 | </b-button> |
| 46 | </template> |
| 47 | |
| 48 | <!-- Health --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 49 | <template #cell(health)="{ value }"> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 50 | <status-icon :status="statusIcon(value)" /> |
| 51 | {{ value }} |
| 52 | </template> |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 53 | <!-- 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 Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 67 | <template #row-details="{ item }"> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 68 | <b-container fluid> |
| 69 | <b-row> |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 70 | <b-col sm="6" xl="6"> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 71 | <dl> |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 72 | <!-- 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 Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 91 | </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 Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 100 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 101 | <dd>{{ dataFormatter(item.statusState) }}</dd> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 102 | </dl> |
Sandeepa Singh | 61fdd94 | 2021-12-27 17:40:32 +0530 | [diff] [blame] | 103 | <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 Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 150 | </b-col> |
| 151 | </b-row> |
| 152 | </b-container> |
| 153 | </template> |
| 154 | </b-table> |
| 155 | </page-section> |
| 156 | </template> |
| 157 | |
| 158 | <script> |
| 159 | import PageSection from '@/components/Global/PageSection'; |
| 160 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 161 | |
| 162 | import StatusIcon from '@/components/Global/StatusIcon'; |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 163 | import TableCellCount from '@/components/Global/TableCellCount'; |
| 164 | |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 165 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 166 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 167 | import Search from '@/components/Global/Search'; |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 168 | import SearchFilterMixin, { |
| 169 | searchFilter, |
| 170 | } from '@/components/Mixins/SearchFilterMixin'; |
| 171 | import TableRowExpandMixin, { |
| 172 | expandRowLabel, |
| 173 | } from '@/components/Mixins/TableRowExpandMixin'; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 174 | |
| 175 | export default { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 176 | components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount }, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 177 | mixins: [ |
| 178 | TableRowExpandMixin, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 179 | DataFormatterMixin, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 180 | TableSortMixin, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 181 | SearchFilterMixin, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 182 | ], |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 183 | data() { |
| 184 | return { |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 185 | isBusy: true, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 186 | fields: [ |
| 187 | { |
| 188 | key: 'expandRow', |
| 189 | label: '', |
| 190 | tdClass: 'table-row-expand', |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 191 | }, |
| 192 | { |
| 193 | key: 'id', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 194 | label: this.$t('pageInventory.table.id'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 195 | formatter: this.dataFormatter, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 196 | }, |
| 197 | { |
| 198 | key: 'health', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 199 | label: this.$t('pageInventory.table.health'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 200 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 201 | tdClass: 'text-nowrap', |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 202 | }, |
| 203 | { |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 204 | key: 'locationNumber', |
| 205 | label: this.$t('pageInventory.table.locationNumber'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 206 | formatter: this.dataFormatter, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 207 | }, |
| 208 | { |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 209 | key: 'identifyLed', |
| 210 | label: this.$t('pageInventory.table.identifyLed'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 211 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 212 | }, |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 213 | ], |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 214 | searchFilter: searchFilter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 215 | searchTotalFilteredRows: 0, |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 216 | expandRowLabel: expandRowLabel, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 217 | }; |
| 218 | }, |
| 219 | computed: { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 220 | filteredRows() { |
| 221 | return this.searchFilter |
| 222 | ? this.searchTotalFilteredRows |
| 223 | : this.dimms.length; |
| 224 | }, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 225 | dimms() { |
| 226 | return this.$store.getters['memory/dimms']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 227 | }, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 228 | }, |
| 229 | created() { |
| 230 | this.$store.dispatch('memory/getDimms').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 231 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 232 | this.$root.$emit('hardware-status-dimm-slot-complete'); |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 233 | this.isBusy = false; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 234 | }); |
| 235 | }, |
| 236 | methods: { |
| 237 | sortCompare(a, b, key) { |
| 238 | if (key === 'health') { |
| 239 | return this.sortStatus(a, b, key); |
| 240 | } |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 241 | }, |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 242 | onFiltered(filteredItems) { |
| 243 | this.searchTotalFilteredRows = filteredItems.length; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 244 | }, |
Sandeepa Singh | 8187678 | 2021-09-27 14:52:38 +0530 | [diff] [blame] | 245 | 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 Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 253 | }, |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 254 | }; |
| 255 | </script> |