Yoshie Muranaka | 56ee769 | 2020-05-28 13:28:29 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.system')"> |
| 3 | <b-table :items="systems" :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 | <!-- Asset tag --> |
| 23 | <dt>{{ $t('pageHardwareStatus.table.assetTag') }}:</dt> |
| 24 | <dd>{{ tableFormatter(item.assetTag) }}</dd> |
| 25 | <br /> |
| 26 | <!-- Description --> |
| 27 | <dt>{{ $t('pageHardwareStatus.table.description') }}:</dt> |
| 28 | <dd>{{ tableFormatter(item.description) }}</dd> |
| 29 | <br /> |
| 30 | <!-- Indicator LED --> |
| 31 | <dt>{{ $t('pageHardwareStatus.table.indicatorLed') }}:</dt> |
| 32 | <dd>{{ tableFormatter(item.indicatorLed) }}</dd> |
| 33 | <br /> |
| 34 | <!-- Model --> |
| 35 | <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt> |
| 36 | <dd>{{ tableFormatter(item.model) }}</dd> |
| 37 | </dl> |
| 38 | </b-col> |
| 39 | <b-col sm="6" xl="4"> |
| 40 | <dl> |
| 41 | <!-- Power state --> |
| 42 | <dt>{{ $t('pageHardwareStatus.table.powerState') }}:</dt> |
| 43 | <dd>{{ tableFormatter(item.powerState) }}</dd> |
| 44 | <br /> |
| 45 | <!-- Health rollup --> |
| 46 | <dt> |
| 47 | {{ $t('pageHardwareStatus.table.statusHealthRollup') }}: |
| 48 | </dt> |
| 49 | <dd>{{ tableFormatter(item.healthRollup) }}</dd> |
| 50 | <br /> |
| 51 | <!-- Status state --> |
| 52 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 53 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 54 | <br /> |
| 55 | <!-- System type --> |
| 56 | <dt>{{ $t('pageHardwareStatus.table.systemType') }}:</dt> |
| 57 | <dd>{{ tableFormatter(item.systemType) }}</dd> |
| 58 | </dl> |
| 59 | </b-col> |
| 60 | </b-row> |
| 61 | </b-container> |
| 62 | </template> |
| 63 | </b-table> |
| 64 | </page-section> |
| 65 | </template> |
| 66 | |
| 67 | <script> |
| 68 | import PageSection from '@/components/Global/PageSection'; |
| 69 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 70 | |
| 71 | import StatusIcon from '@/components/Global/StatusIcon'; |
| 72 | import TableDataFormatter from '@/components/Mixins/TableDataFormatter'; |
| 73 | |
| 74 | export default { |
| 75 | components: { IconChevron, PageSection, StatusIcon }, |
| 76 | mixins: [TableDataFormatter], |
| 77 | data() { |
| 78 | return { |
| 79 | fields: [ |
| 80 | { |
| 81 | key: 'expandRow', |
| 82 | label: '', |
| 83 | tdClass: 'table-row-expand' |
| 84 | }, |
| 85 | { |
| 86 | key: 'id', |
| 87 | label: this.$t('pageHardwareStatus.table.id'), |
| 88 | formatter: this.tableFormatter |
| 89 | }, |
| 90 | { |
| 91 | key: 'health', |
| 92 | label: this.$t('pageHardwareStatus.table.health'), |
| 93 | formatter: this.tableFormatter |
| 94 | }, |
| 95 | { |
| 96 | key: 'partNumber', |
| 97 | label: this.$t('pageHardwareStatus.table.partNumber'), |
| 98 | formatter: this.tableFormatter |
| 99 | }, |
| 100 | { |
| 101 | key: 'serialNumber', |
| 102 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
| 103 | formatter: this.tableFormatter |
| 104 | } |
| 105 | ] |
| 106 | }; |
| 107 | }, |
| 108 | computed: { |
| 109 | systems() { |
| 110 | return this.$store.getters['system/systems']; |
| 111 | } |
| 112 | }, |
| 113 | created() { |
| 114 | this.$store.dispatch('system/getSystem').finally(() => { |
| 115 | // Emit intial data fetch complete to parent component |
| 116 | this.$root.$emit('hardwareStatus::system::complete'); |
| 117 | }); |
| 118 | } |
| 119 | }; |
| 120 | </script> |