Update the search
This commit is contained in:
parent
b6d678b423
commit
12b708404b
2 changed files with 9 additions and 5 deletions
|
@ -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 }
|
||||
}, {})
|
||||
}
|
||||
|
|
|
@ -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"/>
|
||||
</div>
|
||||
</div>
|
||||
<el-tabs v-model="activeTab" tab-position="left">
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue