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