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