From 12b708404b2d474355fd843486b2111c36ed5bc8 Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Tue, 25 Feb 2020 18:57:38 +0300 Subject: [PATCH] Update the search --- src/store/modules/normalizers.js | 5 +++-- src/views/settings/index.vue | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index 994ae958..2fcddd20 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -257,10 +257,11 @@ const wrapValues = (settings, currentState) => { export const formSearchObject = description => { return description.reduce((acc, setting) => { + const searchArray = _.compact([setting.key, setting.label, setting.description]).map(el => el.toLowerCase()) if (setting.children) { - const updatedAcc = { ...acc, [setting.key]: _.compact([setting.key, setting.label, setting.description]) } + const updatedAcc = { ...acc, [setting.key]: searchArray } return { ...updatedAcc, ...formSearchObject(setting.children) } } - return { ...acc, [setting.key]: _.compact([setting.key, setting.label, setting.description]) } + return { ...acc, [setting.key]: searchArray } }, {}) } diff --git a/src/views/settings/index.vue b/src/views/settings/index.vue index 2f88a682..dd8349d2 100644 --- a/src/views/settings/index.vue +++ b/src/views/settings/index.vue @@ -29,7 +29,8 @@ :trigger-on-focus="false" placeholder="Search" prefix-icon="el-icon-search" - class="settings-search-input"/> + class="settings-search-input" + @select="handleSearchSelect"/> @@ -279,10 +280,12 @@ export default { message: i18n.t('settings.restartSuccess') }) }, + handleSearchSelect() { + }, querySearch(queryString, cb) { const results = Object.keys(this.searchData) - .filter(key => this.searchData[key].find(a => a.includes(queryString))) - .map(el => { return { value: el } }) + .filter(key => this.searchData[key].find(el => el.includes(queryString.toLowerCase()))) + .map(key => { return { value: this.searchData[key][1] } }) cb(results) } }