SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.processors')"> |
| 3 | <!-- Search --> |
| 4 | <b-row> |
| 5 | <b-col sm="6" md="5" xl="4"> |
| 6 | <search @changeSearch="onChangeSearchInput" /> |
| 7 | </b-col> |
| 8 | </b-row> |
| 9 | <b-table |
| 10 | sort-icon-left |
| 11 | no-sort-reset |
| 12 | responsive="md" |
SurenNeware | 10fe276 | 2020-08-19 12:01:32 +0530 | [diff] [blame] | 13 | show-empty |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 14 | :items="processors" |
| 15 | :fields="fields" |
| 16 | :sort-desc="true" |
| 17 | :filter="searchFilter" |
SurenNeware | 10fe276 | 2020-08-19 12:01:32 +0530 | [diff] [blame] | 18 | :empty-text="$t('global.table.emptyMessage')" |
SurenNeware | 156a0e6 | 2020-08-28 19:20:03 +0530 | [diff] [blame] | 19 | :empty-filtered-text="$t('global.table.emptySearchMessage')" |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 20 | > |
| 21 | <!-- Expand button --> |
| 22 | <template v-slot:cell(expandRow)="row"> |
| 23 | <b-button |
| 24 | variant="link" |
| 25 | data-test-id="hardwareStatus-button-expandProcessors" |
| 26 | @click="row.toggleDetails" |
| 27 | > |
| 28 | <icon-chevron /> |
| 29 | </b-button> |
| 30 | </template> |
| 31 | <!-- Health --> |
| 32 | <template v-slot:cell(health)="{ value }"> |
| 33 | <status-icon :status="statusIcon(value)" /> |
| 34 | {{ value }} |
| 35 | </template> |
| 36 | <template v-slot:row-details="{ item }"> |
| 37 | <b-container fluid> |
| 38 | <b-row> |
| 39 | <b-col sm="6" xl="4"> |
| 40 | <dl> |
| 41 | <!-- Name --> |
| 42 | <dt>{{ $t('pageHardwareStatus.table.name') }}:</dt> |
| 43 | <dd>{{ tableFormatter(item.name) }}</dd> |
| 44 | <br /> |
| 45 | <!-- Model --> |
| 46 | <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt> |
| 47 | <dd>{{ tableFormatter(item.model) }}</dd> |
| 48 | <br /> |
| 49 | <!-- Instruction set --> |
| 50 | <dt>{{ $t('pageHardwareStatus.table.instructionSet') }}:</dt> |
| 51 | <dd>{{ tableFormatter(item.instructionSet) }}</dd> |
| 52 | <br /> |
| 53 | <!-- Manufacturer --> |
| 54 | <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt> |
| 55 | <dd>{{ tableFormatter(item.manufacturer) }}</dd> |
| 56 | </dl> |
| 57 | </b-col> |
| 58 | <b-col sm="6" xl="4"> |
| 59 | <dl> |
| 60 | <!-- Architecture --> |
| 61 | <dt> |
| 62 | {{ $t('pageHardwareStatus.table.processorArchitecture') }}: |
| 63 | </dt> |
| 64 | <dd>{{ tableFormatter(item.processorArchitecture) }}</dd> |
| 65 | <br /> |
| 66 | <!-- Type --> |
| 67 | <dt>{{ $t('pageHardwareStatus.table.processorType') }}:</dt> |
| 68 | <dd>{{ tableFormatter(item.processorType) }}</dd> |
| 69 | <br /> |
| 70 | <!-- Total cores --> |
| 71 | <dt>{{ $t('pageHardwareStatus.table.totalCores') }}:</dt> |
| 72 | <dd>{{ tableFormatter(item.totalCores) }}</dd> |
| 73 | <br /> |
| 74 | <!-- Status state --> |
| 75 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 76 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 77 | </dl> |
| 78 | </b-col> |
| 79 | </b-row> |
| 80 | </b-container> |
| 81 | </template> |
| 82 | </b-table> |
| 83 | </page-section> |
| 84 | </template> |
| 85 | |
| 86 | <script> |
| 87 | import PageSection from '@/components/Global/PageSection'; |
| 88 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 89 | import StatusIcon from '@/components/Global/StatusIcon'; |
| 90 | |
| 91 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
| 92 | import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; |
| 93 | import Search from '@/components/Global/Search'; |
| 94 | |
| 95 | export default { |
| 96 | components: { PageSection, IconChevron, StatusIcon, Search }, |
| 97 | mixins: [TableDataFormatterMixin, TableSortMixin], |
| 98 | data() { |
| 99 | return { |
| 100 | fields: [ |
| 101 | { |
| 102 | key: 'expandRow', |
| 103 | label: '', |
| 104 | tdClass: 'table-row-expand', |
| 105 | sortable: false |
| 106 | }, |
| 107 | { |
| 108 | key: 'id', |
| 109 | label: this.$t('pageHardwareStatus.table.id'), |
| 110 | formatter: this.tableFormatter, |
| 111 | sortable: true |
| 112 | }, |
| 113 | { |
| 114 | key: 'health', |
| 115 | label: this.$t('pageHardwareStatus.table.health'), |
| 116 | formatter: this.tableFormatter, |
| 117 | sortable: true |
| 118 | }, |
| 119 | { |
| 120 | key: 'partNumber', |
| 121 | label: this.$t('pageHardwareStatus.table.partNumber'), |
| 122 | formatter: this.tableFormatter, |
| 123 | sortable: true |
| 124 | }, |
| 125 | { |
| 126 | key: 'serialNumber', |
| 127 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
| 128 | formatter: this.tableFormatter, |
| 129 | sortable: true |
| 130 | } |
| 131 | ], |
| 132 | searchFilter: null |
| 133 | }; |
| 134 | }, |
| 135 | computed: { |
| 136 | processors() { |
| 137 | return this.$store.getters['processors/processors']; |
| 138 | } |
| 139 | }, |
| 140 | created() { |
| 141 | this.$store.dispatch('processors/getProcessorsInfo').finally(() => { |
| 142 | // Emit initial data fetch complete to parent component |
| 143 | this.$root.$emit('hardwareStatus::processors::complete'); |
| 144 | }); |
| 145 | }, |
| 146 | methods: { |
| 147 | onChangeSearchInput(searchValue) { |
| 148 | this.searchFilter = searchValue; |
| 149 | } |
| 150 | } |
| 151 | }; |
| 152 | </script> |