feat(quick actions): show tasks for a label when selecting it
This commit is contained in:
parent
442d0342a9
commit
99d8fbdfa7
@ -83,6 +83,7 @@ import {success} from '@/message'
|
|||||||
import type {ITeam} from '@/modelTypes/ITeam'
|
import type {ITeam} from '@/modelTypes/ITeam'
|
||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
import type {IProject} from '@/modelTypes/IProject'
|
import type {IProject} from '@/modelTypes/IProject'
|
||||||
|
import type {ILabel} from '@/modelTypes/ILabel'
|
||||||
|
|
||||||
const {t} = useI18n({useScope: 'global'})
|
const {t} = useI18n({useScope: 'global'})
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -100,6 +101,7 @@ enum ACTION_TYPE {
|
|||||||
TASK = 'task',
|
TASK = 'task',
|
||||||
PROJECT = 'project',
|
PROJECT = 'project',
|
||||||
TEAM = 'team',
|
TEAM = 'team',
|
||||||
|
LABELS = 'labels',
|
||||||
}
|
}
|
||||||
|
|
||||||
enum COMMAND_TYPE {
|
enum COMMAND_TYPE {
|
||||||
@ -152,6 +154,19 @@ const foundProjects = computed(() => {
|
|||||||
.filter(p => Boolean(p))
|
.filter(p => Boolean(p))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const foundLabels = computed(() => {
|
||||||
|
const {labels, text} = parsedQuery.value
|
||||||
|
if (text === '' && labels.length === 0) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labels.length > 0) {
|
||||||
|
return labelStore.filterLabelsByQuery([], labels[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
return labelStore.filterLabelsByQuery([], text)
|
||||||
|
})
|
||||||
|
|
||||||
// FIXME: use fuzzysearch
|
// FIXME: use fuzzysearch
|
||||||
const foundCommands = computed(() => availableCmds.value.filter((a) =>
|
const foundCommands = computed(() => availableCmds.value.filter((a) =>
|
||||||
a.title.toLowerCase().includes(query.value.toLowerCase()),
|
a.title.toLowerCase().includes(query.value.toLowerCase()),
|
||||||
@ -180,6 +195,11 @@ const results = computed<Result[]>(() => {
|
|||||||
title: t('quickActions.tasks'),
|
title: t('quickActions.tasks'),
|
||||||
items: foundTasks.value,
|
items: foundTasks.value,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: ACTION_TYPE.LABELS,
|
||||||
|
title: t('quickActions.labels'),
|
||||||
|
items: foundLabels.value,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: ACTION_TYPE.TEAM,
|
type: ACTION_TYPE.TEAM,
|
||||||
title: t('quickActions.teams'),
|
title: t('quickActions.teams'),
|
||||||
@ -447,6 +467,11 @@ async function doAction(type: ACTION_TYPE, item: DoAction) {
|
|||||||
selectedCmd.value = item as DoAction<Command>
|
selectedCmd.value = item as DoAction<Command>
|
||||||
searchInput.value?.focus()
|
searchInput.value?.focus()
|
||||||
break
|
break
|
||||||
|
case ACTION_TYPE.LABELS:
|
||||||
|
query.value = '*'+item.title
|
||||||
|
searchInput.value?.focus()
|
||||||
|
searchTasks()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,6 +905,7 @@
|
|||||||
"tasks": "Tasks",
|
"tasks": "Tasks",
|
||||||
"projects": "Projects",
|
"projects": "Projects",
|
||||||
"teams": "Teams",
|
"teams": "Teams",
|
||||||
|
"labels": "Labels",
|
||||||
"newProject": "Enter the title of the new project…",
|
"newProject": "Enter the title of the new project…",
|
||||||
"newTask": "Enter the title of the new task…",
|
"newTask": "Enter the title of the new task…",
|
||||||
"newTeam": "Enter the name of the new team…",
|
"newTeam": "Enter the name of the new team…",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user