mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Show the saved diagnosis in full on the Diagnose finish, with Copy report for a ticket elsewhere
AI Assisted
This commit is contained in:
1 parent
8bb1b11296
commit
15d66aa19c
6 files changed
+156
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// Plan2Code Web Console - how a session ends: the finished screen, its offers, Stop and the way home; defines only.
|
||||
|
||||
import { el, md, copyButton, textWithCode, SVG_NS } from "../render.js";
|
||||
import { el, md, copyButton, copyText, selectContents, textWithCode, SVG_NS } from "../render.js";
|
||||
import {
|
||||
finishPaused,
|
||||
reviewOffer,
|
||||
@@ -345,6 +345,45 @@ export function renderLoopEnd(end) {
|
||||
return card;
|
||||
}
|
||||
|
||||
// The Markdown of Diagnose's saved write-up, or null: only a diagnose finish
|
||||
// whose doc mirrors a file on disk (nothing is saved when the bug did not
|
||||
// reproduce, and a doc living only on the page is no report yet).
|
||||
function diagnosisReport(fin) {
|
||||
if (!page.S || page.S.workflow !== "diagnose") return null;
|
||||
const doc = docs().find((d) => d.id === fin.doc);
|
||||
if (!doc || !doc.saved) return null;
|
||||
const text = (doc.blocks || [])
|
||||
.map((b) => (typeof b.md === "string" ? b.md : ""))
|
||||
.filter((t) => t.trim())
|
||||
.join("\n\n");
|
||||
return text.trim() ? text : null;
|
||||
}
|
||||
|
||||
function renderReport(text) {
|
||||
const box = el("section", "handoff-report");
|
||||
const head = el("div", "handoff-report-head");
|
||||
head.appendChild(el("p", "handoff-label", "Bug report"));
|
||||
const body = md(text, "md handoff-report-body");
|
||||
// It scrolls past a set height and holds nothing focusable, so it takes a
|
||||
// keyboard stop of its own to be read without a mouse.
|
||||
body.tabIndex = 0;
|
||||
body.setAttribute("role", "region");
|
||||
body.setAttribute("aria-label", "Bug report");
|
||||
const copy = el("button", "btn small", "Copy report");
|
||||
copy.type = "button";
|
||||
// Word for word what the file holds, so it pastes into a ticket as Markdown.
|
||||
copy.addEventListener("click", () =>
|
||||
copyText(text, copy, "Copy report", () => {
|
||||
selectContents(body);
|
||||
copy.textContent = "Press Ctrl+C";
|
||||
})
|
||||
);
|
||||
head.appendChild(copy);
|
||||
box.appendChild(head);
|
||||
box.appendChild(body);
|
||||
return box;
|
||||
}
|
||||
|
||||
export function renderHandoff(fin) {
|
||||
if (page.S && page.S.loopEnd) return renderLoopEnd(page.S.loopEnd);
|
||||
const card = el("article", "card handoff");
|
||||
@@ -352,6 +391,11 @@ export function renderHandoff(fin) {
|
||||
card.appendChild(el("h2", null, fin.headline));
|
||||
if (fin.body) card.appendChild(md(fin.body, "md prompt"));
|
||||
|
||||
// A diagnosed bug often goes into another team's ticket system rather than
|
||||
// being fixed here, so the saved write-up is shown whole, above the hand-off.
|
||||
const report = diagnosisReport(fin);
|
||||
if (report) card.appendChild(renderReport(report));
|
||||
|
||||
// Every press below is waiting on an agent that is gone: the way off this
|
||||
// page must not be one of them.
|
||||
if (pressStranded()) card.appendChild(renderStrandedEscape());
|
||||
|
||||
@@ -13,6 +13,24 @@
|
||||
border: 1px solid var(--accent-line);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
/* Diagnose's saved write-up, whole, for pasting into a ticket elsewhere. It
|
||||
scrolls past a set height so Next step stays close below it. */
|
||||
.handoff-report {
|
||||
margin: 20px 0 0;
|
||||
padding: 14px 18px 16px;
|
||||
border: 1px solid var(--rule-2);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
.handoff-report-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.handoff-report-head .handoff-label { margin: 0; }
|
||||
.handoff-report-body { max-height: 420px; overflow-y: auto; }
|
||||
|
||||
.handoff-label {
|
||||
margin: 0 0 6px;
|
||||
font-size: 11px;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
.layout { display: block; overflow: visible; }
|
||||
.main { overflow: visible; padding: 0; max-width: none; }
|
||||
.main > * { max-width: none; }
|
||||
/* The diagnosis prints whole, not cut at the box's on-screen height. */
|
||||
.handoff-report-body { max-height: none; overflow: visible; }
|
||||
.block, .card { break-inside: avoid; box-shadow: none; }
|
||||
.doc-head { border-bottom: 1px solid #ccc; }
|
||||
.md a { color: #000; }
|
||||
|
||||
Reference in new issue
Block a user