forked from vikunja/frontend
feat: use task parsing to search for teams
This commit is contained in:
parent
a47d106926
commit
a404e42b2b
|
@ -62,7 +62,9 @@ import TeamModel from '@/models/team'
|
||||||
import {CURRENT_LIST, LOADING, LOADING_MODULE, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
import {CURRENT_LIST, LOADING, LOADING_MODULE, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
||||||
import ListModel from '@/models/list'
|
import ListModel from '@/models/list'
|
||||||
import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue'
|
import QuickAddMagic from '@/components/tasks/partials/quick-add-magic.vue'
|
||||||
import {getHistory} from '../../modules/listHistory'
|
import {getHistory} from '@/modules/listHistory'
|
||||||
|
import {parseTaskText} from '@/modules/parseTaskText'
|
||||||
|
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
||||||
|
|
||||||
const TYPE_LIST = 'list'
|
const TYPE_LIST = 'list'
|
||||||
const TYPE_TASK = 'task'
|
const TYPE_TASK = 'task'
|
||||||
|
@ -236,6 +238,9 @@ export default {
|
||||||
|
|
||||||
return cmds
|
return cmds
|
||||||
},
|
},
|
||||||
|
parsedQuery() {
|
||||||
|
return parseTaskText(this.query, getQuickAddMagicMode())
|
||||||
|
},
|
||||||
searchMode() {
|
searchMode() {
|
||||||
if (this.query === '') {
|
if (this.query === '') {
|
||||||
return SEARCH_MODE_ALL
|
return SEARCH_MODE_ALL
|
||||||
|
@ -247,7 +252,7 @@ export default {
|
||||||
if (this.query.startsWith('*')) {
|
if (this.query.startsWith('*')) {
|
||||||
return SEARCH_MODE_LISTS
|
return SEARCH_MODE_LISTS
|
||||||
}
|
}
|
||||||
if (this.query.startsWith('@')) {
|
if (assignees.length > 0 && list === '' && text === '' && labels.length === 0) {
|
||||||
return SEARCH_MODE_TEAMS
|
return SEARCH_MODE_TEAMS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,12 +306,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let query = this.query
|
if (this.query === '' || this.selectedCmd !== null) {
|
||||||
if (this.searchMode === SEARCH_MODE_TEAMS) {
|
|
||||||
query = query.substr(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query === '' || this.selectedCmd !== null) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,12 +315,19 @@ export default {
|
||||||
this.teamSearchTimeout = null
|
this.teamSearchTimeout = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {assignees} = this.parsedQuery
|
||||||
|
|
||||||
this.teamSearchTimeout = setTimeout(async () => {
|
this.teamSearchTimeout = setTimeout(async () => {
|
||||||
const r = await this.teamService.getAll({}, {s: query})
|
const foundTeams = await Promise.all(assignees.map(t => {
|
||||||
this.foundTeams = r.map(t => {
|
return this.teamService.getAll({}, {s: t})
|
||||||
t.title = t.name
|
.then(r => {
|
||||||
return t
|
return r.map(t => {
|
||||||
})
|
t.title = t.name
|
||||||
|
return t
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
this.foundTeams = foundTeams.flat()
|
||||||
}, 150)
|
}, 150)
|
||||||
},
|
},
|
||||||
closeQuickActions() {
|
closeQuickActions() {
|
||||||
|
@ -348,7 +355,7 @@ export default {
|
||||||
this.doAction(this.results[0].type, this.results[0].items[0])
|
this.doAction(this.results[0].type, this.results[0].items[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.selectedCmd === null) {
|
if (this.selectedCmd === null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user