Factory: backlog column with queue buttons, status-tinted issue cards
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
51a60ee75e
commit
25e4167f56
9 files changed
+318
-4
No files matched your search
@@ -79,6 +79,15 @@ interface Issue {
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
}
|
||||
interface BacklogIssue {
|
||||
repo: string;
|
||||
number: number;
|
||||
title: string;
|
||||
author: string;
|
||||
url: string;
|
||||
allowed: boolean;
|
||||
labels: string[];
|
||||
}
|
||||
interface Run {
|
||||
id: string;
|
||||
repo: string;
|
||||
@@ -188,10 +197,21 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [recreate, setRecreate] = useState(false);
|
||||
|
||||
const reload = () =>
|
||||
get<Overview>("/factory/overview")
|
||||
const [backlog, setBacklog] = useState<BacklogIssue[]>([]);
|
||||
const [backlogErrors, setBacklogErrors] = useState<string[]>([]);
|
||||
const loadBacklog = (refresh = false) =>
|
||||
get<{ issues: BacklogIssue[]; errors: string[] }>(`/factory/backlog${refresh ? "?refresh=1" : ""}`)
|
||||
.then((r) => {
|
||||
setBacklog(r.issues);
|
||||
setBacklogErrors(r.errors);
|
||||
})
|
||||
.catch(() => {});
|
||||
const reload = () => {
|
||||
void loadBacklog();
|
||||
return get<Overview>("/factory/overview")
|
||||
.then(setData)
|
||||
.catch((e) => toast(e.message));
|
||||
};
|
||||
useEffect(() => {
|
||||
void reload();
|
||||
const h = setInterval(() => {
|
||||
@@ -263,6 +283,24 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
};
|
||||
|
||||
const issues = useMemo(() => (data?.issues ?? []).filter((i) => !repo || i.repo === repo), [data, repo]);
|
||||
const backlogShown = useMemo(() => backlog.filter((i) => !repo || i.repo === repo), [backlog, repo]);
|
||||
/** Put backlog issues into the process (they get the factory label on the forge). */
|
||||
const enqueue = async (items: BacklogIssue[]) => {
|
||||
if (items.length === 0) return;
|
||||
if (items.length > 1 && !(await confirmDialog({ message: t("factory.backlog.allConfirm", { n: items.length }), confirmLabel: t("factory.backlog.queueAll") }))) return;
|
||||
setBusy(true);
|
||||
try {
|
||||
for (const r of [...new Set(items.map((i) => i.repo))]) {
|
||||
const res = await post<{ queued: number[]; errors: { number: number; error: string }[] }>("/factory/backlog/enqueue", { repo: r, numbers: items.filter((i) => i.repo === r).map((i) => i.number) });
|
||||
for (const e of res.errors) toast(`#${e.number}: ${e.error}`);
|
||||
}
|
||||
} catch (e: any) {
|
||||
toast(e.message);
|
||||
}
|
||||
setBusy(false);
|
||||
await loadBacklog(true);
|
||||
await reload();
|
||||
};
|
||||
const runs = useMemo(() => (data?.runs ?? []).filter((r) => !repo || r.repo === repo), [data, repo]);
|
||||
const selected = issues.find((i) => `${i.repo}#${i.number}` === sel);
|
||||
const [pr, setPr] = useState<PrInfo | null>(null);
|
||||
@@ -462,6 +500,31 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
</div>
|
||||
|
||||
<div className="factory-board">
|
||||
<div className="factory-col backlog">
|
||||
<h4>
|
||||
{t("factory.col.backlog")} <span className="chip">{backlogShown.length}</span>
|
||||
</h4>
|
||||
{backlogShown.length > 1 && (
|
||||
<button className="small" onClick={() => void enqueue(backlogShown.filter((i) => i.allowed))} disabled={busy || !backlogShown.some((i) => i.allowed)} title={t("factory.backlog.queueAllHint")}>
|
||||
<Icon name="plus" /> {t("factory.backlog.queueAll")}
|
||||
</button>
|
||||
)}
|
||||
{backlogShown.map((i) => (
|
||||
<div key={`${i.repo}#${i.number}`} className="factory-card backlog">
|
||||
<span className="hint">
|
||||
{repoName(i.repo)} #{i.number} · {i.author}
|
||||
</span>
|
||||
<a href={i.url || issueUrl(i.repo, i.number)} target="_blank" rel="noreferrer">
|
||||
<b>{i.title || `#${i.number}`}</b>
|
||||
</a>
|
||||
<button className="small" onClick={() => void enqueue([i])} disabled={busy || !i.allowed} title={i.allowed ? t("factory.backlog.queueHint") : t("factory.backlog.notAllowed", { user: i.author })}>
|
||||
<Icon name="plus" /> {t("factory.backlog.queue")}
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
{backlogShown.length === 0 && <span className="hint">{t("factory.backlog.empty")}</span>}
|
||||
{backlogErrors.length > 0 && <span className="hint" title={backlogErrors.join("\n")}>{t("factory.backlog.error")}</span>}
|
||||
</div>
|
||||
{COLUMNS.map((c) => {
|
||||
const cards = issues.filter((i) => c.states.includes(i.state));
|
||||
return (
|
||||
@@ -475,7 +538,7 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
const latest = active ?? rs[0];
|
||||
const tokens = rs.reduce((a, r) => a + r.input_tokens + r.output_tokens, 0);
|
||||
return (
|
||||
<button key={`${i.repo}#${i.number}`} className={`factory-card ${sel === `${i.repo}#${i.number}` ? "active" : ""} ${active ? "running" : ""}`} onClick={() => setSel(sel === `${i.repo}#${i.number}` ? "" : `${i.repo}#${i.number}`)}>
|
||||
<button key={`${i.repo}#${i.number}`} data-state={i.state} className={`factory-card ${sel === `${i.repo}#${i.number}` ? "active" : ""} ${active ? "running" : ""}`} onClick={() => setSel(sel === `${i.repo}#${i.number}` ? "" : `${i.repo}#${i.number}`)}>
|
||||
<span className="hint">
|
||||
{repoName(i.repo)} #{i.number}
|
||||
</span>
|
||||
|
||||
@@ -1226,6 +1226,15 @@ export const de: Messages = {
|
||||
"factory.repoLine": "{n} Issues · {run} laufen",
|
||||
"factory.noToken": "kein Token",
|
||||
"factory.pollNow": "Jetzt prüfen",
|
||||
"factory.backlog.queue": "Einreihen",
|
||||
"factory.backlog.queueAll": "Alle einreihen",
|
||||
"factory.backlog.queueHint": "Dem Issue das Factory-Label geben, damit es in den Prozess kommt",
|
||||
"factory.backlog.queueAllHint": "Alle Issues dieser Liste einreihen",
|
||||
"factory.backlog.allConfirm": "{n} Issues einreihen? Sie bekommen das Factory-Label im Forge und werden nacheinander geprüft.",
|
||||
"factory.backlog.notAllowed": "{user} darf keine Factory-Issues anlegen (Repository-Einstellungen → erlaubte Nutzer)",
|
||||
"factory.backlog.empty": "Keine offenen Issues außerhalb der Factory",
|
||||
"factory.backlog.error": "Der Forge konnte für einige Projekte nicht gelesen werden",
|
||||
"factory.col.backlog": "Backlog",
|
||||
"factory.col.review": "Prüfung",
|
||||
"factory.col.question": "Rückfragen",
|
||||
"factory.col.approved": "Freigegeben",
|
||||
|
||||
@@ -1225,6 +1225,15 @@ export const en = {
|
||||
"factory.repoLine": "{n} issues · {run} running",
|
||||
"factory.noToken": "no token",
|
||||
"factory.pollNow": "Check now",
|
||||
"factory.backlog.queue": "Queue",
|
||||
"factory.backlog.queueAll": "Queue all",
|
||||
"factory.backlog.queueHint": "Give the issue the factory label so that it enters the process",
|
||||
"factory.backlog.queueAllHint": "Queue all issues of this list",
|
||||
"factory.backlog.allConfirm": "Queue {n} issues? They get the factory label on the forge and are reviewed one after another.",
|
||||
"factory.backlog.notAllowed": "{user} is not allowed to file factory issues (repository settings → allowed users)",
|
||||
"factory.backlog.empty": "No open issues outside the factory",
|
||||
"factory.backlog.error": "The forge could not be read for some projects",
|
||||
"factory.col.backlog": "Backlog",
|
||||
"factory.col.review": "Review",
|
||||
"factory.col.question": "Questions",
|
||||
"factory.col.approved": "Approved",
|
||||
|
||||
@@ -5107,6 +5107,46 @@ td.fold-indent {
|
||||
border-radius: 8px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
/* A faint tint by status, also on the border; --tone is set per state. */
|
||||
.factory-card[data-state] {
|
||||
--tone: var(--muted);
|
||||
border-color: color-mix(in srgb, var(--tone) 50%, var(--bg2));
|
||||
background: color-mix(in srgb, var(--tone) 7%, var(--bg0));
|
||||
}
|
||||
.factory-card[data-state="new"],
|
||||
.factory-card[data-state="review"] {
|
||||
--tone: var(--aqua);
|
||||
}
|
||||
.factory-card[data-state="question"] {
|
||||
--tone: var(--accent);
|
||||
}
|
||||
.factory-card[data-state="approved"] {
|
||||
--tone: var(--blue);
|
||||
}
|
||||
.factory-card[data-state="building"],
|
||||
.factory-card[data-state="rework"] {
|
||||
--tone: var(--purple);
|
||||
}
|
||||
.factory-card[data-state="qa"],
|
||||
.factory-card[data-state="testing"] {
|
||||
--tone: var(--accent2);
|
||||
}
|
||||
.factory-card[data-state="failed"],
|
||||
.factory-card[data-state="rejected"] {
|
||||
--tone: var(--red);
|
||||
}
|
||||
.factory-card[data-state="done"] {
|
||||
--tone: var(--green);
|
||||
}
|
||||
.factory-card.backlog {
|
||||
gap: 4px;
|
||||
border-style: dashed;
|
||||
color: inherit;
|
||||
}
|
||||
.factory-card.backlog a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
.factory-card.active {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
unreleased: {
|
||||
en: ["Factory: backlog column with all open issues of the forge – queue them into the process with one click", "Factory: issue cards are faintly tinted by status, including the border"],
|
||||
de: ["Factory: Backlog-Spalte mit allen offenen Issues des Forges – mit einem Klick in den Prozess einreihen", "Factory: Issue-Karten sind dezent nach Status eingefärbt, auch der Rahmen"],
|
||||
},
|
||||
"202611-00068": {
|
||||
en: ["Test runner: \"isolated\": false in .factory/setup.json for apps that cannot run in a container"],
|
||||
de: ["Test-Runner: \"isolated\": false in .factory/setup.json für Apps, die nicht im Container laufen können"],
|
||||
|
||||
Reference in new issue
Block a user