49 lines
2.0 KiB
Vue
49 lines
2.0 KiB
Vue
<script setup lang="ts">
|
|
import { storeToRefs } from "pinia";
|
|
import { computed } from "vue";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Section } from "@/components/ui/section";
|
|
import { attentionStatusIds, statusLabel } from "@/lib/task-meta";
|
|
import TaskRowActions from "@/tasks/TaskRowActions.vue";
|
|
import type { Task } from "@/tasks/TaskRow.vue";
|
|
import { useTasksStore } from "@/stores/tasks";
|
|
|
|
const { tasks } = storeToRefs(useTasksStore());
|
|
const loadDashboard = useTasksStore().load;
|
|
|
|
/** Tasks waiting on a human, each with the reason and the next action. */
|
|
type AttentionTask = Task & { park_reason?: string; plan?: string };
|
|
|
|
const waiting = computed(() => {
|
|
const ids = attentionStatusIds();
|
|
return ((tasks.value ?? []) as AttentionTask[]).filter((t) => t.status && ids.has(t.status));
|
|
});
|
|
|
|
function meta(task: AttentionTask): string {
|
|
const where = task.owner && task.repo ? `${task.owner}/${task.repo}${task.issue_url && task.issue_number ? ` #${task.issue_number}` : ""}` : "";
|
|
return [where, task.workflow, task.park_reason || task.plan].filter(Boolean).join(" · ");
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Section v-if="waiting.length" title="Needs attention" class="mb-0">
|
|
<template #action>
|
|
<Button variant="ghost" size="sm" as-child><RouterLink to="/tasks?status=needs_you">All tasks</RouterLink></Button>
|
|
</template>
|
|
<ul class="divide-y divide-border">
|
|
<li v-for="task in waiting" :key="task.id" class="flex flex-wrap items-center gap-3 py-2">
|
|
<Badge variant="warn">{{ statusLabel(task.status ?? "") }}</Badge>
|
|
<div class="min-w-0 flex-1">
|
|
<RouterLink :to="`/tasks/${task.id}`" class="block truncate font-medium hover:underline">{{
|
|
task.title || `Task ${task.id}`
|
|
}}</RouterLink>
|
|
<p class="truncate font-mono text-xs text-fg-subtle">{{ meta(task) }}</p>
|
|
</div>
|
|
<TaskRowActions :task="task" @done="loadDashboard" />
|
|
</li>
|
|
</ul>
|
|
</Section>
|
|
</template>
|