Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 1 | <template> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 2 | <page-section :section-title="$t('pageInventory.chassis')"> |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 3 | <b-table |
| 4 | responsive="md" |
Sukanya Pandey | fde429e | 2020-09-14 20:48:39 +0530 | [diff] [blame] | 5 | hover |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 6 | :items="chassis" |
| 7 | :fields="fields" |
| 8 | show-empty |
| 9 | :empty-text="$t('global.table.emptyMessage')" |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 10 | :busy="isBusy" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 11 | > |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 12 | <!-- Expand chevron icon --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 13 | <template #cell(expandRow)="row"> |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 14 | <b-button |
| 15 | variant="link" |
| 16 | data-test-id="hardwareStatus-button-expandChassis" |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 17 | :title="expandRowLabel" |
| 18 | class="btn-icon-only" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 19 | @click="toggleRowDetails(row)" |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 20 | > |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 21 | <icon-chevron /> |
SurenNeware | 6e2cb97 | 2020-12-24 20:58:16 +0530 | [diff] [blame] | 22 | <span class="sr-only">{{ expandRowLabel }}</span> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 23 | </b-button> |
| 24 | </template> |
| 25 | |
| 26 | <!-- Health --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 27 | <template #cell(health)="{ value }"> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 28 | <status-icon :status="statusIcon(value)" /> |
| 29 | {{ value }} |
| 30 | </template> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 31 | <!-- Toggle identify LED --> |
| 32 | <template #cell(identifyLed)="row"> |
| 33 | <b-form-checkbox |
| 34 | v-if="hasIdentifyLed(row.item.identifyLed)" |
| 35 | v-model="row.item.identifyLed" |
| 36 | name="switch" |
| 37 | switch |
| 38 | @change="toggleIdentifyLedValue(row.item)" |
| 39 | > |
| 40 | <span v-if="row.item.identifyLed"> |
| 41 | {{ $t('global.status.on') }} |
| 42 | </span> |
| 43 | <span v-else> {{ $t('global.status.off') }} </span> |
| 44 | </b-form-checkbox> |
| 45 | <div v-else>--</div> |
| 46 | </template> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 47 | <template #row-details="{ item }"> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 48 | <b-container fluid> |
| 49 | <b-row> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 50 | <b-col class="mt-2" sm="6" xl="6"> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 51 | <dl> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 52 | <!-- Name --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 53 | <dt>{{ $t('pageInventory.table.name') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 54 | <dd>{{ dataFormatter(item.name) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 55 | <!-- Part number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 56 | <dt>{{ $t('pageInventory.table.partNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 57 | <dd>{{ dataFormatter(item.partNumber) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 58 | <!-- Serial Number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 59 | <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 60 | <dd>{{ dataFormatter(item.serialNumber) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 61 | <!-- Model --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 62 | <dt>{{ $t('pageInventory.table.model') }}:</dt> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 63 | <dd class="mb-2"> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 64 | {{ dataFormatter(item.model) }} |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 65 | </dd> |
| 66 | <!-- Asset tag --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 67 | <dt>{{ $t('pageInventory.table.assetTag') }}:</dt> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 68 | <dd class="mb-2"> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 69 | {{ dataFormatter(item.assetTag) }} |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 70 | </dd> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 71 | </dl> |
| 72 | </b-col> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 73 | <b-col class="mt-2" sm="6" xl="6"> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 74 | <dl> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 75 | <!-- Status state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 76 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 77 | <dd>{{ dataFormatter(item.statusState) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 78 | <!-- Power state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 79 | <dt>{{ $t('pageInventory.table.power') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 80 | <dd>{{ dataFormatter(item.power) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 81 | <!-- Health rollup --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 82 | <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 83 | <dd>{{ dataFormatter(item.healthRollup) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 84 | </dl> |
| 85 | </b-col> |
| 86 | </b-row> |
| 87 | <div class="section-divider mb-3 mt-3"></div> |
| 88 | <b-row> |
| 89 | <b-col class="mt-2" sm="6" xl="6"> |
| 90 | <dl> |
| 91 | <!-- Manufacturer --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 92 | <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 93 | <dd>{{ dataFormatter(item.manufacturer) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 94 | <!-- Chassis Type --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 95 | <dt>{{ $t('pageInventory.table.chassisType') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 96 | <dd>{{ dataFormatter(item.chassisType) }}</dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 97 | </dl> |
| 98 | </b-col> |
| 99 | <b-col class="mt-2" sm="6" xl="6"> |
| 100 | <dl> |
| 101 | <!-- Min power --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 102 | <dt>{{ $t('pageInventory.table.minPowerWatts') }}:</dt> |
Glukhov Mikhail | d0b078f | 2022-12-24 12:16:53 +0300 | [diff] [blame] | 103 | <dd> |
| 104 | {{ dataFormatter(item.minPowerWatts) }} |
| 105 | {{ $t('unit.W') }} |
| 106 | </dd> |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 107 | <!-- Max power --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 108 | <dt>{{ $t('pageInventory.table.maxPowerWatts') }}:</dt> |
Glukhov Mikhail | d0b078f | 2022-12-24 12:16:53 +0300 | [diff] [blame] | 109 | <dd> |
| 110 | {{ dataFormatter(item.maxPowerWatts) }} |
| 111 | {{ $t('unit.W') }} |
| 112 | </dd> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 113 | </dl> |
| 114 | </b-col> |
| 115 | </b-row> |
| 116 | </b-container> |
| 117 | </template> |
| 118 | </b-table> |
| 119 | </page-section> |
| 120 | </template> |
| 121 | |
| 122 | <script> |
| 123 | import PageSection from '@/components/Global/PageSection'; |
| 124 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 125 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 126 | import StatusIcon from '@/components/Global/StatusIcon'; |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 127 | |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 128 | import TableRowExpandMixin, { |
| 129 | expandRowLabel, |
| 130 | } from '@/components/Mixins/TableRowExpandMixin'; |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 131 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 132 | |
| 133 | export default { |
| 134 | components: { IconChevron, PageSection, StatusIcon }, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 135 | mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin], |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 136 | data() { |
| 137 | return { |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 138 | isBusy: true, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 139 | fields: [ |
| 140 | { |
| 141 | key: 'expandRow', |
| 142 | label: '', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 143 | tdClass: 'table-row-expand', |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 144 | }, |
| 145 | { |
| 146 | key: 'id', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 147 | label: this.$t('pageInventory.table.id'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 148 | formatter: this.dataFormatter, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 149 | }, |
| 150 | { |
| 151 | key: 'health', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 152 | label: this.$t('pageInventory.table.health'), |
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 | tdClass: 'text-nowrap', |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 155 | }, |
| 156 | { |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 157 | key: 'locationNumber', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 158 | label: this.$t('pageInventory.table.locationNumber'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 159 | formatter: this.dataFormatter, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 160 | }, |
| 161 | { |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 162 | key: 'identifyLed', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 163 | label: this.$t('pageInventory.table.identifyLed'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 164 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 165 | }, |
| 166 | ], |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 167 | expandRowLabel: expandRowLabel, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 168 | }; |
| 169 | }, |
| 170 | computed: { |
| 171 | chassis() { |
| 172 | return this.$store.getters['chassis/chassis']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 173 | }, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 174 | }, |
| 175 | created() { |
| 176 | this.$store.dispatch('chassis/getChassisInfo').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 177 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 178 | this.$root.$emit('hardware-status-chassis-complete'); |
Kenneth Fullbright | 4105785 | 2021-12-27 16:19:37 -0600 | [diff] [blame] | 179 | this.isBusy = false; |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 180 | }); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 181 | }, |
Sandeepa Singh | 240c056 | 2021-05-06 21:59:20 +0530 | [diff] [blame] | 182 | methods: { |
| 183 | toggleIdentifyLedValue(row) { |
| 184 | this.$store |
| 185 | .dispatch('chassis/updateIdentifyLedValue', { |
| 186 | uri: row.uri, |
| 187 | identifyLed: row.identifyLed, |
| 188 | }) |
| 189 | .catch(({ message }) => this.errorToast(message)); |
| 190 | }, |
| 191 | // TO DO: Remove this method when the LocationIndicatorActive is added from backend. |
| 192 | hasIdentifyLed(identifyLed) { |
| 193 | return typeof identifyLed === 'boolean'; |
| 194 | }, |
| 195 | }, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 196 | }; |
| 197 | </script> |