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