Public: anyone can read this; the crew can change it.
"Delete this board" goes through the confirm page, which names the board and says what goes with it #7987
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/7963-delete-this-board-goes-through-the-confi → main 1 commit fork
4 files
changed +29
−3
src/web/pages/boards-view.ts +2 −2
| @@ -18,7 +18,7 @@ import { liveRegionsJs } from "../client.ts"; | ||
| 18 | 18 | import { notFoundPage, signInFirst } from "../chrome.ts"; |
| 19 | 19 | import { html, when, type Html } from "../html.ts"; |
| 20 | 20 | import { fragment, page } from "../layout.ts"; |
| 21 | import { btn, card, chartBox, empty, field, selectField } from "../ui.ts"; | |
| 21 | import { btn, card, chartBox, confirmAction, empty, field, selectField } from "../ui.ts"; | |
| 22 | 22 | import { flowPanel } from "./flow-panel.ts"; |
| 23 | 23 | import { boardsHoldsCard } from "./boards-holds.ts"; |
| 24 | 24 | import { forgeCeiling } from "../../flow/ceiling.ts"; |
| @@ -187,7 +187,7 @@ function manage(slug: string, board: Board, adding: Html, pins: ReturnType<typeo | ||
| 187 | 187 | ${btn("Save settings")} |
| 188 | 188 | </form> |
| 189 | 189 | <form method="post" action="/boards/${slug}/duplicate">${btn("Duplicate")}</form> |
| 190 | <form method="post" action="/boards/${slug}/delete">${btn("Delete this board", { variant: "danger" })}</form></div>`, | |
| 190 | ${confirmAction({ action: `/boards/${slug}/delete`, verb: "Delete this board" })}</div>`, | |
| 191 | 191 | { head: html`<h2>Board</h2>` }, |
| 192 | 192 | )}`; |
| 193 | 193 | } |
src/web/pages/search.ts +9
| @@ -595,6 +595,15 @@ const DESTRUCTIVE: { | ||
| 595 | 595 | phrase: "", |
| 596 | 596 | }), |
| 597 | 597 | }, |
| 598 | { | |
| 599 | pattern: /^\/boards\/([^/]+)\/delete$/, | |
| 600 | describe: (m) => ({ | |
| 601 | verb: "Delete board", | |
| 602 | title: `Delete the board ${decodeURIComponent(m[1] ?? "")}?`, | |
| 603 | detail: "Its panels and pins go with it. Nothing it reads is touched.", | |
| 604 | phrase: "", | |
| 605 | }), | |
| 606 | }, | |
| 598 | 607 | { |
| 599 | 608 | pattern: /^\/([^/]+)\/([^/]+)\/settings\/hooks\/([^/]+)\/delete$/, |
| 600 | 609 | describe: (m) => ({ |
test/boards-page.test.ts +16
| @@ -78,6 +78,22 @@ describe("/boards forms", () => { | ||
| 78 | 78 | expect(body).toContain('name="slug"'); |
| 79 | 79 | expect(body).toContain('<label for="f-pin-title">Panel title</label>'); |
| 80 | 80 | }); |
| 81 | ||
| 82 | test("Delete this board asks first on the confirm page, which names the board", async () => { | |
| 83 | const made = await makeBoard(app, admin, "Doomed"); | |
| 84 | if (!made.ok) throw new Error(JSON.stringify(made.error)); | |
| 85 | const slug = made.value; | |
| 86 | const board = await (await get(`/boards/${slug}`, "admin")).text(); | |
| 87 | const to = encodeURIComponent(`/boards/${slug}/delete`); | |
| 88 | expect(board).toContain(`href="/-/confirm?to=${to}"`); | |
| 89 | expect(board).not.toContain(`action="/boards/${slug}/delete"`); | |
| 90 | const res = await get(`/-/confirm?to=${to}`, "admin"); | |
| 91 | expect(res.status).toBe(200); | |
| 92 | const confirm = await res.text(); | |
| 93 | expect(confirm).toContain(`Delete the board ${slug}?`); | |
| 94 | expect(confirm).toContain("Its panels and pins go with it. Nothing it reads is touched."); | |
| 95 | expect(confirm).toContain(`action="/boards/${slug}/delete"`); | |
| 96 | }); | |
| 81 | 97 | }); |
| 82 | 98 | |
| 83 | 99 | describe("/boards/data", () => { |
test/boards-store.test.ts +2 −1
| @@ -174,9 +174,10 @@ describe("/boards", () => { | ||
| 174 | 174 | expect(body).toContain('class="row-trail bar"'); |
| 175 | 175 | expect(body).toContain('class="list setting-list"'); |
| 176 | 176 | expect(body).toContain('action="/boards/pin-panel"'); |
| 177 | for (const op of ["move", "remove", "rename", "settings", "duplicate", "delete"]) { | |
| 177 | for (const op of ["move", "remove", "rename", "settings", "duplicate"]) { | |
| 178 | 178 | expect(body).toContain(`action="/boards/fleet-health/${op}"`); |
| 179 | 179 | } |
| 180 | expect(body).toContain(`href="/-/confirm?to=${encodeURIComponent("/boards/fleet-health/delete")}"`); | |
| 180 | 181 | for (const word of ["Panels", "Add a panel", "Up", "Down", "Remove", "Pin to home", "Save settings", "Duplicate", "Delete this board"]) { |
| 181 | 182 | expect(body).toContain(word); |
| 182 | 183 | } |
new above
offline