Merge pull request #2844 from nextcloud/backport/2843/stable1.3
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
:loading="isLoading || !!isSearching"
|
:loading="isLoading || !!isSearching"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
track-by="multiselectKey"
|
track-by="multiselectKey"
|
||||||
:internal-search="true"
|
:internal-search="false"
|
||||||
@input="clickAddAcl"
|
@input="clickAddAcl"
|
||||||
@search-change="asyncFind">
|
@search-change="asyncFind">
|
||||||
<template #noOptions>
|
<template #noOptions>
|
||||||
@@ -73,6 +73,7 @@ import { CollectionList } from 'nextcloud-vue-collections'
|
|||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
import { getCurrentUser } from '@nextcloud/auth'
|
import { getCurrentUser } from '@nextcloud/auth'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
import { debounce } from 'lodash'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SharingTabSidebar',
|
name: 'SharingTabSidebar',
|
||||||
@@ -148,18 +149,13 @@ export default {
|
|||||||
this.asyncFind('')
|
this.asyncFind('')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
debouncedFind: debounce(async function(query) {
|
||||||
|
this.isSearching = true
|
||||||
|
await this.$store.dispatch('loadSharees', query)
|
||||||
|
this.isSearching = false
|
||||||
|
}, 300),
|
||||||
async asyncFind(query) {
|
async asyncFind(query) {
|
||||||
// manual debounce to handle async searching more easily and have more control over the loading state
|
await this.debouncedFind(query)
|
||||||
const timestamp = (new Date()).getTime()
|
|
||||||
if (!this.isSearching || timestamp > this.isSearching + 300) {
|
|
||||||
this.isSearching = timestamp
|
|
||||||
await this.$store.dispatch('loadSharees', query)
|
|
||||||
|
|
||||||
// only reset searching flag if the most recent search finished
|
|
||||||
if (this.isSearching === timestamp) {
|
|
||||||
this.isSearching = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async clickAddAcl() {
|
async clickAddAcl() {
|
||||||
this.addAclForAPI = {
|
this.addAclForAPI = {
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ export default new Vuex.Store({
|
|||||||
params.append('search', query)
|
params.append('search', query)
|
||||||
params.append('format', 'json')
|
params.append('format', 'json')
|
||||||
params.append('perPage', 20)
|
params.append('perPage', 20)
|
||||||
params.append('itemType', [0, 1, 7])
|
params.append('itemType', [0, 1, 4, 7])
|
||||||
|
|
||||||
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', { params })
|
const response = await axios.get(generateOcsUrl('apps/files_sharing/api/v1') + 'sharees', { params })
|
||||||
commit('setSharees', response.data.ocs.data)
|
commit('setSharees', response.data.ocs.data)
|
||||||
|
|||||||
Reference in New Issue
Block a user