feat(ui): start tasks from the dashboard and slim it to activity and setup
This commit is contained in:
23 files changed
+297
-487
No files matched your search
+4
-16
@@ -10,15 +10,6 @@ export interface Summary {
|
||||
tokens_by_day?: Array<{ day: string; tokens?: number }>;
|
||||
}
|
||||
|
||||
export interface WorkflowStat {
|
||||
workflow?: string;
|
||||
runs?: number;
|
||||
merged?: number;
|
||||
completed?: number;
|
||||
pr_open?: number;
|
||||
parked?: number;
|
||||
}
|
||||
|
||||
/** An event off the live stream: the payload the detail column reads, plus
|
||||
* enough to point the row at the task it belongs to. */
|
||||
export interface ActivityEvent extends ActivityDetailInput {
|
||||
@@ -45,12 +36,11 @@ export function taskIDForEvent(event: ActivityEvent, bySource: Map<string, numbe
|
||||
return Number(bySource.get(`${event.repo}#${event.issue}`)) || 0;
|
||||
}
|
||||
|
||||
/** The board as the dashboard reads it: counts, setup progress, per-workflow
|
||||
* statistics and the recent tasks. The Tasks page pages its own list. */
|
||||
/** The board as the dashboard reads it: counts, setup progress and the
|
||||
* recent tasks. The Tasks page pages its own list. */
|
||||
export const useTasksStore = defineStore("tasks", () => {
|
||||
const summary = ref<Summary | null>(null);
|
||||
const setup = ref<Setup | null>(null);
|
||||
const workflows = ref<{ workflows?: WorkflowStat[] } | null>(null);
|
||||
// null means loading, [] means loaded.
|
||||
const tasks = ref<DashboardTask[] | null>(null);
|
||||
const error = ref<string | null>(null);
|
||||
@@ -59,10 +49,9 @@ export const useTasksStore = defineStore("tasks", () => {
|
||||
async function load(): Promise<void> {
|
||||
error.value = null;
|
||||
try {
|
||||
const [nextSummary, nextSetup, nextWorkflows, nextTasks] = await Promise.all([
|
||||
const [nextSummary, nextSetup, nextTasks] = await Promise.all([
|
||||
api.summary<Summary>(),
|
||||
api.setup<Setup>().catch(() => null),
|
||||
api.workflows<{ workflows?: WorkflowStat[] }>().catch(() => null),
|
||||
// Not defaulted to []: an empty list reads as "nothing needs you",
|
||||
// which a failed fetch must never claim.
|
||||
api.tasks<DashboardTask[]>(),
|
||||
@@ -75,7 +64,6 @@ export const useTasksStore = defineStore("tasks", () => {
|
||||
taskIDsBySource.value = map;
|
||||
summary.value = nextSummary;
|
||||
setup.value = nextSetup;
|
||||
workflows.value = nextWorkflows;
|
||||
tasks.value = nextTasks;
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
@@ -88,5 +76,5 @@ export const useTasksStore = defineStore("tasks", () => {
|
||||
return taskIDForEvent(event, taskIDsBySource.value);
|
||||
}
|
||||
|
||||
return { summary, setup, workflows, tasks, error, load, taskIDFor };
|
||||
return { summary, setup, tasks, error, load, taskIDFor };
|
||||
});
|
||||
Reference in new issue
Block a user