Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 1 | <template> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 2 | <page-section :section-title="$t('pageInventory.powerSupplies')"> |
SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 3 | <b-row class="align-items-end"> |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -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 | 130b1b6 | 2020-06-18 14:29:57 -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="powerSupplies.length" |
| 14 | ></table-cell-count> |
| 15 | </b-col> |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -0700 | [diff] [blame] | 16 | </b-row> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -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 |
SurenNeware | 5e25e28 | 2020-07-08 15:57:23 +0530 | [diff] [blame] | 21 | responsive="md" |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 22 | sort-by="health" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 23 | show-empty |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 24 | :items="powerSupplies" |
| 25 | :fields="fields" |
| 26 | :sort-desc="true" |
| 27 | :sort-compare="sortCompare" |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -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 | 5918b48 | 2020-06-08 08:18:23 -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-expandPowerSupplies" |
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 | 5918b48 | 2020-06-08 08:18:23 -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 | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 50 | <status-icon :status="statusIcon(value)" /> |
| 51 | {{ value }} |
| 52 | </template> |
| 53 | |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 54 | <template #row-details="{ item }"> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 55 | <b-container fluid> |
| 56 | <b-row> |
| 57 | <b-col sm="6" xl="4"> |
| 58 | <dl> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 59 | <!-- Name --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 60 | <dt>{{ $t('pageInventory.table.name') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 61 | <dd>{{ dataFormatter(item.name) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 62 | <!-- Part number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 63 | <dt>{{ $t('pageInventory.table.partNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 64 | <dd>{{ dataFormatter(item.partNumber) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 65 | <!-- Serial number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 66 | <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 67 | <dd>{{ dataFormatter(item.serialNumber) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 68 | <!-- Spare part number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 69 | <dt>{{ $t('pageInventory.table.sparePartNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 70 | <dd>{{ dataFormatter(item.sparePartNumber) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 71 | <!-- Model --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 72 | <dt>{{ $t('pageInventory.table.model') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 73 | <dd>{{ dataFormatter(item.model) }}</dd> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 74 | </dl> |
| 75 | </b-col> |
| 76 | <b-col sm="6" xl="4"> |
| 77 | <dl> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 78 | <!-- Status state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 79 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 80 | <dd>{{ dataFormatter(item.statusState) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 81 | <!-- Status Health rollup state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 82 | <dt>{{ $t('pageInventory.table.statusHealthRollup') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 83 | <dd>{{ dataFormatter(item.statusHealth) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 84 | <!-- Efficiency percent --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 85 | <dt>{{ $t('pageInventory.table.efficiencyPercent') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 86 | <dd>{{ dataFormatter(item.efficiencyPercent) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 87 | <!-- Power input watts --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 88 | <dt>{{ $t('pageInventory.table.powerInputWatts') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 89 | <dd>{{ dataFormatter(item.powerInputWatts) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 90 | </dl> |
| 91 | </b-col> |
| 92 | </b-row> |
| 93 | <div class="section-divider mb-3 mt-3"></div> |
| 94 | <b-row> |
| 95 | <b-col sm="6" xl="4"> |
| 96 | <dl> |
| 97 | <!-- Manufacturer --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 98 | <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 99 | <dd>{{ dataFormatter(item.manufacturer) }}</dd> |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 100 | </dl> |
| 101 | </b-col> |
| 102 | <b-col sm="6" xl="4"> |
| 103 | <dl> |
| 104 | <!-- Firmware version --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 105 | <dt>{{ $t('pageInventory.table.firmwareVersion') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 106 | <dd>{{ dataFormatter(item.firmwareVersion) }}</dd> |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 107 | </dl> |
| 108 | </b-col> |
| 109 | </b-row> |
| 110 | </b-container> |
| 111 | </template> |
| 112 | </b-table> |
| 113 | </page-section> |
| 114 | </template> |
| 115 | |
| 116 | <script> |
| 117 | import PageSection from '@/components/Global/PageSection'; |
| 118 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 119 | |
| 120 | import StatusIcon from '@/components/Global/StatusIcon'; |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 121 | import TableCellCount from '@/components/Global/TableCellCount'; |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 122 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 123 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -0700 | [diff] [blame] | 124 | import Search from '@/components/Global/Search'; |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 125 | import SearchFilterMixin, { |
| 126 | searchFilter, |
| 127 | } from '@/components/Mixins/SearchFilterMixin'; |
| 128 | import TableRowExpandMixin, { |
| 129 | expandRowLabel, |
| 130 | } from '@/components/Mixins/TableRowExpandMixin'; |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 131 | |
| 132 | export default { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 133 | components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount }, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 134 | mixins: [ |
| 135 | TableRowExpandMixin, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 136 | DataFormatterMixin, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 137 | TableSortMixin, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 138 | SearchFilterMixin, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 139 | ], |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 140 | data() { |
| 141 | return { |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame^] | 142 | isBusy: true, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 143 | fields: [ |
| 144 | { |
| 145 | key: 'expandRow', |
| 146 | label: '', |
| 147 | tdClass: 'table-row-expand', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 148 | sortable: false, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 149 | }, |
| 150 | { |
| 151 | key: 'id', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 152 | label: this.$t('pageInventory.table.id'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 153 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 154 | sortable: true, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 155 | }, |
| 156 | { |
| 157 | key: 'health', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 158 | label: this.$t('pageInventory.table.health'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 159 | formatter: this.dataFormatter, |
Dixsie Wolmers | a04d46f | 2020-10-22 06:34:56 -0500 | [diff] [blame] | 160 | sortable: true, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 161 | tdClass: 'text-nowrap', |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 162 | }, |
| 163 | { |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 164 | key: 'locationNumber', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 165 | label: this.$t('pageInventory.table.locationNumber'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 166 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 167 | sortable: true, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 168 | }, |
| 169 | { |
Dixsie Wolmers | 6b8aee9 | 2021-05-14 11:14:33 -0500 | [diff] [blame] | 170 | key: 'identifyLed', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 171 | label: this.$t('pageInventory.table.identifyLed'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 172 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 173 | }, |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -0700 | [diff] [blame] | 174 | ], |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 175 | searchFilter: searchFilter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 176 | searchTotalFilteredRows: 0, |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 177 | expandRowLabel: expandRowLabel, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 178 | }; |
| 179 | }, |
| 180 | computed: { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 181 | filteredRows() { |
| 182 | return this.searchFilter |
| 183 | ? this.searchTotalFilteredRows |
| 184 | : this.powerSupplies.length; |
| 185 | }, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 186 | powerSupplies() { |
| 187 | return this.$store.getters['powerSupply/powerSupplies']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 188 | }, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 189 | }, |
| 190 | created() { |
MichalX Szopinski | dca9b0a | 2021-05-07 13:14:50 +0200 | [diff] [blame] | 191 | this.$store.dispatch('powerSupply/getAllPowerSupplies').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 192 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 193 | this.$root.$emit('hardware-status-power-supplies-complete'); |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame^] | 194 | this.isBusy = false; |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 195 | }); |
| 196 | }, |
| 197 | methods: { |
| 198 | sortCompare(a, b, key) { |
| 199 | if (key === 'health') { |
| 200 | return this.sortStatus(a, b, key); |
| 201 | } |
Yoshie Muranaka | 130b1b6 | 2020-06-18 14:29:57 -0700 | [diff] [blame] | 202 | }, |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 203 | onFiltered(filteredItems) { |
| 204 | this.searchTotalFilteredRows = filteredItems.length; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 205 | }, |
| 206 | }, |
Yoshie Muranaka | 5918b48 | 2020-06-08 08:18:23 -0700 | [diff] [blame] | 207 | }; |
| 208 | </script> |