Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 1 | <template> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 2 | <page-section :section-title="$t('pageInventory.system')"> |
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 | show-empty |
| 7 | :items="systems" |
| 8 | :fields="fields" |
| 9 | :empty-text="$t('global.table.emptyMessage')" |
| 10 | > |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 11 | <!-- Expand chevron icon --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 12 | <template #cell(expandRow)="row"> |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 13 | <b-button |
| 14 | variant="link" |
| 15 | data-test-id="hardwareStatus-button-expandSystem" |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 16 | :title="expandRowLabel" |
| 17 | class="btn-icon-only" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 18 | @click="toggleRowDetails(row)" |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 19 | > |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 20 | <icon-chevron /> |
SurenNeware | 6e2cb97 | 2020-12-24 20:58:16 +0530 | [diff] [blame] | 21 | <span class="sr-only">{{ expandRowLabel }}</span> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 22 | </b-button> |
| 23 | </template> |
| 24 | |
| 25 | <!-- Health --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 26 | <template #cell(health)="{ value }"> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 27 | <status-icon :status="statusIcon(value)" /> |
| 28 | {{ value }} |
| 29 | </template> |
| 30 | |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 31 | <template #cell(locationIndicatorActive)="{ item }"> |
| 32 | <b-form-checkbox |
Sukanya Pandey | 0538896 | 2021-06-10 15:35:21 +0530 | [diff] [blame] | 33 | id="identifyLedSwitchSystem" |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 34 | v-model="item.locationIndicatorActive" |
Sukanya Pandey | 0538896 | 2021-06-10 15:35:21 +0530 | [diff] [blame] | 35 | data-test-id="inventorySystem-toggle-identifyLed" |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 36 | switch |
| 37 | @change="toggleIdentifyLedSwitch" |
| 38 | > |
Sukanya Pandey | 0538896 | 2021-06-10 15:35:21 +0530 | [diff] [blame] | 39 | <span v-if="item.locationIndicatorActive"> |
| 40 | {{ $t('global.status.on') }} |
| 41 | </span> |
| 42 | <span v-else>{{ $t('global.status.off') }}</span> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 43 | </b-form-checkbox> |
| 44 | </template> |
| 45 | |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 46 | <template #row-details="{ item }"> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 47 | <b-container fluid> |
| 48 | <b-row> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 49 | <b-col class="mt-2" sm="6"> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 50 | <dl> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 51 | <!-- Serial number --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 52 | <dt>{{ $t('pageInventory.table.serialNumber') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 53 | <dd>{{ dataFormatter(item.serialNumber) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 54 | <!-- Model --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 55 | <dt>{{ $t('pageInventory.table.model') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 56 | <dd>{{ dataFormatter(item.model) }}</dd> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 57 | <!-- Asset tag --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 58 | <dt>{{ $t('pageInventory.table.assetTag') }}:</dt> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 59 | <dd class="mb-2"> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 60 | {{ dataFormatter(item.assetTag) }} |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 61 | </dd> |
| 62 | </dl> |
| 63 | </b-col> |
| 64 | <b-col class="mt-2" sm="6"> |
| 65 | <dl> |
| 66 | <!-- Status state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 67 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 68 | <dd>{{ dataFormatter(item.statusState) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 69 | <!-- Power state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 70 | <dt>{{ $t('pageInventory.table.power') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 71 | <dd>{{ dataFormatter(item.powerState) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 72 | <!-- Health rollup --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 73 | <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 74 | <dd>{{ dataFormatter(item.healthRollup) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 75 | </dl> |
| 76 | </b-col> |
| 77 | </b-row> |
| 78 | <div class="section-divider mb-3 mt-3"></div> |
| 79 | <b-row> |
| 80 | <b-col class="mt-1" sm="6"> |
| 81 | <dl> |
| 82 | <!-- Manufacturer --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 83 | <dt>{{ $t('pageInventory.table.manufacturer') }}:</dt> |
Thang Q. Nguyen | c689936 | 2021-10-20 02:08:49 +0000 | [diff] [blame] | 84 | <dd>{{ dataFormatter(item.manufacturer) }}</dd> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 85 | <!-- Description --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 86 | <dt>{{ $t('pageInventory.table.description') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 87 | <dd>{{ dataFormatter(item.description) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 88 | <!-- Sub Model --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 89 | <dt>{{ $t('pageInventory.table.subModel') }}:</dt> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 90 | <dd> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 91 | {{ dataFormatter(item.subModel) }} |
SurenNeware | bbf896c | 2021-01-27 21:50:22 +0530 | [diff] [blame] | 92 | </dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 93 | <!-- System Type --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 94 | <dt>{{ $t('pageInventory.table.systemType') }}:</dt> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 95 | <dd> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 96 | {{ dataFormatter(item.systemType) }} |
SurenNeware | bbf896c | 2021-01-27 21:50:22 +0530 | [diff] [blame] | 97 | </dd> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 98 | </dl> |
| 99 | </b-col> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 100 | <b-col sm="6"> |
Sandeepa Singh | 1908ac9 | 2021-08-31 16:38:17 +0530 | [diff] [blame] | 101 | <!-- Memory Summary --> |
| 102 | <p class="mt-1 mb-2 h6 float-none m-0"> |
| 103 | {{ $t('pageInventory.table.memorySummary') }} |
| 104 | </p> |
| 105 | <dl class="ml-4"> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 106 | <!-- Status state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 107 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 108 | <dd>{{ dataFormatter(item.memorySummaryState) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 109 | <!-- Health --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 110 | <dt>{{ $t('pageInventory.table.health') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 111 | <dd>{{ dataFormatter(item.memorySummaryHealth) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 112 | <!-- Health Roll --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 113 | <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 114 | <dd>{{ dataFormatter(item.memorySummaryHealthRoll) }}</dd> |
Sandeepa Singh | 1908ac9 | 2021-08-31 16:38:17 +0530 | [diff] [blame] | 115 | </dl> |
| 116 | <!-- Processor Summary --> |
| 117 | <p class="mt-1 mb-2 h6 float-none m-0"> |
| 118 | {{ $t('pageInventory.table.processorSummary') }} |
| 119 | </p> |
| 120 | <dl class="ml-4"> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 121 | <!-- Status state --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 122 | <dt>{{ $t('pageInventory.table.statusState') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 123 | <dd>{{ dataFormatter(item.processorSummaryState) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 124 | <!-- Health --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 125 | <dt>{{ $t('pageInventory.table.health') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 126 | <dd>{{ dataFormatter(item.processorSummaryHealth) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 127 | <!-- Health Rollup --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 128 | <dt>{{ $t('pageInventory.table.healthRollup') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 129 | <dd>{{ dataFormatter(item.processorSummaryHealthRoll) }}</dd> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 130 | <!-- Count --> |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 131 | <dt>{{ $t('pageInventory.table.count') }}:</dt> |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 132 | <dd>{{ dataFormatter(item.processorSummaryCount) }}</dd> |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 133 | </dl> |
| 134 | </b-col> |
| 135 | </b-row> |
| 136 | </b-container> |
| 137 | </template> |
| 138 | </b-table> |
| 139 | </page-section> |
| 140 | </template> |
| 141 | |
| 142 | <script> |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 143 | import BVToastMixin from '@/components/Mixins/BVToastMixin'; |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 144 | import PageSection from '@/components/Global/PageSection'; |
| 145 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 146 | |
| 147 | import StatusIcon from '@/components/Global/StatusIcon'; |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 148 | |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 149 | import TableRowExpandMixin, { |
| 150 | expandRowLabel, |
| 151 | } from '@/components/Mixins/TableRowExpandMixin'; |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 152 | import DataFormatterMixin from '@/components/Mixins/DataFormatterMixin'; |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 153 | |
| 154 | export default { |
| 155 | components: { IconChevron, PageSection, StatusIcon }, |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 156 | mixins: [BVToastMixin, TableRowExpandMixin, DataFormatterMixin], |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 157 | data() { |
| 158 | return { |
| 159 | fields: [ |
| 160 | { |
| 161 | key: 'expandRow', |
| 162 | label: '', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 163 | tdClass: 'table-row-expand', |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 164 | }, |
| 165 | { |
| 166 | key: 'id', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 167 | label: this.$t('pageInventory.table.id'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 168 | formatter: this.dataFormatter, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 169 | }, |
| 170 | { |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 171 | key: 'hardwareType', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 172 | label: this.$t('pageInventory.table.hardwareType'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 173 | formatter: this.dataFormatter, |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 174 | tdClass: 'text-nowrap', |
| 175 | }, |
| 176 | { |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 177 | key: 'health', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 178 | label: this.$t('pageInventory.table.health'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 179 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 180 | tdClass: 'text-nowrap', |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 181 | }, |
| 182 | { |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 183 | key: 'locationNumber', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 184 | label: this.$t('pageInventory.table.locationNumber'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 185 | formatter: this.dataFormatter, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 186 | }, |
| 187 | { |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 188 | key: 'locationIndicatorActive', |
Sandeepa Singh | 7affc52 | 2021-07-06 16:29:10 +0530 | [diff] [blame] | 189 | label: this.$t('pageInventory.table.identifyLed'), |
Dixsie Wolmers | 9726f9a | 2021-09-07 15:33:16 -0500 | [diff] [blame] | 190 | formatter: this.dataFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 191 | }, |
| 192 | ], |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 193 | expandRowLabel: expandRowLabel, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 194 | }; |
| 195 | }, |
| 196 | computed: { |
| 197 | systems() { |
| 198 | return this.$store.getters['system/systems']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 199 | }, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 200 | }, |
| 201 | created() { |
| 202 | this.$store.dispatch('system/getSystem').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 203 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 204 | this.$root.$emit('hardware-status-system-complete'); |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 205 | }); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 206 | }, |
Sukanya Pandey | eb4cef3 | 2021-04-09 15:40:27 +0530 | [diff] [blame] | 207 | methods: { |
| 208 | toggleIdentifyLedSwitch(state) { |
| 209 | this.$store |
| 210 | .dispatch('system/changeIdentifyLedState', state) |
| 211 | .catch(({ message }) => this.errorToast(message)); |
| 212 | }, |
| 213 | }, |
Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 214 | }; |
| 215 | </script> |