chore: format

This commit is contained in:
kolaente 2023-08-29 09:19:52 +02:00
parent 53434952d3
commit c3f85fcb19
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -134,7 +134,7 @@ function closeQuickActions() {
} }
const foundProjects = computed(() => { const foundProjects = computed(() => {
const { project } = parsedQuery.value const {project} = parsedQuery.value
if ( if (
searchMode.value === SEARCH_MODE.ALL || searchMode.value === SEARCH_MODE.ALL ||
searchMode.value === SEARCH_MODE.PROJECTS || searchMode.value === SEARCH_MODE.PROJECTS ||
@ -190,7 +190,7 @@ const results = computed<Result[]>(() => {
].filter((i) => i.items.length > 0) ].filter((i) => i.items.length > 0)
}) })
const loading = computed(() => const loading = computed(() =>
taskService.loading || taskService.loading ||
projectStore.isLoading || projectStore.isLoading ||
teamService.loading, teamService.loading,
@ -262,7 +262,7 @@ const searchMode = computed(() => {
if (query.value === '') { if (query.value === '') {
return SEARCH_MODE.ALL return SEARCH_MODE.ALL
} }
const { text, project, labels, assignees } = parsedQuery.value const {text, project, labels, assignees} = parsedQuery.value
if (assignees.length === 0 && text !== '') { if (assignees.length === 0 && text !== '') {
return SEARCH_MODE.TASKS return SEARCH_MODE.TASKS
} }
@ -292,12 +292,12 @@ const isNewTaskCommand = computed(() => (
const taskSearchTimeout = ref<ReturnType<typeof setTimeout> | null>(null) const taskSearchTimeout = ref<ReturnType<typeof setTimeout> | null>(null)
type Filter = {by: string, value: string | number, comparator: string} type Filter = { by: string, value: string | number, comparator: string }
function filtersToParams(filters: Filter[]) { function filtersToParams(filters: Filter[]) {
const filter_by : Filter['by'][] = [] const filter_by: Filter['by'][] = []
const filter_value : Filter['value'][] = [] const filter_value: Filter['value'][] = []
const filter_comparator : Filter['comparator'][] = [] const filter_comparator: Filter['comparator'][] = []
filters.forEach(({by, value, comparator}) => { filters.forEach(({by, value, comparator}) => {
filter_by.push(by) filter_by.push(by)
@ -330,7 +330,7 @@ function searchTasks() {
taskSearchTimeout.value = null taskSearchTimeout.value = null
} }
const { text, project: projectName, labels } = parsedQuery.value const {text, project: projectName, labels} = parsedQuery.value
const filters: Filter[] = [] const filters: Filter[] = []
@ -361,13 +361,13 @@ function searchTasks() {
} }
} }
const params = { const params = {
s: text, s: text,
...filtersToParams(filters), ...filtersToParams(filters),
} }
taskSearchTimeout.value = setTimeout(async () => { taskSearchTimeout.value = setTimeout(async () => {
const r = await taskService.getAll({}, params) as DoAction<ITask>[] const r = await taskService.getAll({}, params) as DoAction<ITask>[]
foundTasks.value = r.map((t) => { foundTasks.value = r.map((t) => {
t.type = ACTION_TYPE.TASK t.type = ACTION_TYPE.TASK
const project = projectStore.projects[t.projectId] const project = projectStore.projects[t.projectId]
@ -396,10 +396,10 @@ function searchTeams() {
clearTimeout(teamSearchTimeout.value) clearTimeout(teamSearchTimeout.value)
teamSearchTimeout.value = null teamSearchTimeout.value = null
} }
const { assignees } = parsedQuery.value const {assignees} = parsedQuery.value
teamSearchTimeout.value = setTimeout(async () => { teamSearchTimeout.value = setTimeout(async () => {
const teamSearchPromises = assignees.map((t) => const teamSearchPromises = assignees.map((t) =>
teamService.getAll({}, { s: t }), teamService.getAll({}, {s: t}),
) )
const teamsResult = await Promise.all(teamSearchPromises) const teamsResult = await Promise.all(teamSearchPromises)
foundTeams.value = teamsResult.flat().map((team) => { foundTeams.value = teamsResult.flat().map((team) => {
@ -422,21 +422,21 @@ async function doAction(type: ACTION_TYPE, item: DoAction) {
closeQuickActions() closeQuickActions()
await router.push({ await router.push({
name: 'project.index', name: 'project.index',
params: { projectId: (item as DoAction<IProject>).id }, params: {projectId: (item as DoAction<IProject>).id},
}) })
break break
case ACTION_TYPE.TASK: case ACTION_TYPE.TASK:
closeQuickActions() closeQuickActions()
await router.push({ await router.push({
name: 'task.detail', name: 'task.detail',
params: { id: (item as DoAction<ITask>).id }, params: {id: (item as DoAction<ITask>).id},
}) })
break break
case ACTION_TYPE.TEAM: case ACTION_TYPE.TEAM:
closeQuickActions() closeQuickActions()
await router.push({ await router.push({
name: 'teams.edit', name: 'teams.edit',
params: { id: (item as DoAction<ITeam>).id }, params: {id: (item as DoAction<ITeam>).id},
}) })
break break
case ACTION_TYPE.CMD: case ACTION_TYPE.CMD:
@ -470,8 +470,8 @@ async function newTask() {
title: query.value, title: query.value,
projectId: currentProject.value.id, projectId: currentProject.value.id,
}) })
success({ message: t('task.createSuccess') }) success({message: t('task.createSuccess')})
await router.push({ name: 'task.detail', params: { id: task.id } }) await router.push({name: 'task.detail', params: {id: task.id}})
} }
async function newProject() { async function newProject() {
@ -481,17 +481,17 @@ async function newProject() {
await projectStore.createProject(new ProjectModel({ await projectStore.createProject(new ProjectModel({
title: query.value, title: query.value,
})) }))
success({ message: t('project.create.createdSuccess')}) success({message: t('project.create.createdSuccess')})
} }
async function newTeam() { async function newTeam() {
const newTeam = new TeamModel({ name: query.value }) const newTeam = new TeamModel({name: query.value})
const team = await teamService.create(newTeam) const team = await teamService.create(newTeam)
await router.push({ await router.push({
name: 'teams.edit', name: 'teams.edit',
params: { id: team.id }, params: {id: team.id},
}) })
success({ message: t('team.create.success') }) success({message: t('team.create.success')})
} }
type BaseButtonInstance = InstanceType<typeof BaseButton> type BaseButtonInstance = InstanceType<typeof BaseButton>
@ -502,7 +502,7 @@ function setResultRefs(el: Element | ComponentPublicInstance | null, index: numb
resultRefs.value[index] = [] resultRefs.value[index] = []
} }
resultRefs.value[index][key] = el as (BaseButtonInstance | null) resultRefs.value[index][key] = el as (BaseButtonInstance | null)
} }
function select(parentIndex: number, index: number) { function select(parentIndex: number, index: number) {
@ -547,7 +547,7 @@ function reset() {
<style lang="scss" scoped> <style lang="scss" scoped>
.quick-actions { .quick-actions {
overflow: hidden; overflow: hidden;
// FIXME: changed position should be an option of the modal // FIXME: changed position should be an option of the modal
:deep(.modal-content) { :deep(.modal-content) {
top: 3rem; top: 3rem;
@ -569,6 +569,7 @@ function reset() {
} }
} }
.active-cmd { .active-cmd {
font-size: 1.25rem; font-size: 1.25rem;
margin-left: .5rem; margin-left: .5rem;