diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-04 12:15:00 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-08-04 12:15:00 +0300 |
commit | a02d02109352c8c72b92272b01fce63d3486efde (patch) | |
tree | 4edcd1ead6f6ccb47e570ef83af64d962528f85e /src/views | |
parent | 056f1371ef17398ac61dbf52b1840db0c73caf8f (diff) | |
download | webui-vue-a02d02109352c8c72b92272b01fce63d3486efde.tar.xz |
SILABMC-224: add search by select
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/_sila/Logs/EventLogs/EventLogs.vue | 23 | ||||
-rw-r--r-- | src/views/_sila/Logs/PostCodeLogs/PostCodeLogs.vue | 20 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/views/_sila/Logs/EventLogs/EventLogs.vue b/src/views/_sila/Logs/EventLogs/EventLogs.vue index bc276b29..2a344819 100644 --- a/src/views/_sila/Logs/EventLogs/EventLogs.vue +++ b/src/views/_sila/Logs/EventLogs/EventLogs.vue @@ -5,8 +5,11 @@ <b-col sm="8" xl="6" class="search-block d-sm-flex align-items-end mb-4"> <search :placeholder="$t('pageEventLogs.table.searchLogs')" + :show-search-by="true" + :select-options="searchSelectOptions" data-test-id="eventLogs-input-searchLogs" @change-search="onChangeSearchInput" + @search-by="onSearchBy" @clear-search="onClearSearchInput" /> <div class="ml-sm-4"> @@ -83,6 +86,8 @@ :per-page="perPage" :current-page="currentPage" :filter="searchFilter" + :filter-included-fields="filterIncludedFields" + :filter-debounce="300" :busy="isBusy" @filtered="onFiltered" @row-selected="onRowSelected($event, filteredLogs.length)" @@ -360,6 +365,20 @@ export default { tdClass: 'text-right text-nowrap', }, ], + searchSelectOptions: [ + { + value: 'all', + text: this.$t('pageEventLogs.table.all'), + }, + { + value: 'id', + text: this.$t('pageEventLogs.table.id'), + }, + { + value: 'description', + text: this.$t('pageEventLogs.table.description'), + }, + ], tableFilters: [ { key: 'severity', @@ -386,6 +405,7 @@ export default { itemsPerPageOptions: itemsPerPageOptions, perPage: perPage, searchFilter: searchFilter, + filterIncludedFields: null, searchTotalFilteredRows: 0, selectedRows: selectedRows, tableHeaderCheckboxModel: tableHeaderCheckboxModel, @@ -443,6 +463,9 @@ export default { }); }, methods: { + onSearchBy(field) { + this.filterIncludedFields = field === 'all' ? null : [field]; + }, changelogStatus(row) { this.$store .dispatch('eventLog/updateEventLogStatus', { diff --git a/src/views/_sila/Logs/PostCodeLogs/PostCodeLogs.vue b/src/views/_sila/Logs/PostCodeLogs/PostCodeLogs.vue index 63b74bc9..33c5e26a 100644 --- a/src/views/_sila/Logs/PostCodeLogs/PostCodeLogs.vue +++ b/src/views/_sila/Logs/PostCodeLogs/PostCodeLogs.vue @@ -5,7 +5,10 @@ <b-col sm="8" xl="6" class="search-block d-sm-flex align-items-end mb-4"> <search :placeholder="$t('pagePostCodeLogs.table.searchLogs')" + :show-search-by="true" + :select-options="searchSelectOptions" @change-search="onChangeSearchInput" + @search-by="onSearchBy" @clear-search="onClearSearchInput" /> <div class="ml-sm-4"> @@ -65,6 +68,8 @@ :per-page="perPage" :current-page="currentPage" :filter="searchFilter" + :filter-included-fields="filterIncludedFields" + :filter-debounce="300" :busy="isBusy" @filtered="onFiltered" @row-selected="onRowSelected($event, filteredLogs.length)" @@ -239,6 +244,17 @@ export default { tdClass: 'text-right text-nowrap', }, ], + searchSelectOptions: [ + { + value: 'all', + text: this.$t('pagePostCodeLogs.table.all'), + }, + { + value: 'bootCount', + text: this.$t('pagePostCodeLogs.table.bootCount'), + }, + { value: 'postCode', text: this.$t('pagePostCodeLogs.table.postCode') }, + ], expandRowLabel, activeFilters: [], currentPage: currentPage, @@ -247,6 +263,7 @@ export default { itemsPerPageOptions: itemsPerPageOptions, perPage: perPage, searchFilter: searchFilter, + filterIncludedFields: null, searchTotalFilteredRows: 0, selectedRows: selectedRows, tableHeaderCheckboxModel: tableHeaderCheckboxModel, @@ -306,6 +323,9 @@ export default { }); }, methods: { + onSearchBy(field) { + this.filterIncludedFields = field === 'all' ? null : [field]; + }, exportAllLogsString() { { return this.$store.getters['postCodeLogs/allPostCodes'].map( |