Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.chassis')"> |
| 3 | <b-table :items="chassis" :fields="fields"> |
| 4 | <!-- Expand chevron icon --> |
| 5 | <template v-slot:cell(expandRow)="row"> |
| 6 | <b-button variant="link" @click="row.toggleDetails"> |
| 7 | <icon-chevron /> |
| 8 | </b-button> |
| 9 | </template> |
| 10 | |
| 11 | <!-- Health --> |
| 12 | <template v-slot:cell(health)="{ value }"> |
| 13 | <status-icon :status="statusIcon(value)" /> |
| 14 | {{ value }} |
| 15 | </template> |
| 16 | |
| 17 | <template v-slot:row-details="{ item }"> |
| 18 | <b-container fluid> |
| 19 | <b-row> |
| 20 | <b-col sm="6" xl="4"> |
| 21 | <dl> |
| 22 | <!-- Chassis type --> |
| 23 | <dt>{{ $t('pageHardwareStatus.table.chassisType') }}:</dt> |
| 24 | <dd>{{ tableFormatter(item.chassisType) }}</dd> |
| 25 | <br /> |
| 26 | <!-- Manufacturer --> |
| 27 | <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt> |
| 28 | <dd>{{ tableFormatter(item.manufacturer) }}</dd> |
| 29 | <br /> |
| 30 | <!-- Power state --> |
| 31 | <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt> |
| 32 | <dd>{{ tableFormatter(item.powerState) }}</dd> |
| 33 | </dl> |
| 34 | </b-col> |
| 35 | <b-col sm="6" xl="4"> |
| 36 | <dl> |
| 37 | <!-- Health rollup --> |
| 38 | <dt> |
| 39 | {{ $t('pageHardwareStatus.table.statusHealthRollup') }}: |
| 40 | </dt> |
| 41 | <dd>{{ tableFormatter(item.healthRollup) }}</dd> |
| 42 | <br /> |
| 43 | <!-- Status state --> |
| 44 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 45 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 46 | </dl> |
| 47 | </b-col> |
| 48 | </b-row> |
| 49 | </b-container> |
| 50 | </template> |
| 51 | </b-table> |
| 52 | </page-section> |
| 53 | </template> |
| 54 | |
| 55 | <script> |
| 56 | import PageSection from '@/components/Global/PageSection'; |
| 57 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 58 | |
| 59 | import StatusIcon from '@/components/Global/StatusIcon'; |
Yoshie Muranaka | 386df45 | 2020-06-18 12:45:13 -0700 | [diff] [blame] | 60 | import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 61 | |
| 62 | export default { |
| 63 | components: { IconChevron, PageSection, StatusIcon }, |
Yoshie Muranaka | 386df45 | 2020-06-18 12:45:13 -0700 | [diff] [blame] | 64 | mixins: [TableDataFormatterMixin], |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 65 | data() { |
| 66 | return { |
| 67 | fields: [ |
| 68 | { |
| 69 | key: 'expandRow', |
| 70 | label: '', |
| 71 | tdClass: 'table-row-expand' |
| 72 | }, |
| 73 | { |
| 74 | key: 'id', |
| 75 | label: this.$t('pageHardwareStatus.table.id'), |
| 76 | formatter: this.tableFormatter |
| 77 | }, |
| 78 | { |
| 79 | key: 'health', |
| 80 | label: this.$t('pageHardwareStatus.table.health'), |
| 81 | formatter: this.tableFormatter |
| 82 | }, |
| 83 | { |
| 84 | key: 'partNumber', |
| 85 | label: this.$t('pageHardwareStatus.table.partNumber'), |
| 86 | formatter: this.tableFormatter |
| 87 | }, |
| 88 | { |
| 89 | key: 'serialNumber', |
| 90 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
| 91 | formatter: this.tableFormatter |
| 92 | } |
| 93 | ] |
| 94 | }; |
| 95 | }, |
| 96 | computed: { |
| 97 | chassis() { |
| 98 | return this.$store.getters['chassis/chassis']; |
| 99 | } |
| 100 | }, |
| 101 | created() { |
| 102 | this.$store.dispatch('chassis/getChassisInfo').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame^] | 103 | // Emit initial data fetch complete to parent component |
Yoshie Muranaka | 09e8b5d | 2020-06-08 07:36:59 -0700 | [diff] [blame] | 104 | this.$root.$emit('hardwareStatus::chassis::complete'); |
| 105 | }); |
| 106 | } |
| 107 | }; |
| 108 | </script> |