SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.processors')"> |
| 3 | <!-- Search --> |
SurenNeware | 787635a | 2020-11-24 22:42:42 +0530 | [diff] [blame] | 4 | <b-row class="align-items-end"> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 5 | <b-col sm="6" md="5" xl="4"> |
Dixsie Wolmers | 9b22b49 | 2020-09-07 21:26:06 -0500 | [diff] [blame] | 6 | <search |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 7 | @change-search="onChangeSearchInput" |
| 8 | @clear-search="onClearSearchInput" |
Dixsie Wolmers | 9b22b49 | 2020-09-07 21:26:06 -0500 | [diff] [blame] | 9 | /> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 10 | </b-col> |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 11 | <b-col sm="6" md="3" xl="2"> |
| 12 | <table-cell-count |
| 13 | :filtered-items-count="filteredRows" |
| 14 | :total-number-of-cells="processors.length" |
| 15 | ></table-cell-count> |
| 16 | </b-col> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 17 | </b-row> |
| 18 | <b-table |
| 19 | sort-icon-left |
| 20 | no-sort-reset |
Sukanya Pandey | fde429e | 2020-09-14 20:48:39 +0530 | [diff] [blame] | 21 | hover |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 22 | responsive="md" |
SurenNeware | 10fe276 | 2020-08-19 12:01:32 +0530 | [diff] [blame] | 23 | show-empty |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 24 | :items="processors" |
| 25 | :fields="fields" |
| 26 | :sort-desc="true" |
| 27 | :filter="searchFilter" |
SurenNeware | 10fe276 | 2020-08-19 12:01:32 +0530 | [diff] [blame] | 28 | :empty-text="$t('global.table.emptyMessage')" |
SurenNeware | 156a0e6 | 2020-08-28 19:20:03 +0530 | [diff] [blame] | 29 | :empty-filtered-text="$t('global.table.emptySearchMessage')" |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 30 | @filtered="onFiltered" |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 31 | > |
| 32 | <!-- Expand button --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 33 | <template #cell(expandRow)="row"> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 34 | <b-button |
| 35 | variant="link" |
| 36 | data-test-id="hardwareStatus-button-expandProcessors" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 37 | :aria-label="expandRowLabel" |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 38 | :title="expandRowLabel" |
| 39 | class="btn-icon-only" |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 40 | @click="toggleRowDetails(row)" |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 41 | > |
Dixsie Wolmers | 30f11f8 | 2020-11-10 16:07:56 -0600 | [diff] [blame] | 42 | <icon-chevron /> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 43 | </b-button> |
| 44 | </template> |
| 45 | <!-- Health --> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 46 | <template #cell(health)="{ value }"> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 47 | <status-icon :status="statusIcon(value)" /> |
| 48 | {{ value }} |
| 49 | </template> |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 50 | <template #row-details="{ item }"> |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 51 | <b-container fluid> |
| 52 | <b-row> |
| 53 | <b-col sm="6" xl="4"> |
| 54 | <dl> |
| 55 | <!-- Name --> |
| 56 | <dt>{{ $t('pageHardwareStatus.table.name') }}:</dt> |
| 57 | <dd>{{ tableFormatter(item.name) }}</dd> |
| 58 | <br /> |
| 59 | <!-- Model --> |
| 60 | <dt>{{ $t('pageHardwareStatus.table.model') }}:</dt> |
| 61 | <dd>{{ tableFormatter(item.model) }}</dd> |
| 62 | <br /> |
| 63 | <!-- Instruction set --> |
| 64 | <dt>{{ $t('pageHardwareStatus.table.instructionSet') }}:</dt> |
| 65 | <dd>{{ tableFormatter(item.instructionSet) }}</dd> |
| 66 | <br /> |
| 67 | <!-- Manufacturer --> |
| 68 | <dt>{{ $t('pageHardwareStatus.table.manufacturer') }}:</dt> |
| 69 | <dd>{{ tableFormatter(item.manufacturer) }}</dd> |
| 70 | </dl> |
| 71 | </b-col> |
| 72 | <b-col sm="6" xl="4"> |
| 73 | <dl> |
| 74 | <!-- Architecture --> |
| 75 | <dt> |
| 76 | {{ $t('pageHardwareStatus.table.processorArchitecture') }}: |
| 77 | </dt> |
| 78 | <dd>{{ tableFormatter(item.processorArchitecture) }}</dd> |
| 79 | <br /> |
| 80 | <!-- Type --> |
| 81 | <dt>{{ $t('pageHardwareStatus.table.processorType') }}:</dt> |
| 82 | <dd>{{ tableFormatter(item.processorType) }}</dd> |
| 83 | <br /> |
| 84 | <!-- Total cores --> |
| 85 | <dt>{{ $t('pageHardwareStatus.table.totalCores') }}:</dt> |
| 86 | <dd>{{ tableFormatter(item.totalCores) }}</dd> |
| 87 | <br /> |
| 88 | <!-- Status state --> |
| 89 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 90 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 91 | </dl> |
| 92 | </b-col> |
| 93 | </b-row> |
| 94 | </b-container> |
| 95 | </template> |
| 96 | </b-table> |
| 97 | </page-section> |
| 98 | </template> |
| 99 | |
| 100 | <script> |
| 101 | import PageSection from '@/components/Global/PageSection'; |
| 102 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 103 | import StatusIcon from '@/components/Global/StatusIcon'; |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 104 | import TableCellCount from '@/components/Global/TableCellCount'; |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 105 | |
| 106 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
| 107 | import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; |
| 108 | import Search from '@/components/Global/Search'; |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 109 | import SearchFilterMixin, { |
| 110 | searchFilter, |
| 111 | } from '@/components/Mixins/SearchFilterMixin'; |
| 112 | import TableRowExpandMixin, { |
| 113 | expandRowLabel, |
| 114 | } from '@/components/Mixins/TableRowExpandMixin'; |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 115 | |
| 116 | export default { |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 117 | components: { IconChevron, PageSection, StatusIcon, Search, TableCellCount }, |
| 118 | mixins: [ |
| 119 | TableRowExpandMixin, |
| 120 | TableDataFormatterMixin, |
| 121 | TableSortMixin, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 122 | SearchFilterMixin, |
Dixsie Wolmers | b53e086 | 2020-09-08 14:13:38 -0500 | [diff] [blame] | 123 | ], |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 124 | data() { |
| 125 | return { |
| 126 | fields: [ |
| 127 | { |
| 128 | key: 'expandRow', |
| 129 | label: '', |
| 130 | tdClass: 'table-row-expand', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 131 | sortable: false, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 132 | }, |
| 133 | { |
| 134 | key: 'id', |
| 135 | label: this.$t('pageHardwareStatus.table.id'), |
| 136 | formatter: this.tableFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 137 | sortable: true, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 138 | }, |
| 139 | { |
| 140 | key: 'health', |
| 141 | label: this.$t('pageHardwareStatus.table.health'), |
| 142 | formatter: this.tableFormatter, |
Dixsie Wolmers | a04d46f | 2020-10-22 06:34:56 -0500 | [diff] [blame] | 143 | sortable: true, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 144 | tdClass: 'text-nowrap', |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 145 | }, |
| 146 | { |
| 147 | key: 'partNumber', |
| 148 | label: this.$t('pageHardwareStatus.table.partNumber'), |
| 149 | formatter: this.tableFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 150 | sortable: true, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 151 | }, |
| 152 | { |
| 153 | key: 'serialNumber', |
| 154 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
| 155 | formatter: this.tableFormatter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 156 | sortable: true, |
| 157 | }, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 158 | ], |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 159 | searchFilter: searchFilter, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 160 | searchTotalFilteredRows: 0, |
SurenNeware | ba91c49 | 2020-10-27 14:18:54 +0530 | [diff] [blame] | 161 | expandRowLabel: expandRowLabel, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 162 | }; |
| 163 | }, |
| 164 | computed: { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 165 | filteredRows() { |
| 166 | return this.searchFilter |
| 167 | ? this.searchTotalFilteredRows |
| 168 | : this.processors.length; |
| 169 | }, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 170 | processors() { |
| 171 | return this.$store.getters['processors/processors']; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 172 | }, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 173 | }, |
| 174 | created() { |
| 175 | this.$store.dispatch('processors/getProcessorsInfo').finally(() => { |
| 176 | // Emit initial data fetch complete to parent component |
Sukanya Pandey | edb8a77 | 2020-10-29 11:33:42 +0530 | [diff] [blame] | 177 | this.$root.$emit('hardware-status-processors-complete'); |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 178 | }); |
| 179 | }, |
| 180 | methods: { |
Sukanya Pandey | 9901096 | 2020-07-27 21:44:47 +0530 | [diff] [blame] | 181 | onFiltered(filteredItems) { |
| 182 | this.searchTotalFilteredRows = filteredItems.length; |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 183 | }, |
| 184 | }, |
SurenNeware | dc3fa2e | 2020-08-04 20:45:25 +0530 | [diff] [blame] | 185 | }; |
| 186 | </script> |