Skip to content

Commit

Permalink
Adjust app to unified search in NC20
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
  • Loading branch information
raimund-schluessler committed Aug 29, 2020
1 parent 63b8a14 commit c1c38db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dependencies": {
"@nextcloud/axios": "^1.3.3",
"@nextcloud/dialogs": "^2.0.0",
"@nextcloud/event-bus": "^1.2.0",
"@nextcloud/initial-state": "1.1.2",
"@nextcloud/moment": "^1.1.1",
"@nextcloud/router": "^1.1.0",
Expand Down
14 changes: 13 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import VTooltip from 'v-tooltip'
import VueClipboard from 'vue-clipboard2'
import { linkTo } from '@nextcloud/router'

import { subscribe, unsubscribe } from '@nextcloud/event-bus'

// Disable on production
Vue.config.devtools = true
Vue.config.performance = true
Expand Down Expand Up @@ -83,12 +85,22 @@ OCA.Tasks.App = new Vue({
}
},
mounted() {
this.$OC.Search = new OCA.Search(this.filter, this.cleanSearch)
const version = this.$OC.config.version.split('.')

if (version[0] >= 20) {
// Hook to new global event for unified search
subscribe('search:update', this.filter)
} else {
this.$OC.Search = new OCA.Search(this.filter, this.cleanSearch)
}
},
beforeMount() {
this.$store.dispatch('loadCollections')
this.$store.dispatch('loadSettings')
},
beforeDestroy() {
unsubscribe('search:update', this.filter)
},
methods: {
filter(query) {
this.$store.commit('setSearchQuery', query)
Expand Down

0 comments on commit c1c38db

Please sign in to comment.