Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.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')" |
| 10 | > |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -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-expandChassis" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 16 | :aria-label="expandRowLabel" |
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 /> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -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 | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 27 | <status-icon :status="statusIcon(value)" /> |
| 28 | {{ value }} |
| 29 | </template> |
| 30 | |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 31 | <template #row-details="{ item }"> |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 32 | <b-container fluid> |
| 33 | <b-row> |
| 34 | <b-col sm="6" xl="4"> |
| 35 | <dl> |
| 36 | <!-- Chassis type --> |
| 37 | <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt> |
| 38 | <dd>{{ tableFormatter(item.chassisType) }}</dd> |
| 39 | <br /> |
| 40 | <!-- Manufacturer --> |
| 41 | <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt> |
| 42 | <dd>{{ tableFormatter(item.manufacturer) }}</dd> |
| 43 | <br /> |
| 44 | <!-- Power state --> |
| 45 | <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt> |
| 46 | <dd>{{ tableFormatter(item.powerState) }}</dd> |
| 47 | </dl> |
| 48 | </b-col> |
| 49 | <b-col sm="6" xl="4"> |
| 50 | <dl> |
| 51 | <!-- Health rollup --> |
| 52 | <dt> |
| 53 | {{ $t('pageHardwareStatus.table.statusHealthRollup') }}: |
| 54 | </dt> |
| 55 | <dd>{{ tableFormatter(item.healthRollup) }}</dd> |
| 56 | <br /> |
| 57 | <!-- Status state --> |
| 58 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 59 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 60 | </dl> |
| 61 | </b-col> |
| 62 | </b-row> |
| 63 | </b-container> |
| 64 | </template> |
| 65 | </b-table> |
| 66 | </page-section> |
| 67 | </template> |
| 68 | |
| 69 | <script> |
| 70 | import PageSection from '@/components/Global/PageSection'; |
| 71 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 72 | |
| 73 | import StatusIcon from '@/components/Global/StatusIcon'; |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 74 | |
| 75 | import TableRowExpandMixin from '@/components/Mixins/TableRowExpandMixin'; |
Yoshie Muranaka | 386df45 | 2020-06-18 12:45:13 -0700 | [diff] [blame] | 76 | import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 77 | |
| 78 | export default { |
| 79 | components: { IconChevron, PageSection, StatusIcon }, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 80 | mixins: [TableRowExpandMixin, TableDataFormatterMixin], |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 81 | data() { |
| 82 | return { |
| 83 | fields: [ |
| 84 | { |
| 85 | key: 'expandRow', |
| 86 | label: '', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 87 | tdClass: 'table-row-expand', |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 88 | }, |
| 89 | { |
| 90 | key: 'id', |
| 91 | label: this.$t('pageHardwareStatus.table.id'), |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 92 | formatter: this.tableFormatter, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 93 | }, |
| 94 | { |
| 95 | key: 'health', |
| 96 | label: this.$t('pageHardwareStatus.table.health'), |
Dixsie Wolmers | a04d46f | 2020-10-22 06:34:56 -0500 | [diff] [blame] | 97 | formatter: this.tableFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 98 | tdClass: 'text-nowrap', |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 99 | }, |
| 100 | { |
| 101 | key: 'partNumber', |
| 102 | label: this.$t('pageHardwareStatus.table.partNumber'), |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 103 | formatter: this.tableFormatter, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 104 | }, |
| 105 | { |
| 106 | key: 'serialNumber', |
| 107 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 108 | formatter: this.tableFormatter, |
| 109 | }, |
| 110 | ], |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 111 | }; |
| 112 | }, |
| 113 | computed: { |
| 114 | chassis() { |
| 115 | return this.$store.getters['chassis/chassis']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 116 | }, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 117 | }, |
| 118 | created() { |
| 119 | this.$store.dispatch('chassis/getChassisInfo').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 120 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 121 | this.$root.$emit('hardware-status-chassis-complete'); |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 122 | }); |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 123 | }, |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 124 | }; |
| 125 | </script> |