Public: anyone can read this; the crew can change it.

An archived origin's missing-scope warning is one plain line with its action, not a boxed alert card #10031

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/10000-an-archived-origin-s-missing-scope-warni → main 2 commits fork

  • Merged. mason/10000-an-archived-origin-s-missing-scope-warni was merged into main as 02259b5.

Review

Sign in to review this change.
2 files changed +23 −18
src/web/pages/origin-archived.ts +13 −18
@@ -17,7 +17,7 @@ import {
1717 import type { Ctx } from "../../http/context.ts";
1818 import { field, readForm } from "../form.ts";
1919 import { html, when, type Html } from "../html.ts";
20 import { badge, btn, card, empty, listCard, row, time } from "../ui.ts";
20 import { badge, btn, empty, listCard, row, time } from "../ui.ts";
2121 import { accountOnly, hostLabel, notFoundNote, shell } from "./origins.ts";
2222
2323 const selectAllJs = /* js */ `
@@ -127,23 +127,18 @@ async function render(
127127 Restoring a repository makes it writable again. Apps the platform spun
128128 down when it was archived may need starting there.
129129 </p>
130 ${when(!canWrite, () =>
131 card(
132 html`<p role="alert">
133 This token cannot restore anything: it is missing
134 <strong>${scopeWords(missingWrite)}</strong>
135 (<code>${missingWrite.join(", ")}</code>). Replace it on the origins
136 page, and this page will offer Restore.
137 </p>
138 <div class="bar mt">
139 ${btn("Replace the token", {
140 href: "/settings/origins",
141 size: "sm",
142 variant: "primary",
143 })}
144 </div>`,
145 { tone: "attn", extra: "mb" },
146 ),
130 ${when(
131 !canWrite,
132 () => html`<p class="small mb">
133 This token cannot restore anything: it is missing
134 <strong>${scopeWords(missingWrite)}</strong>
135 (<code>${missingWrite.join(", ")}</code>).
136 ${btn("Replace the token", {
137 href: "/settings/origins",
138 size: "sm",
139 variant: "ghost",
140 })}
141 </p>`,
147142 )}
148143 ${when(
149144 options.notice !== undefined,
test/web-origin-archived.test.ts +10
@@ -225,6 +225,16 @@ describe("restoring archived repositories", () => {
225225 const { text } = await get(adaCookie);
226226 expect(text).toContain("Repository: Read and write");
227227 expect(text).toContain("write:repository");
228 expect(text).toContain("This token cannot restore anything");
229 expect(text).toContain("Replace the token");
230 expect(text).not.toContain('role="alert"');
231 // Everything in <main> above the list's form: no card, so no alert box.
232 const above = text.slice(
233 text.indexOf("<main"),
234 text.indexOf('<form method="post" action="' + path),
235 );
236 expect(above).toContain("This token cannot restore anything");
237 expect(above).not.toContain('class="card');
228238 expect(text).not.toContain(`name="one"`);
229239 expect(patches()).toBe(0);
230240 expect(fake.state.repos[0]!.archived).toBe(true);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs