forge
Explore
Log in

Don't you dare go Hollow

Modern runs list with status icons, commit titles and header menus

Browse files at this commit

98b537a1a53a9312b3e958f5ca897460ea954ba6Ahmet Kaan GümüşParent: b25287e
  • feat
    • modern runs list with status icons, commit titles and header menus
Show full message
💄 feat(ci): modern runs list with status icons, commit titles and header menus

- Runs render as rows: state icon, commit subject, `#n · trigger · branch · commit · actor`,
  duration and age; branches drop `refs/heads/`.
- Run workflow and Status badge move from cards into header dropdowns.
- Live swaps keep open dropdowns open instead of closing them.
crates/forge-web/assets/nav.jsmodified+52 -4
@@ -125,7 +125,7 @@
125 });125 });
126 }126 }
127 127
128- function adopt(doc, keepFields) {128+ function adopt(doc, keepFields, dd) {
129 document.title = doc.title;129 document.title = doc.title;
130 ['lang', 'data-theme', 'data-ui'].forEach(function (name) {130 ['lang', 'data-theme', 'data-ui'].forEach(function (name) {
131 if (doc.documentElement.hasAttribute(name)) { root.setAttribute(name, doc.documentElement.getAttribute(name)); }131 if (doc.documentElement.hasAttribute(name)) { root.setAttribute(name, doc.documentElement.getAttribute(name)); }
@@ -143,7 +143,10 @@
143 s.textContent = old.textContent;143 s.textContent = old.textContent;
144 old.replaceWith(s);144 old.replaceWith(s);
145 });145 });
146+ // Dropdowns reopen before the fields come back: a field inside a closed <details> cannot take focus.
147+ if (dd) { openDropdowns(dd); }
146 if (kept) { restoreFields(kept); }148 if (kept) { restoreFields(kept); }
149+ if (dd) { focusDropdown(dd); }
147 followTail();150 followTail();
148 syncUnread();151 syncUnread();
149 syncLive();152 syncLive();
@@ -173,7 +176,7 @@
173 176
174 // how: 'nav' (link or GET form: push, top), 'pop' (history: push nothing, restore scroll),177 // how: 'nav' (link or GET form: push, top), 'pop' (history: push nothing, restore scroll),
175 // 'post' (form post: replace, keep scroll), 'query' (in place: replace, keep scroll), 'live' (a178 // 'post' (form post: replace, keep scroll), 'query' (in place: replace, keep scroll), 'live' (a
176- // live page's change: no history entry, keep scroll, no fragment jump).179+ // live page's change: no history entry, keep scroll, no fragment jump, open dropdowns stay open).
177 function swap(html, dest, how, keepFields) {180 function swap(html, dest, how, keepFields) {
178 var doc = new DOMParser().parseFromString(html, 'text/html');181 var doc = new DOMParser().parseFromString(html, 'text/html');
179 if (!doc.body) { location.assign(dest.href); return; }182 if (!doc.body) { location.assign(dest.href); return; }
@@ -182,8 +185,10 @@
182 // A live swap keeps the log tail where the reader had it: at the end it stays at the end.185 // A live swap keeps the log tail where the reader had it: at the end it stays at the end.
183 var tail = how === 'live' ? document.querySelector('[data-live-log]') : null;186 var tail = how === 'live' ? document.querySelector('[data-live-log]') : null;
184 var tailAt = tail ? { top: tail.scrollTop, end: tail.scrollTop + tail.clientHeight >= tail.scrollHeight - 24 } : null;187 var tailAt = tail ? { top: tail.scrollTop, end: tail.scrollTop + tail.clientHeight >= tail.scrollHeight - 24 } : null;
185- closeDropdowns(null);188+ // A live change must not shut a menu the reader has open (a run's branch picker, say).
186- adopt(doc, keepFields);189+ var dd = how === 'live' ? captureDropdowns() : null;
190+ if (how !== 'live') { closeDropdowns(null); }
191+ adopt(doc, keepFields, dd);
187 if (tailAt) {192 if (tailAt) {
188 var nextTail = document.querySelector('[data-live-log]');193 var nextTail = document.querySelector('[data-live-log]');
189 if (nextTail) { nextTail.scrollTop = tailAt.end ? nextTail.scrollHeight : tailAt.top; }194 if (nextTail) { nextTail.scrollTop = tailAt.end ? nextTail.scrollHeight : tailAt.top; }
@@ -258,6 +263,49 @@
258 });263 });
259 }264 }
260 265
266+ // Each dropdown gets a key that survives a re-render: its id when it has one, else its summary
267+ // text plus a count for repeats (two menus with the same text stay apart, in document order).
268+ function dropdownKeys() {
269+ var seen = Object.create(null);
270+ return Array.prototype.map.call(document.querySelectorAll(DROPDOWN), function (d) {
271+ if (d.id) { return { key: 'id:' + d.id, el: d }; }
272+ var s = d.querySelector('summary');
273+ var text = s ? s.textContent.replace(/\s+/g, ' ').trim() : '';
274+ seen[text] = (seen[text] || 0) + 1;
275+ return { key: 'text:' + text + '#' + seen[text], el: d };
276+ });
277+ }
278+
279+ // Before a live swap: the keys of the open dropdowns, and the key of the one holding focus.
280+ function captureDropdowns() {
281+ var active = document.activeElement;
282+ var out = { open: [], focus: null };
283+ dropdownKeys().forEach(function (item) {
284+ if (!item.el.open) { return; }
285+ out.open.push(item.key);
286+ if (active && item.el.contains(active)) { out.focus = item.key; }
287+ });
288+ return out;
289+ }
290+
291+ function openDropdowns(kept) {
292+ dropdownKeys().forEach(function (item) {
293+ if (kept.open.indexOf(item.key) >= 0) { item.el.open = true; }
294+ });
295+ }
296+
297+ // Focus was in a dropdown but no field took it back (a button or the summary): the dropdown's
298+ // summary gets it instead.
299+ function focusDropdown(kept) {
300+ if (!kept.focus) { return; }
301+ var active = document.activeElement;
302+ if (active && active !== document.body) { return; }
303+ dropdownKeys().forEach(function (item) {
304+ var s = item.key === kept.focus ? item.el.querySelector('summary') : null;
305+ if (s) { s.focus({ preventScroll: true }); }
306+ });
307+ }
308+
261 // A click outside an open dropdown closes it. A click inside one (a select, a form field) keeps309 // A click outside an open dropdown closes it. A click inside one (a select, a form field) keeps
262 // it open. Opening a dropdown by its summary closes the others: the browser toggles it after this.310 // it open. Opening a dropdown by its summary closes the others: the browser toggles it after this.
263 document.addEventListener('click', function (e) {311 document.addEventListener('click', function (e) {
crates/forge-web/src/i18n/releases_ci.rsmodified+6 -24
@@ -29,16 +29,11 @@ pub enum K {
29 Rerun,29 Rerun,
30 Runs,30 Runs,
31 NoRunsYet,31 NoRunsYet,
32+ NoRunsHint,
32 Jobs,33 Jobs,
33 JobGraph,34 JobGraph,
34 NoJobs,35 NoJobs,
35- ColRun,
36 ColState,36 ColState,
37- ColTrigger,
38- ColRef,
39- ColCommit,
40- ColActor,
41- ColAge,
42 ColJob,37 ColJob,
43 ColDuration,38 ColDuration,
44 ColRunner,39 ColRunner,
@@ -174,26 +169,18 @@ pub fn t(lang: Lang, key: K) -> &'static str {
174 (Runs, Tr) => "Çalıştırmalar",169 (Runs, Tr) => "Çalıştırmalar",
175 (NoRunsYet, En) => "No runs yet.",170 (NoRunsYet, En) => "No runs yet.",
176 (NoRunsYet, Tr) => "Henüz çalıştırma yok.",171 (NoRunsYet, Tr) => "Henüz çalıştırma yok.",
172+ (NoRunsHint, En) => "Add a .forge/ci.toml to the repo, then push a commit or start a run.",
173+ (NoRunsHint, Tr) => {
174+ ".forge/ci.toml dosyası ekleyin, ardından bir commit gönderin ya da bir çalıştırma başlatın."
175+ }
177 (Jobs, En) => "Jobs",176 (Jobs, En) => "Jobs",
178 (Jobs, Tr) => "İşler",177 (Jobs, Tr) => "İşler",
179 (JobGraph, En) => "Job graph",178 (JobGraph, En) => "Job graph",
180 (JobGraph, Tr) => "İş grafiği",179 (JobGraph, Tr) => "İş grafiği",
181 (NoJobs, En) => "No jobs.",180 (NoJobs, En) => "No jobs.",
182 (NoJobs, Tr) => "İş yok.",181 (NoJobs, Tr) => "İş yok.",
183- (ColRun, En) => "Run",
184- (ColRun, Tr) => "Çalıştırma",
185 (ColState, En) => "State",182 (ColState, En) => "State",
186 (ColState, Tr) => "Durum",183 (ColState, Tr) => "Durum",
187- (ColTrigger, En) => "Trigger",
188- (ColTrigger, Tr) => "Tetikleyici",
189- (ColRef, En) => "Ref",
190- (ColRef, Tr) => "Referans",
191- (ColCommit, En) => "Commit",
192- (ColCommit, Tr) => "Commit",
193- (ColActor, En) => "Actor",
194- (ColActor, Tr) => "Kullanıcı",
195- (ColAge, En) => "Age",
196- (ColAge, Tr) => "Zaman",
197 (ColJob, En) => "Job",184 (ColJob, En) => "Job",
198 (ColJob, Tr) => "İş",185 (ColJob, Tr) => "İş",
199 (ColDuration, En) => "Duration",186 (ColDuration, En) => "Duration",
@@ -473,16 +460,11 @@ mod tests {
473 K::Rerun,460 K::Rerun,
474 K::Runs,461 K::Runs,
475 K::NoRunsYet,462 K::NoRunsYet,
463+ K::NoRunsHint,
476 K::Jobs,464 K::Jobs,
477 K::JobGraph,465 K::JobGraph,
478 K::NoJobs,466 K::NoJobs,
479- K::ColRun,
480 K::ColState,467 K::ColState,
481- K::ColTrigger,
482- K::ColRef,
483- K::ColCommit,
484- K::ColActor,
485- K::ColAge,
486 K::ColJob,468 K::ColJob,
487 K::ColDuration,469 K::ColDuration,
488 K::ColRunner,470 K::ColRunner,
crates/forge-web/src/pages/ci_runs.rsmodified+149 -81
@@ -218,6 +218,14 @@ pub fn run_finished(state: &RunState) -> bool {
218 )218 )
219 }219 }
220 220
221+/// A ref as the lists show it: `refs/heads/main` reads `main`, and so does a tag without its prefix.
222+fn short_ref(git_ref: &str) -> &str {
223+ git_ref
224+ .strip_prefix("refs/heads/")
225+ .or_else(|| git_ref.strip_prefix("refs/tags/"))
226+ .unwrap_or(git_ref)
227+}
228+
221 /// Branch names of the repo, the default branch first.229 /// Branch names of the repo, the default branch first.
222 fn branch_choices(refs: &[RefInfo], default_branch: &str) -> Vec<String> {230 fn branch_choices(refs: &[RefInfo], default_branch: &str) -> Vec<String> {
223 let mut names: Vec<String> = refs231 let mut names: Vec<String> = refs
@@ -271,16 +279,20 @@ async fn after_change(state: &AppState, run_id: &str, before: &[CiJob]) -> Resul
271 Ok(())279 Ok(())
272 }280 }
273 281
274-/// One run in the list, with its values already shown as text.282+/// One run in the list, with its values already shown as text. `state_key` is the raw state word
283+/// that picks the row's icon.
275 struct RunRow {284 struct RunRow {
276 href: String,285 href: String,
277 number: i64,286 number: i64,
287+ title: String,
278 state: String,288 state: String,
279- state_class: String,289+ state_key: String,
280 trigger: String,290 trigger: String,
281- git_ref: String,291+ branch: String,
292+ commit_href: String,
282 commit: String,293 commit: String,
283 actor: String,294 actor: String,
295+ duration: String,
284 when: String,296 when: String,
285 }297 }
286 298
@@ -382,7 +394,26 @@ async fn action_button(action: String, csrf: String, label: &'static str) -> Res
382 })394 })
383 }395 }
384 396
385-/// The run list body: the manual run form for writers, the runs, and the pager.397+/// The state icon of a run row, labelled with its state word. Finished runs get a disc with a glyph.
398+/// Running and queued runs have no glyph: their ring is drawn in CSS, and the running ring turns.
399+#[component]
400+async fn run_icon(state: String, label: String) -> Result<impl View> {
401+ let class = format!("ci-run-icon ci-{state}");
402+ Ok(view! {
403+ <span class=(class.as_str()) role="img" aria-label=(label.as_str()) title=(label.as_str())>
404+ if state == "success" {
405+ <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 8.5l2.4 2.4 4.6-5"/></svg>
406+ } else if state == "failure" || state == "error" {
407+ <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5.5 5.5l5 5M10.5 5.5l-5 5"/></svg>
408+ } else if state == "cancelled" || state == "blocked" || state == "skipped" {
409+ <svg viewBox="0 0 16 16" aria-hidden="true"><path d="M5 11l6-6"/></svg>
410+ }
411+ </span>
412+ })
413+}
414+
415+/// The run list body. The header holds the manual run and badge menus and the run count, outside
416+/// the live region's card. The live region wraps the count and the card, so a live swap refreshes both.
386 #[component]417 #[component]
387 async fn runs_body(418 async fn runs_body(
388 head: RepoHead,419 head: RepoHead,
@@ -391,6 +422,7 @@ async fn runs_body(
391 manual: Option<ManualRun>,422 manual: Option<ManualRun>,
392 badge: BadgeInfo,423 badge: BadgeInfo,
393 rows: Vec<RunRow>,424 rows: Vec<RunRow>,
425+ total: u64,
394 newer_href: Option<String>,426 newer_href: Option<String>,
395 older_href: Option<String>,427 older_href: Option<String>,
396 page_label: String,428 page_label: String,
@@ -405,80 +437,87 @@ async fn runs_body(
405 <section class="card notice" role="status">(text)</section>437 <section class="card notice" role="status">(text)</section>
406 }438 }
407 }439 }
408- if let Some(form) = manual {440+ <div class="ci-list-head">
409- <section class="card">441+ <h2 class="ci-list-title">(g::t(lang, K::Runs))</h2>
410- <h2>(g::t(lang, K::RunWorkflow))</h2>442+ <div class="ci-tools">
411- <p class="muted small">(g::t(lang, K::RunWorkflowHelp))</p>443+ if let Some(form) = manual {
412- <form method="post" action=(form.action.as_str()) class="ci-manual-form">444+ <details class="menu ci-tool">
413- <input type="hidden" name="csrf" value=(form.csrf.as_str())>445+ <summary>(g::t(lang, K::RunWorkflow))</summary>
414- <label>446+ <div class="menu-list ci-pop">
415- (g::t(lang, K::Branch)) " "447+ <p class="muted small">(g::t(lang, K::RunWorkflowHelp))</p>
416- <select name="branch">448+ <form method="post" action=(form.action.as_str()) class="ci-manual-form">
417- for branch in form.branches.iter() {449+ <input type="hidden" name="csrf" value=(form.csrf.as_str())>
418- <option value=(branch.as_str())>(branch.as_str())</option>450+ <label>
419- }451+ (g::t(lang, K::Branch)) " "
420- </select>452+ <select name="branch">
421- </label>453+ for branch in form.branches.iter() {
422- <button type="submit">(g::t(lang, K::RunWorkflow))</button>454+ <option value=(branch.as_str())>(branch.as_str())</option>
423- </form>455+ }
424- </section>456+ </select>
425- }457+ </label>
426- <section class="card">458+ <button type="submit">(g::t(lang, K::RunWorkflow))</button>
427- <details>459+ </form>
428- <summary>(g::t(lang, K::BadgeHeading))</summary>460+ </div>
429- <p class="muted small">(g::t(lang, K::BadgeHelp))</p>461+ </details>
430- <p><img src=(badge.image.as_str()) alt="CI"></p>462+ }
431- <label class="small">463+ <details class="menu ci-tool">
432- (g::t(lang, K::BadgeSnippet))464+ <summary>(g::t(lang, K::BadgeHeading))</summary>
433- <textarea readonly="readonly" rows="2" class="ci-badge-snippet">(badge.snippet.as_str())</textarea>465+ <div class="menu-list ci-pop">
434- </label>466+ <p class="muted small">(g::t(lang, K::BadgeHelp))</p>
435- </details>467+ <p><img src=(badge.image.as_str()) alt="CI"></p>
436- </section>468+ <label class="small">
437- <div data-live=(live.as_deref())>469+ (g::t(lang, K::BadgeSnippet))
438- <section class="card">470+ <textarea readonly="readonly" rows="2" class="ci-badge-snippet">(badge.snippet.as_str())</textarea>
439- <h2>(g::t(lang, K::Runs))</h2>471+ </label>
440- if rows.is_empty() {472+ </div>
441- <p class="muted">(g::t(lang, K::NoRunsYet))</p>473+ </details>
442- } else {474+ </div>
443- <div class="table-wrap">475+ <div data-live=(live.as_deref()) class="ci-live">
444- <table class="table ci-runs">476+ <span class="ci-count">(total)</span>
445- <thead>477+ <section class="card ci-list-card">
446- <tr>478+ if rows.is_empty() {
447- <th>(g::t(lang, K::ColRun))</th>479+ <div class="ci-empty">
448- <th>(g::t(lang, K::ColState))</th>480+ <p>(g::t(lang, K::NoRunsYet))</p>
449- <th>(g::t(lang, K::ColTrigger))</th>481+ <p class="muted small">(g::t(lang, K::NoRunsHint))</p>
450- <th>(g::t(lang, K::ColRef))</th>482+ </div>
451- <th>(g::t(lang, K::ColCommit))</th>483+ } else {
452- <th>(g::t(lang, K::ColActor))</th>484+ <ul class="ci-run-list">
453- <th>(g::t(lang, K::ColAge))</th>
454- </tr>
455- </thead>
456- <tbody>
457 for row in rows.iter() {485 for row in rows.iter() {
458- <tr>486+ <li class="ci-run-row">
459- <td><a class="ci-run-link" href=(row.href.as_str())>"#" (row.number)</a></td>487+ run_icon(state: row.state_key.clone(), label: row.state.clone())
460- <td><span class=(row.state_class.as_str())>(row.state.as_str())</span></td>488+ <div class="ci-run-body">
461- <td>(row.trigger.as_str())</td>489+ <p class="ci-run-title"><a class="ci-run-link" href=(row.href.as_str())>(row.title.as_str())</a></p>
462- <td><code>(row.git_ref.as_str())</code></td>490+ <p class="ci-run-sub muted small">
463- <td><code>(row.commit.as_str())</code></td>491+ "#" (row.number)
464- <td>(row.actor.as_str())</td>492+ " \u{b7} " (row.trigger.as_str())
465- <td>(row.when.as_str())</td>493+ " \u{b7} " <code class="ci-branch">(row.branch.as_str())</code>
466- </tr>494+ " \u{b7} " <a class="ci-run-commit" href=(row.commit_href.as_str())><code>(row.commit.as_str())</code></a>
495+ if !row.actor.is_empty() {
496+ " \u{b7} " (row.actor.as_str())
497+ }
498+ </p>
499+ </div>
500+ <div class="ci-run-side muted small">
501+ if !row.duration.is_empty() {
502+ <span class="ci-run-dur"><svg viewBox="0 0 16 16" aria-hidden="true" class="ci-clock"><circle cx="8" cy="8" r="6"/><path d="M8 4.5V8l2.5 1.5"/></svg>(row.duration.as_str())</span>
503+ }
504+ <span>(row.when.as_str())</span>
505+ </div>
506+ </li>
467 }507 }
468- </tbody>508+ </ul>
469- </table>509+ }
470- </div>510+ <nav class="pager">
471- }511+ if let Some(href) = newer_href {
472- <nav class="pager">512+ <a href=(href.as_str())>(g::t(lang, K::Newer))</a>
473- if let Some(href) = newer_href {513+ }
474- <a href=(href.as_str())>(g::t(lang, K::Newer))</a>514+ <span class="muted small">(page_label.as_str())</span>
475- }515+ if let Some(href) = older_href {
476- <span class="muted small">(page_label.as_str())</span>516+ <a href=(href.as_str())>(g::t(lang, K::Older))</a>
477- if let Some(href) = older_href {517+ }
478- <a href=(href.as_str())>(g::t(lang, K::Older))</a>518+ </nav>
479- }519+ </section>
480- </nav>520+ </div>
481- </section>
482 </div>521 </div>
483 })522 })
484 }523 }
@@ -494,22 +533,51 @@ async fn runs_list_page(cx: &Cx) -> Result<impl View> {
494 let page = page_from_query(cx);533 let page = page_from_query(cx);
495 let (runs, total) = state.store.list_runs(&ctx.repo.id, page, PER_PAGE).await?;534 let (runs, total) = state.store.list_runs(&ctx.repo.id, page, PER_PAGE).await?;
496 let names = usernames(state, lang, runs.iter().map(|run| run.actor_id.as_str())).await?;535 let names = usernames(state, lang, runs.iter().map(|run| run.actor_id.as_str())).await?;
536+ // Each row's title is its commit's first line, read for this page's runs only. A commit that
537+ // cannot be read leaves the row's trigger as its title.
538+ let path = ctx.path.clone();
539+ let oids: Vec<String> = runs.iter().map(|run| run.commit_oid.clone()).collect();
540+ let subjects = tokio::task::spawn_blocking(move || {
541+ oids.iter()
542+ .map(|oid| {
543+ read_commit(&path, oid)
544+ .ok()
545+ .flatten()
546+ .map(|commit| commit.summary)
547+ .filter(|summary| !summary.is_empty())
548+ })
549+ .collect::<Vec<_>>()
550+ })
551+ .await?;
552+ let base = ci_href(&title_of(&ctx));
497 let rows: Vec<RunRow> = runs553 let rows: Vec<RunRow> = runs
498 .iter()554 .iter()
499- .map(|run| RunRow {555+ .zip(subjects)
556+ .map(|(run, subject)| RunRow {
500 href: run_href(&title_of(&ctx), run.number),557 href: run_href(&title_of(&ctx), run.number),
501 number: run.number,558 number: run.number,
559+ title: subject.unwrap_or_else(|| run.trigger.clone()),
502 state: state_text(lang, run.state.as_str()),560 state: state_text(lang, run.state.as_str()),
503- state_class: format!("ci-state ci-{}", run.state.as_str()),561+ state_key: run.state.as_str().to_owned(),
504 trigger: run.trigger.clone(),562 trigger: run.trigger.clone(),
505- git_ref: run.git_ref.clone(),563+ branch: short_ref(&run.git_ref).to_owned(),
564+ commit_href: format!("/{}/commit/{}", title_of(&ctx), run.commit_oid),
506 commit: short_oid(&run.commit_oid).to_owned(),565 commit: short_oid(&run.commit_oid).to_owned(),
507 actor: names.get(&run.actor_id).cloned().unwrap_or_default(),566 actor: names.get(&run.actor_id).cloned().unwrap_or_default(),
567+ // Only a run that has started or finished has a duration. A queued run has none yet.
568+ duration: if run_finished(&run.state) || run.state == RunState::Running {
569+ duration_text(
570+ lang,
571+ Some(run.created_at.as_str()),
572+ run.finished_at.as_deref(),
573+ )
574+ } else {
575+ String::new()
576+ },
508 when: age_text(lang, &run.created_at),577 when: age_text(lang, &run.created_at),
509 })578 })
510 .collect();579 .collect();
511 let last_page = total.div_ceil(u64::from(PER_PAGE)).max(1);580 let last_page = total.div_ceil(u64::from(PER_PAGE)).max(1);
512- let base = ci_href(&title_of(&ctx));
513 let newer_href = (page > 1).then(|| format!("{base}?page={}", page - 1));581 let newer_href = (page > 1).then(|| format!("{base}?page={}", page - 1));
514 let older_href = (u64::from(page) < last_page).then(|| format!("{base}?page={}", page + 1));582 let older_href = (u64::from(page) < last_page).then(|| format!("{base}?page={}", page + 1));
515 let page_label = g::page_label(lang, page);583 let page_label = g::page_label(lang, page);
@@ -536,7 +604,7 @@ async fn runs_list_page(cx: &Cx) -> Result<impl View> {
536 Ok(view! {604 Ok(view! {
537 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),605 shell(title: title.as_str(), viewer: ctx.viewer.as_ref(),
538 runs_body(head: head, lang: lang, notice: notice, manual: manual, badge: badge, rows: rows,606 runs_body(head: head, lang: lang, notice: notice, manual: manual, badge: badge, rows: rows,
539- newer_href: newer_href, older_href: older_href, page_label: page_label, live: live))607+ total: total, newer_href: newer_href, older_href: older_href, page_label: page_label, live: live))
540 })608 })
541 }609 }
542 610
style/main.scssmodified+313 -12
@@ -3574,10 +3574,138 @@ span.reaction {
3574 padding-left: 20px;3574 padding-left: 20px;
3575 }3575 }
3576 3576
3577-// CI runs list: whole-row links.3577+// CI runs list. The header holds the title, the run count and two menus (Run workflow and the
3578-// The run number link stretches over its row (no JS). Other controls in the row sit above it.3578+// status badge). The count and the card sit in the live region, which is display: contents, so
3579-.ci-runs tbody tr {3579+// they share the header's flex row and the card wraps onto its own line.
3580+.ci-list-head {
3581+ display: flex;
3582+ flex-wrap: wrap;
3583+ align-items: center;
3584+ gap: 8px 12px;
3585+ margin-bottom: 12px;
3586+}
3587+
3588+.ci-list-title {
3589+ margin: 0;
3590+ font-size: 1.25rem;
3591+}
3592+
3593+.ci-tools {
3594+ display: flex;
3595+ flex-wrap: wrap;
3596+ align-items: center;
3597+ gap: 8px;
3598+ order: 1;
3599+ margin-left: auto;
3600+}
3601+
3602+.ci-live {
3603+ display: contents;
3604+}
3605+
3606+.ci-count {
3607+ align-self: center;
3608+ padding: 1px 8px;
3609+ border-radius: 999px;
3610+ background: var(--surface-2);
3611+ color: var(--muted);
3612+ font-size: 0.8125rem;
3613+ font-weight: 600;
3614+}
3615+
3616+.ci-list-card {
3617+ order: 2;
3618+ flex: 1 1 100%;
3619+ min-width: 0;
3620+ margin: 0;
3621+ padding: 0;
3622+ overflow: hidden;
3623+}
3624+
3625+// The header menus reuse the `.menu` dropdown. The trigger is a compact button with a chevron.
3626+.ci-tool > summary {
3627+ display: inline-flex;
3628+ align-items: center;
3629+ gap: 8px;
3630+ padding: 6px 12px;
3631+ background: var(--surface);
3632+ color: var(--text);
3633+ font-size: 0.875rem;
3634+ font-weight: 600;
3635+
3636+ &::after {
3637+ content: "";
3638+ width: 6px;
3639+ height: 6px;
3640+ border-right: 1.5px solid currentColor;
3641+ border-bottom: 1.5px solid currentColor;
3642+ transform: translateY(-2px) rotate(45deg);
3643+ }
3644+}
3645+
3646+.ci-tool[open] > summary::after {
3647+ transform: translateY(1px) rotate(-135deg);
3648+}
3649+
3650+.ci-pop {
3651+ width: min(340px, calc(100vw - 32px));
3652+ padding: 14px;
3653+ text-align: left;
3654+
3655+ p {
3656+ margin: 0 0 10px;
3657+ }
3658+
3659+ .ci-manual-form {
3660+ flex-direction: column;
3661+ align-items: stretch;
3662+ gap: 10px;
3663+ margin-top: 0;
3664+
3665+ label {
3666+ display: grid;
3667+ gap: 6px;
3668+ }
3669+
3670+ select {
3671+ width: 100%;
3672+ }
3673+
3674+ button {
3675+ align-self: flex-end;
3676+ }
3677+ }
3678+}
3679+
3680+.ci-empty {
3681+ padding: 40px 16px;
3682+ text-align: center;
3683+
3684+ p {
3685+ margin: 0 0 6px;
3686+ }
3687+}
3688+
3689+.ci-list-card .pager {
3690+ margin: 0;
3691+ padding: 12px 16px;
3692+ border-top: 1px solid var(--border);
3693+}
3694+
3695+.ci-run-list {
3696+ margin: 0;
3697+ padding: 0;
3698+ list-style: none;
3699+}
3700+
3701+// Each row is a grid: state icon, title and meta, then the duration and age on the right.
3702+.ci-run-row {
3580 position: relative;3703 position: relative;
3704+ display: grid;
3705+ grid-template-columns: auto minmax(0, 1fr) auto;
3706+ align-items: center;
3707+ gap: 12px;
3708+ padding: 12px 16px;
3581 cursor: pointer;3709 cursor: pointer;
3582 3710
3583 &:hover {3711 &:hover {
@@ -3585,21 +3713,194 @@ span.reaction {
3585 }3713 }
3586 }3714 }
3587 3715
3588-.ci-runs .ci-run-link::after {3716+.ci-run-row + .ci-run-row {
3589- content: "";3717+ border-top: 1px solid var(--border);
3590- position: absolute;
3591- inset: 0;
3592 }3718 }
3593 3719
3594-.ci-runs tbody a:not(.ci-run-link),3720+// The title link stretches over its row (no JS). The commit link sits above it.
3595-.ci-runs tbody button,3721+.ci-run-link {
3596-.ci-runs tbody input,3722+ color: var(--text);
3597-.ci-runs tbody select,3723+ text-decoration: none;
3598-.ci-runs tbody textarea {3724+
3725+ &::after {
3726+ content: "";
3727+ position: absolute;
3728+ inset: 0;
3729+ }
3730+
3731+ &:hover {
3732+ color: var(--accent-ink);
3733+ }
3734+}
3735+
3736+.ci-run-commit {
3599 position: relative;3737 position: relative;
3600 z-index: 1;3738 z-index: 1;
3601 }3739 }
3602 3740
3741+.ci-run-body {
3742+ min-width: 0;
3743+}
3744+
3745+.ci-run-title {
3746+ margin: 0 0 2px;
3747+ overflow: hidden;
3748+ font-weight: 600;
3749+ text-overflow: ellipsis;
3750+ white-space: nowrap;
3751+}
3752+
3753+.ci-run-sub {
3754+ margin: 0;
3755+ overflow: hidden;
3756+ text-overflow: ellipsis;
3757+ white-space: nowrap;
3758+
3759+ code {
3760+ font-size: 0.8125rem;
3761+ }
3762+}
3763+
3764+.ci-branch {
3765+ padding: 0 6px;
3766+ border: 1px solid var(--border);
3767+ border-radius: 999px;
3768+ background: var(--surface);
3769+ color: var(--text-2);
3770+}
3771+
3772+.ci-run-side {
3773+ display: flex;
3774+ flex-direction: column;
3775+ align-items: flex-end;
3776+ gap: 2px;
3777+ text-align: right;
3778+ white-space: nowrap;
3779+ font-variant-numeric: tabular-nums;
3780+}
3781+
3782+.ci-run-dur {
3783+ display: inline-flex;
3784+ align-items: center;
3785+ gap: 4px;
3786+}
3787+
3788+.ci-clock {
3789+ width: 12px;
3790+ height: 12px;
3791+ flex-shrink: 0;
3792+ fill: none;
3793+ stroke: currentColor;
3794+ stroke-width: 1.75;
3795+ stroke-linecap: round;
3796+ stroke-linejoin: round;
3797+}
3798+
3799+// The state icon: a disc with a glyph for finished runs, a ring for running and queued ones.
3800+.ci-run-icon {
3801+ --ci-icon: var(--muted);
3802+
3803+ display: inline-flex;
3804+ align-items: center;
3805+ justify-content: center;
3806+ box-sizing: border-box;
3807+ width: 20px;
3808+ height: 20px;
3809+ border-radius: 50%;
3810+ background: var(--ci-icon);
3811+ color: var(--accent-text);
3812+
3813+ svg {
3814+ width: 12px;
3815+ height: 12px;
3816+ fill: none;
3817+ stroke: currentColor;
3818+ stroke-width: 2;
3819+ stroke-linecap: round;
3820+ stroke-linejoin: round;
3821+ }
3822+
3823+ &.ci-success {
3824+ --ci-icon: var(--public-text);
3825+ }
3826+
3827+ &.ci-failure,
3828+ &.ci-error {
3829+ --ci-icon: var(--danger);
3830+ }
3831+
3832+ &.ci-cancelled,
3833+ &.ci-blocked,
3834+ &.ci-skipped {
3835+ --ci-icon: var(--muted);
3836+ }
3837+
3838+ &.ci-running,
3839+ &.ci-queued,
3840+ &.ci-waiting_approval {
3841+ --ci-icon: var(--warning);
3842+
3843+ background: transparent;
3844+ border: 2px solid var(--ci-icon);
3845+ }
3846+
3847+ &.ci-running {
3848+ border-top-color: transparent;
3849+ animation: ci-spin 0.9s linear infinite;
3850+ }
3851+
3852+ &.ci-queued::after,
3853+ &.ci-waiting_approval::after {
3854+ content: "";
3855+ width: 4px;
3856+ height: 4px;
3857+ border-radius: 50%;
3858+ background: var(--ci-icon);
3859+ }
3860+}
3861+
3862+@keyframes ci-spin {
3863+ to {
3864+ transform: rotate(360deg);
3865+ }
3866+}
3867+
3868+@media (prefers-reduced-motion: reduce) {
3869+ .ci-run-icon.ci-running {
3870+ animation: none;
3871+ }
3872+}
3873+
3874+// Phone width: the duration and age move under the meta line, and the row keeps its icon.
3875+@media (max-width: 600px) {
3876+ .ci-run-row {
3877+ grid-template-columns: auto minmax(0, 1fr);
3878+ row-gap: 6px;
3879+ }
3880+
3881+ .ci-run-icon {
3882+ grid-row: 1 / span 2;
3883+ }
3884+
3885+ .ci-run-body,
3886+ .ci-run-side {
3887+ grid-column: 2;
3888+ }
3889+
3890+ .ci-run-side {
3891+ flex-direction: row;
3892+ align-items: center;
3893+ gap: 10px;
3894+ text-align: left;
3895+ }
3896+
3897+ // The meta line wraps here, so the commit and the author stay in view.
3898+ .ci-run-sub {
3899+ white-space: normal;
3900+ overflow-wrap: anywhere;
3901+ }
3902+}
3903+
3603 // CI run page: header and job graph.3904 // CI run page: header and job graph.
3604 // Sizes below match the GRAPH_* constants in crates/forge-web/src/pages/ci_runs.rs: the card is3905 // Sizes below match the GRAPH_* constants in crates/forge-web/src/pages/ci_runs.rs: the card is
3605 // 200x56, columns are 48px apart, cards in a column 16px apart, and the box is padded 16px.3906 // 200x56, columns are 48px apart, cards in a column 16px apart, and the box is padded 16px.