Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 1 | <template> |
| 2 | <page-section :section-title="$t('pageHardwareStatus.dimmSlot')"> |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 3 | <b-row> |
| 4 | <b-col sm="6" md="5" xl="4"> |
| 5 | <search @changeSearch="onChangeSearchInput" /> |
| 6 | </b-col> |
| 7 | </b-row> |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 8 | <b-table |
| 9 | sort-icon-left |
| 10 | no-sort-reset |
| 11 | sort-by="health" |
SurenNeware | 5e25e28 | 2020-07-08 15:57:23 +0530 | [diff] [blame] | 12 | responsive="md" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 13 | show-empty |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 14 | :items="dimms" |
| 15 | :fields="fields" |
| 16 | :sort-desc="true" |
| 17 | :sort-compare="sortCompare" |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 18 | :filter="searchFilter" |
SurenNeware | 307382e | 2020-07-27 20:45:14 +0530 | [diff] [blame] | 19 | :empty-text="$t('global.table.emptyMessage')" |
SurenNeware | 156a0e6 | 2020-08-28 19:20:03 +0530 | [diff] [blame^] | 20 | :empty-filtered-text="$t('global.table.emptySearchMessage')" |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 21 | > |
| 22 | <!-- Expand chevron icon --> |
| 23 | <template v-slot:cell(expandRow)="row"> |
Dixsie Wolmers | 8313376 | 2020-07-15 08:45:19 -0500 | [diff] [blame] | 24 | <b-button |
| 25 | variant="link" |
| 26 | data-test-id="hardwareStatus-button-expandDimms" |
| 27 | @click="row.toggleDetails" |
| 28 | > |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 29 | <icon-chevron /> |
| 30 | </b-button> |
| 31 | </template> |
| 32 | |
| 33 | <!-- Health --> |
| 34 | <template v-slot:cell(health)="{ value }"> |
| 35 | <status-icon :status="statusIcon(value)" /> |
| 36 | {{ value }} |
| 37 | </template> |
| 38 | |
| 39 | <template v-slot:row-details="{ item }"> |
| 40 | <b-container fluid> |
| 41 | <b-row> |
| 42 | <b-col sm="6" xl="4"> |
| 43 | <dl> |
| 44 | <!-- Status state --> |
| 45 | <dt>{{ $t('pageHardwareStatus.table.statusState') }}:</dt> |
| 46 | <dd>{{ tableFormatter(item.statusState) }}</dd> |
| 47 | </dl> |
| 48 | </b-col> |
| 49 | </b-row> |
| 50 | </b-container> |
| 51 | </template> |
| 52 | </b-table> |
| 53 | </page-section> |
| 54 | </template> |
| 55 | |
| 56 | <script> |
| 57 | import PageSection from '@/components/Global/PageSection'; |
| 58 | import IconChevron from '@carbon/icons-vue/es/chevron--down/20'; |
| 59 | |
| 60 | import StatusIcon from '@/components/Global/StatusIcon'; |
Yoshie Muranaka | 386df45 | 2020-06-18 12:45:13 -0700 | [diff] [blame] | 61 | import TableDataFormatterMixin from '@/components/Mixins/TableDataFormatterMixin'; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 62 | import TableSortMixin from '@/components/Mixins/TableSortMixin'; |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 63 | import Search from '@/components/Global/Search'; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 64 | |
| 65 | export default { |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 66 | components: { IconChevron, PageSection, StatusIcon, Search }, |
Yoshie Muranaka | 386df45 | 2020-06-18 12:45:13 -0700 | [diff] [blame] | 67 | mixins: [TableDataFormatterMixin, TableSortMixin], |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 68 | data() { |
| 69 | return { |
| 70 | fields: [ |
| 71 | { |
| 72 | key: 'expandRow', |
| 73 | label: '', |
| 74 | tdClass: 'table-row-expand', |
| 75 | sortable: false |
| 76 | }, |
| 77 | { |
| 78 | key: 'id', |
| 79 | label: this.$t('pageHardwareStatus.table.id'), |
| 80 | formatter: this.tableFormatter, |
| 81 | sortable: true |
| 82 | }, |
| 83 | { |
| 84 | key: 'health', |
| 85 | label: this.$t('pageHardwareStatus.table.health'), |
| 86 | formatter: this.tableFormatter, |
| 87 | sortable: true |
| 88 | }, |
| 89 | { |
| 90 | key: 'partNumber', |
| 91 | label: this.$t('pageHardwareStatus.table.partNumber'), |
| 92 | formatter: this.tableFormatter, |
| 93 | sortable: true |
| 94 | }, |
| 95 | { |
| 96 | key: 'serialNumber', |
| 97 | label: this.$t('pageHardwareStatus.table.serialNumber'), |
| 98 | formatter: this.tableFormatter, |
| 99 | sortable: true |
| 100 | } |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 101 | ], |
| 102 | searchFilter: null |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 103 | }; |
| 104 | }, |
| 105 | computed: { |
| 106 | dimms() { |
| 107 | return this.$store.getters['memory/dimms']; |
| 108 | } |
| 109 | }, |
| 110 | created() { |
| 111 | this.$store.dispatch('memory/getDimms').finally(() => { |
Gunnar Mills | defc9e2 | 2020-07-07 20:29:03 -0500 | [diff] [blame] | 112 | // Emit initial data fetch complete to parent component |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 113 | this.$root.$emit('hardwareStatus::dimmSlot::complete'); |
| 114 | }); |
| 115 | }, |
| 116 | methods: { |
| 117 | sortCompare(a, b, key) { |
| 118 | if (key === 'health') { |
| 119 | return this.sortStatus(a, b, key); |
| 120 | } |
Yoshie Muranaka | 4177014 | 2020-06-18 14:00:55 -0700 | [diff] [blame] | 121 | }, |
| 122 | onChangeSearchInput(searchValue) { |
| 123 | this.searchFilter = searchValue; |
Yoshie Muranaka | e24b17d | 2020-06-08 11:03:11 -0700 | [diff] [blame] | 124 | } |
| 125 | } |
| 126 | }; |
| 127 | </script> |