forked from AkkomaGang/admin-fe
Implement search for Relays
This commit is contained in:
parent
6921d905dc
commit
f02ff602b5
2 changed files with 18 additions and 1 deletions
|
@ -308,6 +308,12 @@ export const formSearchObject = description => {
|
|||
key: ':terms_of_services',
|
||||
label: 'Terms of Services',
|
||||
search: ['Terms of Services', ':terms_of_services']
|
||||
}, {
|
||||
groupKey: 'relays',
|
||||
groupLabel: 'Relays',
|
||||
key: ':relays',
|
||||
label: 'Relays',
|
||||
search: ['Relays', ':relays']
|
||||
}]
|
||||
return processedDescription.concat(searchDataForEditableDocs)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-if="!loading" class="relays-container">
|
||||
<div v-if="!loading" class="relays-container" data-search="relays">
|
||||
<div class="follow-relay-container">
|
||||
<el-input v-model="newRelay" :placeholder="$t('settings.followRelay')" class="follow-relay" @keyup.enter.native="followRelay"/>
|
||||
<el-button @click.native="followRelay">{{ $t('settings.follow') }}</el-button>
|
||||
|
@ -51,10 +51,21 @@ export default {
|
|||
},
|
||||
relays() {
|
||||
return this.$store.state.relays.fetchedRelays
|
||||
},
|
||||
searchQuery() {
|
||||
return this.$store.state.settings.searchQuery
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('FetchRelays')
|
||||
|
||||
if (this.searchQuery.length > 0) {
|
||||
const selectedSetting = document.querySelector(`[data-search="${this.searchQuery}"]`)
|
||||
if (selectedSetting) {
|
||||
selectedSetting.scrollIntoView({ block: 'start', behavior: 'smooth' })
|
||||
}
|
||||
this.$store.dispatch('SetSearchQuery', '')
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
followRelay() {
|
||||
|
|
Loading…
Reference in a new issue