Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

fix: #119

Nikolai Giman6cf55ec6defe
diff --git a/web/src/components/features/tasks/parts/TaskDependencies.types.ts b/web/src/components/features/tasks/parts/TaskDependencies.types.ts
index 3dc38cb..de46f0a 100644
--- a/web/src/components/features/tasks/parts/TaskDependencies.types.ts
+++ b/web/src/components/features/tasks/parts/TaskDependencies.types.ts
@@ -8,3 +8,9 @@ export type DependencyEntry = {
edgeId: number
task: DependencyTask
}
+
+export type DependencyEdgeAddArgs = {
+ source: number
+ target: number
+ task: DependencyTask
+}
diff --git a/web/src/components/features/tasks/parts/TaskDependencies.vue b/web/src/components/features/tasks/parts/TaskDependencies.vue
index dc081f7..53054fe 100644
--- a/web/src/components/features/tasks/parts/TaskDependencies.vue
+++ b/web/src/components/features/tasks/parts/TaskDependencies.vue
@@ -52,7 +52,7 @@ import { logError } from '@/helpers/Helper'
import { useGoalPermissions } from '@/composables/useGoalPermissions'
import { useTaskDetailPanel } from '@/composables/useTaskDetailPanel'
import TaskDependencyGroup from './TaskDependencyGroup.vue'
-import type { DependencyEntry, DependencyTask } from './TaskDependencies.types'
+import type { DependencyEdgeAddArgs, DependencyEntry, DependencyTask } from './TaskDependencies.types'
const props = defineProps<{
taskId: number
@@ -60,6 +60,7 @@ const props = defineProps<{
}>()
const { t } = useI18n()
+const toast = useToast()
const { canViewGraph, canManageGraph } = useGoalPermissions()
const { openTask } = useTaskDetailPanel()
@@ -111,9 +112,12 @@ async function load() {
watch(() => props.taskId, load, { immediate: true })
-async function addEdge({ source, target, task }: { source: number; target: number; task: DependencyTask }) {
+async function addEdge({ source, target, task }: DependencyEdgeAddArgs) {
const edge = await $tvApi.graph.addEdge({ source, target }).catch((err: unknown) => logError(err))
- if (!edge) return
+ if (!edge) {
+ toast.add({ title: t('tasks.dependencies.addFailed'), color: 'error' })
+ return
+ }
taskNames.value.set(task.id, task)
edges.value.push(edge)
}
diff --git a/web/src/components/features/tasks/parts/TaskDependencyGroup.vue b/web/src/components/features/tasks/parts/TaskDependencyGroup.vue
index 45c816c..c738ec8 100644
--- a/web/src/components/features/tasks/parts/TaskDependencyGroup.vue
+++ b/web/src/components/features/tasks/parts/TaskDependencyGroup.vue
@@ -1,5 +1,8 @@
<template>
- <div class="flex flex-col gap-1 min-w-0 h-full">
+ <div
+ class="flex flex-col gap-1 min-w-0 h-full"
+ :data-testid="`dependency-group-${direction}`"
+ >
<div class="flex items-center gap-1.5 px-1">
<UIcon
:name="icon"
diff --git a/web/src/components/features/tasks/parts/TaskDependencyPicker.vue b/web/src/components/features/tasks/parts/TaskDependencyPicker.vue
index a3ab269..c323ed3 100644
--- a/web/src/components/features/tasks/parts/TaskDependencyPicker.vue
+++ b/web/src/components/features/tasks/parts/TaskDependencyPicker.vue
@@ -12,6 +12,7 @@
block
class="text-muted"
:ui="{ base: 'rounded-xl justify-start' }"
+ data-testid="dependency-add"
/>
<template #content>
<div class="w-72 p-2 flex flex-col gap-2">
@@ -23,6 +24,7 @@
size="sm"
autofocus
:loading="loading"
+ data-testid="dependency-search"
/>
<div class="max-h-64 overflow-y-auto flex flex-col gap-0.5">
<button
@@ -51,6 +53,20 @@
{{ t('tasks.dependencies.noResults') }}
</p>
</div>
+ <UButton
+ v-if="canAddTask && newTaskName"
+ icon="i-lucide-plus"
+ :label="t('tasks.dependencies.create', { name: newTaskName })"
+ :loading="creating"
+ color="primary"
+ variant="ghost"
+ size="sm"
+ block
+ class="justify-start"
+ :ui="{ label: 'truncate' }"
+ data-testid="dependency-create"
+ @click="create"
+ />
</div>
</template>
</UPopover>
@@ -63,6 +79,7 @@ import { useDebounceFn } from '@vueuse/core'
import { ALL_TASKS_LIST_ID } from 'taskview-api'
import { $tvApi } from '@/plugins/axios'
import { logError } from '@/helpers/Helper'
+import { useGoalPermissions } from '@/composables/useGoalPermissions'
import type { DependencyTask } from './TaskDependencies.types'
const props = defineProps<{
@@ -75,12 +92,17 @@ const emit = defineEmits<{
}>()
const { t } = useI18n()
+const toast = useToast()
+const { canAddTask } = useGoalPermissions()
const open = ref(false)
const query = ref('')
const loading = ref(false)
+const creating = ref(false)
const results = ref<DependencyTask[]>([])
+const newTaskName = computed(() => query.value.trim())
+
const options = computed(() =>
results.value.filter((task) => !props.excludedIds.includes(task.id)),
)
@@ -118,4 +140,18 @@ function pick(task: DependencyTask) {
open.value = false
emit('select', task)
}
+
+async function create() {
+ if (!newTaskName.value || creating.value) return
+ creating.value = true
+ const task = await $tvApi.tasks
+ .createTask({ goalId: props.goalId, description: newTaskName.value })
+ .catch((err: unknown) => logError(err))
+ creating.value = false
+ if (!task) {
+ toast.add({ title: t('tasks.dependencies.createFailed'), color: 'error' })
+ return
+ }
+ pick({ id: task.id, description: task.description, complete: task.complete })
+}
</script>
diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts
index 73546a2..77e817e 100644
--- a/web/src/locales/de.ts
+++ b/web/src/locales/de.ts
@@ -555,6 +555,9 @@ export default {
searchPlaceholder: 'Aufgaben suchen…',
noResults: 'Nichts gefunden',
none: 'Keine',
+ create: 'Aufgabe „{name}“ erstellen',
+ createFailed: 'Aufgabe konnte nicht erstellt werden',
+ addFailed: 'Abhängigkeit konnte nicht hinzugefügt werden',
},
status: 'Status',
selectStatus: 'Status auswählen',
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index e13e272..f387f76 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -569,6 +569,9 @@ export default {
searchPlaceholder: 'Search tasks…',
noResults: 'Nothing found',
none: 'None',
+ create: 'Create task “{name}”',
+ createFailed: 'Failed to create the task',
+ addFailed: 'Failed to add the dependency',
},
status: 'Status',
selectStatus: 'Select status',
diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts
index 35dc897..c87bb73 100644
--- a/web/src/locales/es.ts
+++ b/web/src/locales/es.ts
@@ -555,6 +555,9 @@ export default {
searchPlaceholder: 'Buscar tareas…',
noResults: 'Sin resultados',
none: 'Ninguna',
+ create: 'Crear tarea «{name}»',
+ createFailed: 'No se pudo crear la tarea',
+ addFailed: 'No se pudo añadir la dependencia',
},
status: 'Estado',
selectStatus: 'Seleccionar estado',
diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts
index 2af5f03..040a73a 100644
--- a/web/src/locales/pt-br.ts
+++ b/web/src/locales/pt-br.ts
@@ -568,6 +568,9 @@ export default {
searchPlaceholder: 'Buscar tarefas…',
noResults: 'Nada encontrado',
none: 'Nenhuma',
+ create: 'Criar tarefa “{name}”',
+ createFailed: 'Não foi possível criar a tarefa',
+ addFailed: 'Não foi possível adicionar a dependência',
},
status: 'Status',
selectStatus: 'Selecionar status',
diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts
index fa812b8..cba77a0 100644
--- a/web/src/locales/ru.ts
+++ b/web/src/locales/ru.ts
@@ -536,6 +536,9 @@ export default {
searchPlaceholder: 'Поиск задач…',
noResults: 'Ничего не найдено',
none: 'Нет',
+ create: 'Создать задачу «{name}»',
+ createFailed: 'Не удалось создать задачу',
+ addFailed: 'Не удалось добавить зависимость',
},
status: 'Статус',
selectStatus: 'Выбрать статус',