Human-facing task state
This commit is contained in:
Vendored
+8
-9
@@ -2,7 +2,7 @@ import { get, post } from "./api.js";
|
||||
import { errorText, h, replace, showAlert } from "./dom.js";
|
||||
import { markdown } from "./markdown.js";
|
||||
import { models } from "./task.js";
|
||||
import { currentSession, findTask, focusedProject, focusTask, on, onEach, state, taskState } from "./state.js";
|
||||
import { findTask, focusedProject, focusTask, on, onEach, state, taskState } from "./state.js";
|
||||
import { taskStyle } from "./taskcolor.js";
|
||||
const refreshKinds = new Set(["task.merged", "project.created"]);
|
||||
export function mountProject(root) {
|
||||
@@ -100,12 +100,11 @@ function nested(active) {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
const busyStates = new Set(["running", "reviewing", "merging", "discarding"]);
|
||||
function stateMark(s) {
|
||||
if (s !== undefined && busyStates.has(s)) {
|
||||
return h("span", { class: "spinner", title: s });
|
||||
function stateMark(ts) {
|
||||
if (ts.kind === "working" || ts.kind === "merging") {
|
||||
return h("span", { class: "spinner", title: ts.title });
|
||||
}
|
||||
return h("span", { class: `dot ${s ?? "none"}`, title: s ?? "no session" });
|
||||
return h("span", { class: `dot ${ts.kind}`, title: ts.title });
|
||||
}
|
||||
function tasksBlock(active) {
|
||||
if (active.length === 0) {
|
||||
@@ -121,7 +120,7 @@ function tasksBlock(active) {
|
||||
e.preventDefault();
|
||||
focusTask(task.id);
|
||||
},
|
||||
}, task.parent_task_id !== undefined && h("span", { class: "subtask-mark", title: `Subtask of ${findTask(task.parent_task_id)?.title ?? task.parent_task_id}` }, "↳"), stateMark(ts), h("span", { class: "task-title task-name" }, task.title), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), task.merge_queued_at !== undefined && h("span", { class: "task-state warn", title: "Waiting for the merge in progress in this project to finish" }, "merge held"), task.merging_into_parent && h("span", { class: "task-state warn", title: "Waiting for the parent task's agent to merge it" }, "merging into parent"), h("span", { class: "task-state" }, ts ?? "no agent")));
|
||||
}, task.parent_task_id !== undefined && h("span", { class: "subtask-mark", title: `Subtask of ${findTask(task.parent_task_id)?.title ?? task.parent_task_id}` }, "↳"), stateMark(ts), h("span", { class: "task-title task-name" }, task.title), count > 0 && h("span", { class: "badge", title: "inbox items" }, count), h("span", { class: `task-state ${ts.kind}`, title: ts.title }, ts.label)));
|
||||
}));
|
||||
}
|
||||
function todoBlock(project, todo, active, starting, start) {
|
||||
@@ -152,7 +151,7 @@ function todoBlock(project, todo, active, starting, start) {
|
||||
const task = active.find((t) => t.todo_item === item.title);
|
||||
let action;
|
||||
if (task) {
|
||||
const sess = currentSession(task.id);
|
||||
const ts = taskState(task);
|
||||
action = h("a", {
|
||||
class: "todo-task",
|
||||
href: `#/task/${task.id}`,
|
||||
@@ -160,7 +159,7 @@ function todoBlock(project, todo, active, starting, start) {
|
||||
e.preventDefault();
|
||||
focusTask(task.id);
|
||||
},
|
||||
}, stateMark(sess?.state), sess?.state ?? "no agent");
|
||||
}, stateMark(ts), ts.label);
|
||||
}
|
||||
else {
|
||||
const busy = starting.has(`${project.id}\n${item.title}`);
|
||||
|
||||
Reference in New Issue
Block a user