Merge pull request #22526 from nextcloud/feature/unified-search/emit-query

Emit unified search query
This commit is contained in:
John Molakvoæ 2020-09-02 09:27:58 +02:00 committed by GitHub
commit 34aca46325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 17 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -101,6 +101,7 @@ import { minSearchLength, getTypes, search, defaultLimit } from '../services/Uni
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent' import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import Magnify from 'vue-material-design-icons/Magnify' import Magnify from 'vue-material-design-icons/Magnify'
import debounce from 'debounce' import debounce from 'debounce'
import { emit } from '@nextcloud/event-bus'
import HeaderMenu from '../components/HeaderMenu' import HeaderMenu from '../components/HeaderMenu'
import SearchResult from '../components/UnifiedSearch/SearchResult' import SearchResult from '../components/UnifiedSearch/SearchResult'
@ -243,6 +244,7 @@ export default {
onClose() { onClose() {
this.resetState() this.resetState()
this.query = '' this.query = ''
emit('nextcloud:unified-search:close')
}, },
resetState() { resetState() {
@ -281,6 +283,9 @@ export default {
* Start searching on input * Start searching on input
*/ */
async onInput() { async onInput() {
// emit the search query
emit('nextcloud:unified-search:search', { query: this.query })
// Do not search if not long enough // Do not search if not long enough
if (this.query.trim() === '' || this.isShortQuery) { if (this.query.trim() === '' || this.isShortQuery) {
return return