forge
Explore
Log in

Don't you dare go Hollow

CI in the shell reads at a glance and tells the truth about a cancel: the topbar strip is one pill, the single run or a summary ("28 running · 2 failed") that opens the list of your runs

Browse files at this commit

c0cdb72c620d2016d061f5e2a3dd47e48b1dea94Ahmet Kaan GümüşParent: a8c97c4
All checks have passed
Show checks
  • feat
    • CI in the shell reads at a glance and tells the truth about a cancel: the topbar strip is one pill, the single run or a summary ("28 running · 2 failed") that opens the list of your runs
    • the avatar ring is a full ember ring while a run goes, not a progress arc
    • the repo's CI card shows a heat bar and the current job with a live clock for a running run, and "passed · 4m 12s" or "clippy failed · 2m 3s" once done
    • a cancelled run is grey everywhere (badge "cancelled", not "error"
    • strip, not "failed")
    • a running job being cancelled shows "stopping" and the Cancel button "Stopping…" until its runner stops it, and the reaper marks such a job cancelled, not lost
Show full message
✨ feat: CI in the shell reads at a glance and tells the truth about a cancel: the topbar strip is one pill, the single run or a summary ("28 running · 2 failed") that opens the list of your runs; the avatar ring is a full ember ring while a run goes, not a progress arc; the repo's CI card shows a heat bar and the current job with a live clock for a running run, and "passed · 4m 12s" or "clippy failed · 2m 3s" once done; a cancelled run is grey everywhere (badge "cancelled", not "error"; strip, not "failed"); a running job being cancelled shows "stopping" and the Cancel button "Stopping…" until its runner stops it, and the reaper marks such a job cancelled, not lost
crates/forge-core/src/store/ci.rsmodified+30 -1
@@ -1486,7 +1486,10 @@ impl Store {
1486 let mut runs: Vec<String> = Vec::new();1486 let mut runs: Vec<String> = Vec::new();
1487 for job in &lost {1487 for job in &lost {
1488 tx.execute(1488 tx.execute(
1489- "UPDATE ci_jobs SET state = 'error', message = 'runner lost', finished_at = ?2 \1489+ "UPDATE ci_jobs SET \
1490+ state = CASE WHEN cancel_requested = 1 THEN 'cancelled' ELSE 'error' END, \
1491+ message = CASE WHEN cancel_requested = 1 THEN 'cancelled' ELSE 'runner lost' END, \
1492+ finished_at = ?2 \
1490 WHERE id = ?1 AND state = 'running'",1493 WHERE id = ?1 AND state = 'running'",
1491 (job.id.clone(), now.clone()),1494 (job.id.clone(), now.clone()),
1492 )1495 )
@@ -3288,6 +3291,32 @@ mod tests {
3288 );3291 );
3289 }3292 }
3290 3293
3294+ #[tokio::test]
3295+ async fn reap_lost_jobs_marks_a_cancelled_running_job_cancelled() {
3296+ let fx = fixture().await;
3297+ let run = create(
3298+ &fx.store,
3299+ &fx.repo.id,
3300+ &fx.tahinli.id,
3301+ &[job("a", &[], &[])],
3302+ false,
3303+ )
3304+ .await;
3305+ let claimed = fx
3306+ .store
3307+ .claim_job(&bare_runner(&[]))
3308+ .await
3309+ .unwrap()
3310+ .unwrap();
3311+ fx.store.request_cancel(&run.id).await.unwrap();
3312+ let future = stamp_after(Duration::from_secs(3600));
3313+ let reaped = fx.store.reap_lost_jobs(&future).await.unwrap();
3314+ assert_eq!(reaped.len(), 1);
3315+ assert_eq!(reaped[0].id, claimed.0.id);
3316+ assert_eq!(reaped[0].state, JobState::Cancelled);
3317+ assert_eq!(reaped[0].message.as_deref(), Some("cancelled"));
3318+ }
3319+
3291 #[tokio::test]3320 #[tokio::test]
3292 async fn purge_old_returns_logs_and_artifacts_once() {3321 async fn purge_old_returns_logs_and_artifacts_once() {
3293 let fx = fixture().await;3322 let fx = fixture().await;
crates/forge-core/src/store/shell_activity.rsmodified+5 -4
@@ -12,8 +12,9 @@ use crate::error::{Error, Result};
12 use crate::notifications::Reason;12 use crate::notifications::Reason;
13 use crate::time::stamp_ago;13 use crate::time::stamp_ago;
14 14
15-/// Most runs each of `ActorRuns::running` and `ActorRuns::finished` lists.15+/// Most runs each of `ActorRuns::running` and `ActorRuns::finished` lists: enough for the strip's
16-const MAX_ACTOR_RUNS: i64 = 5;16+/// counts and list, bounded when runs pile up in the queue with no runner online.
17+const MAX_ACTOR_RUNS: i64 = 100;
17 18
18 /// How far back a failing run still counts toward `ActorRuns::failing`.19 /// How far back a failing run still counts toward `ActorRuns::failing`.
19 const FAILING_WINDOW: Duration = Duration::from_secs(7 * 24 * 60 * 60);20 const FAILING_WINDOW: Duration = Duration::from_secs(7 * 24 * 60 * 60);
@@ -49,9 +50,9 @@ pub struct WaitingItem {
49 /// The user's own CI runs, as the corner shows them.50 /// The user's own CI runs, as the corner shows them.
50 #[derive(Debug, Clone)]51 #[derive(Debug, Clone)]
51 pub struct ActorRuns {52 pub struct ActorRuns {
52- /// Queued or running runs, newest first, at most 5.53+ /// Queued or running runs, newest first, at most 100.
53 pub running: Vec<ActorRun>,54 pub running: Vec<ActorRun>,
54- /// Runs that finished recently, newest first, at most 5.55+ /// Runs that finished within the caller's window, newest first, at most 100.
55 pub finished: Vec<ActorRun>,56 pub finished: Vec<ActorRun>,
56 /// Refs whose newest run by this user failed within the last 7 days.57 /// Refs whose newest run by this user failed within the last 7 days.
57 pub failing: u64,58 pub failing: u64,
crates/forge-web/assets/nav.jsmodified+88 -33
@@ -623,7 +623,7 @@
623 623
624 // Dropdown menus: the <details> that float over the page (avatar menu, branch selector, clone624 // Dropdown menus: the <details> that float over the page (avatar menu, branch selector, clone
625 // popover, phone menu, profile corner). Inline disclosures are not listed: a click outside leaves them open.625 // popover, phone menu, profile corner). Inline disclosures are not listed: a click outside leaves them open.
626- var DROPDOWN = 'details.menu, details.ref-select, details.clone, details.nav-toggle, details.corner';626+ var DROPDOWN = 'details.menu, details.ref-select, details.clone, details.nav-toggle, details.corner, details.strip-runs';
627 627
628 // Closes every open dropdown that does not contain `from` (pass null to close them all). The corner628 // Closes every open dropdown that does not contain `from` (pass null to close them all). The corner
629 // sits inside the phone menu, so a click in the corner keeps the phone menu open too.629 // sits inside the phone menu, so a click in the corner keeps the phone menu open too.
@@ -1315,53 +1315,108 @@
1315 return typeof href === 'string' && href.charAt(0) === '/' && href.charAt(1) !== '/' ? href : '';1315 return typeof href === 'string' && href.charAt(0) === '/' && href.charAt(1) !== '/' ? href : '';
1316 }1316 }
1317 1317
1318- // The live strip: running pills first, then finished ones, two at most and a "+N" for the rest.1318+ // The live strip, drawn from the same JSON as the server's render. One run is a pill. Two or more are
1319- // The words "passed" and "failed" come from the strip's own data attributes.1319+ // a summary pill (the counts, joined with " · ") that opens a list of every run. The list's <details>
1320- function drawStrip(strip, json) {1320+ // is kept across a redraw and only its contents change, so an open list stays open.
1321- var pills = [];1321+ var OUTCOMES = {
1322+ passed: { state: 'ok', word: 'data-passed' },
1323+ failed: { state: 'bad', word: 'data-failed' },
1324+ cancelled: { state: 'off', word: 'data-cancelled' }
1325+ };
1326+
1327+ // The strip's runs, running ones first, each with its state class and its text (the job or the word).
1328+ function stripRows(strip, json) {
1329+ var rows = [];
1322 (json.running || []).forEach(function (run) {1330 (json.running || []).forEach(function (run) {
1323- pills.push({ cls: 'pill hot', run: run, text: run.job ? ' ' + run.job : '' });1331+ rows.push({ state: 'hot', run: run, text: run.job ? ' ' + run.job : '' });
1324 });1332 });
1325 (json.finished || []).forEach(function (run) {1333 (json.finished || []).forEach(function (run) {
1326- var word = run.ok ? strip.getAttribute('data-passed') : strip.getAttribute('data-failed');1334+ var o = OUTCOMES[run.outcome];
1327- pills.push({ cls: run.ok ? 'pill ok' : 'pill bad', run: run, text: ' ' + (word || '') });1335+ if (!o) { return; }
1336+ rows.push({ state: o.state, run: run, text: ' ' + (strip.getAttribute(o.word) || '') });
1328 });1337 });
1329- var more = pills.length - 2;1338+ return rows;
1330- strip.textContent = '';1339+ }
1331- pills.slice(0, 2).forEach(function (pill) {1340+
1341+ // A run's link: a dot, the run's label in bold, then its text. Used for the lone pill and each row.
1342+ function runLink(cls, row) {
1332 var a = document.createElement('a');1343 var a = document.createElement('a');
1333- a.className = pill.cls;1344+ a.className = cls;
1334- a.setAttribute('href', localHref(pill.run.href));1345+ a.setAttribute('href', localHref(row.run.href));
1335 var dot = document.createElement('span');1346 var dot = document.createElement('span');
1336 dot.className = 'pill-dot';1347 dot.className = 'pill-dot';
1337 var b = document.createElement('b');1348 var b = document.createElement('b');
1338- b.textContent = String(pill.run.label || '');1349+ b.textContent = String(row.run.label || '');
1339 a.appendChild(dot);1350 a.appendChild(dot);
1340 a.appendChild(b);1351 a.appendChild(b);
1341- a.appendChild(document.createTextNode(pill.text));1352+ a.appendChild(document.createTextNode(row.text));
1342- strip.appendChild(a);1353+ return a;
1343- });
1344- if (more > 0) {
1345- var rest = document.createElement('span');
1346- rest.className = 'pill more';
1347- rest.textContent = '+' + more;
1348- strip.appendChild(rest);
1349 }1354 }
1355+
1356+ // The summary's counts: the non-zero ones, each from its template (`{n}` is the count).
1357+ function stripSummary(strip, json) {
1358+ var running = (json.running || []).length;
1359+ var finished = json.finished || [];
1360+ var count = function (outcome) {
1361+ return finished.filter(function (run) { return run.outcome === outcome; }).length;
1362+ };
1363+ var failed = count('failed');
1364+ var passed = count('passed');
1365+ var cancelled = count('cancelled');
1366+ var parts = [
1367+ [running, 'data-count-running'],
1368+ [failed, 'data-count-failed'],
1369+ [passed, 'data-count-passed'],
1370+ [cancelled, 'data-count-cancelled']
1371+ ].filter(function (p) { return p[0] > 0; }).map(function (p) {
1372+ return (strip.getAttribute(p[1]) || '').split('{n}').join(String(p[0]));
1373+ });
1374+ var cls = running ? 'hot' : failed ? 'bad' : passed ? 'ok' : 'off';
1375+ return { cls: 'pill ' + cls, text: parts.join(' \u00b7 ') };
1350 }1376 }
1351 1377
1352- // The heat ring: lit while a run is going, filled to the newest run's share of its jobs (at least 8%).1378+ function drawStrip(strip, json) {
1353- function drawRing(ring, running) {1379+ var rows = stripRows(strip, json);
1354- if (!running.length) {1380+ if (rows.length === 0) { strip.textContent = ''; return; }
1355- ring.classList.remove('hot');1381+ if (rows.length === 1) {
1356- ring.setAttribute('data-p', '0');1382+ strip.textContent = '';
1383+ strip.appendChild(runLink('pill ' + rows[0].state, rows[0]));
1357 return;1384 return;
1358 }1385 }
1359- var run = running[0];1386+ var details = strip.querySelector('details.strip-runs');
1360- var p = run.total ? Math.round(run.done / run.total * 100) : 0;1387+ if (!details) {
1361- p = Math.min(100, Math.max(8, p));1388+ strip.textContent = '';
1362- ring.classList.add('hot');1389+ details = document.createElement('details');
1363- // In steps of 5, as the server renders it; the stylesheet maps each step to --p.1390+ details.className = 'strip-runs';
1364- ring.setAttribute('data-p', String(Math.round(p / 5) * 5));1391+ details.id = 'strip-runs';
1392+ var summary = document.createElement('summary');
1393+ summary.setAttribute('aria-label', strip.getAttribute('data-runs-label') || '');
1394+ var dot = document.createElement('span');
1395+ dot.className = 'pill-dot';
1396+ summary.appendChild(dot);
1397+ summary.appendChild(document.createTextNode(''));
1398+ details.appendChild(summary);
1399+ var list = document.createElement('ul');
1400+ list.className = 'strip-list';
1401+ details.appendChild(list);
1402+ strip.appendChild(details);
1403+ }
1404+ var head = stripSummary(strip, json);
1405+ var sum = details.querySelector('summary');
1406+ sum.className = head.cls;
1407+ sum.lastChild.nodeValue = head.text;
1408+ var rowsEl = details.querySelector('.strip-list');
1409+ rowsEl.textContent = '';
1410+ rows.forEach(function (row) {
1411+ var li = document.createElement('li');
1412+ li.appendChild(runLink('strip-row ' + row.state, row));
1413+ rowsEl.appendChild(li);
1414+ });
1415+ }
1416+
1417+ // The heat ring: a full ember ring while any of the viewer's runs is going, a plain ring otherwise.
1418+ function drawRing(ring, running) {
1419+ if (running.length) { ring.classList.add('hot'); } else { ring.classList.remove('hot'); }
1365 }1420 }
1366 1421
1367 // The chips: one per non-zero count. The titles come from the chip box's templates, with `{n}`1422 // The chips: one per non-zero count. The titles come from the chip box's templates, with `{n}`
crates/forge-web/src/i18n/misc.rsmodified+41 -0
@@ -176,6 +176,8 @@ pub enum K {
176 AllNotifications,176 AllNotifications,
177 Passed,177 Passed,
178 Failed,178 Failed,
179+ Cancelled,
180+ YourCiRuns,
179 SearchPublicReposFor,181 SearchPublicReposFor,
180 }182 }
181 183
@@ -330,6 +332,8 @@ const ALL: &[K] = &[
330 K::AllNotifications,332 K::AllNotifications,
331 K::Passed,333 K::Passed,
332 K::Failed,334 K::Failed,
335+ K::Cancelled,
336+ K::YourCiRuns,
333 K::SearchPublicReposFor,337 K::SearchPublicReposFor,
334 ];338 ];
335 339
@@ -659,6 +663,10 @@ pub fn t(lang: Lang, key: K) -> &'static str {
659 (Passed, Tr) => "geçti",663 (Passed, Tr) => "geçti",
660 (Failed, En) => "failed",664 (Failed, En) => "failed",
661 (Failed, Tr) => "başarısız",665 (Failed, Tr) => "başarısız",
666+ (Cancelled, En) => "cancelled",
667+ (Cancelled, Tr) => "iptal edildi",
668+ (YourCiRuns, En) => "Your CI runs",
669+ (YourCiRuns, Tr) => "CI çalıştırmaların",
662 (SearchPublicReposFor, En) => "Search public repositories for",670 (SearchPublicReposFor, En) => "Search public repositories for",
663 (SearchPublicReposFor, Tr) => "Herkese açık depolarda ara:",671 (SearchPublicReposFor, Tr) => "Herkese açık depolarda ara:",
664 }672 }
@@ -713,6 +721,39 @@ pub fn failing_runs_count(lang: Lang, n: u64) -> String {
713 }721 }
714 }722 }
715 723
724+/// `28 running` / `3 çalışıyor`: the live strip's counts. Each takes its number as `{n}` in the
725+/// strip's templates, so these phrases have no plural.
726+pub fn running_count(lang: Lang, n: u64) -> String {
727+ match lang {
728+ Lang::En => format!("{n} running"),
729+ Lang::Tr => format!("{n} çalışıyor"),
730+ }
731+}
732+
733+/// `2 failed` / `2 başarısız`.
734+pub fn failed_count(lang: Lang, n: u64) -> String {
735+ match lang {
736+ Lang::En => format!("{n} failed"),
737+ Lang::Tr => format!("{n} başarısız"),
738+ }
739+}
740+
741+/// `2 passed` / `2 başarılı`.
742+pub fn passed_count(lang: Lang, n: u64) -> String {
743+ match lang {
744+ Lang::En => format!("{n} passed"),
745+ Lang::Tr => format!("{n} başarılı"),
746+ }
747+}
748+
749+/// `2 cancelled` / `2 iptal edildi`.
750+pub fn cancelled_count(lang: Lang, n: u64) -> String {
751+ match lang {
752+ Lang::En => format!("{n} cancelled"),
753+ Lang::Tr => format!("{n} iptal edildi"),
754+ }
755+}
756+
716 /// `1 contribution` / `3 contributions`, and `3 katkı` in Turkish.757 /// `1 contribution` / `3 contributions`, and `3 katkı` in Turkish.
717 pub fn contributions_count(lang: Lang, n: u64) -> String {758 pub fn contributions_count(lang: Lang, n: u64) -> String {
718 match lang {759 match lang {
crates/forge-web/src/i18n/releases_ci.rsmodified+11 -2
@@ -86,6 +86,9 @@ pub enum K {
86 StateError,86 StateError,
87 StateBlocked,87 StateBlocked,
88 StateSkipped,88 StateSkipped,
89+ /// A running job whose cancel was requested, until its runner stops it.
90+ StateStopping,
91+ StoppingButton,
89 92
90 // Release notices, shown after a release action.93 // Release notices, shown after a release action.
91 RelSaved,94 RelSaved,
@@ -152,10 +155,10 @@ pub fn t(lang: Lang, key: K) -> &'static str {
152 (CiNoticeStarted, En) => "Workflow run queued.",155 (CiNoticeStarted, En) => "Workflow run queued.",
153 (CiNoticeStarted, Tr) => "İş akışı çalıştırması sıraya alındı.",156 (CiNoticeStarted, Tr) => "İş akışı çalıştırması sıraya alındı.",
154 (CiNoticeCancelled, En) => {157 (CiNoticeCancelled, En) => {
155- "Cancellation requested. Queued jobs were cancelled; running jobs stop at their next heartbeat."158+ "Cancel requested. Queued jobs are cancelled; running jobs show as stopping until the runner stops them."
156 }159 }
157 (CiNoticeCancelled, Tr) => {160 (CiNoticeCancelled, Tr) => {
158- "İptal istendi. Sıradaki işler iptal edildi; çalışan işler bir sonraki kalp atışında duracak."161+ "İptal istendi. Sıradaki işler iptal edildi; çalışan işler, çalıştırıcı onları durdurana dek durduruluyor olarak görünür."
159 }162 }
160 (CiNoticeApproved, En) => "Run approved. Its jobs are queued.",163 (CiNoticeApproved, En) => "Run approved. Its jobs are queued.",
161 (CiNoticeApproved, Tr) => "Çalıştırma onaylandı. İşler sıraya alındı.",164 (CiNoticeApproved, Tr) => "Çalıştırma onaylandı. İşler sıraya alındı.",
@@ -317,6 +320,10 @@ pub fn t(lang: Lang, key: K) -> &'static str {
317 (StateBlocked, Tr) => "engellendi",320 (StateBlocked, Tr) => "engellendi",
318 (StateSkipped, En) => "skipped",321 (StateSkipped, En) => "skipped",
319 (StateSkipped, Tr) => "atlandı",322 (StateSkipped, Tr) => "atlandı",
323+ (StateStopping, En) => "stopping",
324+ (StateStopping, Tr) => "durduruluyor",
325+ (StoppingButton, En) => "Stopping…",
326+ (StoppingButton, Tr) => "Durduruluyor…",
320 327
321 (RelSaved, En) => "Release saved.",328 (RelSaved, En) => "Release saved.",
322 (RelSaved, Tr) => "Sürüm kaydedildi.",329 (RelSaved, Tr) => "Sürüm kaydedildi.",
@@ -620,6 +627,8 @@ mod tests {
620 K::StateError,627 K::StateError,
621 K::StateBlocked,628 K::StateBlocked,
622 K::StateSkipped,629 K::StateSkipped,
630+ K::StateStopping,
631+ K::StoppingButton,
623 K::RelSaved,632 K::RelSaved,
624 K::RelDeleted,633 K::RelDeleted,
625 K::RelAssetUploaded,634 K::RelAssetUploaded,
crates/forge-web/src/pages/activity.rsmodified+14 -3
@@ -37,6 +37,16 @@ fn run_json(run: &ActorRun) -> Value {
37 })37 })
38 }38 }
39 39
40+/// How a finished run ended, as the activity JSON names it. None for any other state.
41+pub(crate) fn outcome_word(state: RunState) -> Option<&'static str> {
42+ match state {
43+ RunState::Success => Some("passed"),
44+ RunState::Failure | RunState::Error => Some("failed"),
45+ RunState::Cancelled => Some("cancelled"),
46+ _ => None,
47+ }
48+}
49+
40 /// The viewer's activity as JSON. `reviews` and `mentions` count unread inbox rows, `failing` counts50 /// The viewer's activity as JSON. `reviews` and `mentions` count unread inbox rows, `failing` counts
41 /// refs whose newest run failed, `running` and `finished` list the viewer's CI runs and `waiting`51 /// refs whose newest run failed, `running` and `finished` list the viewer's CI runs and `waiting`
42 /// lists the newest review requests and mentions. Reads only; the caller decides how to send it.52 /// lists the newest review requests and mentions. Reads only; the caller decides how to send it.
@@ -49,10 +59,11 @@ pub(crate) async fn activity_json(state: &AppState, user: &User) -> Result<Value
49 let finished: Vec<Value> = runs59 let finished: Vec<Value> = runs
50 .finished60 .finished
51 .iter()61 .iter()
52- .map(|run| {62+ .filter_map(|run| {
63+ let outcome = outcome_word(run.state)?;
53 let mut item = run_json(run);64 let mut item = run_json(run);
54- item["ok"] = json!(matches!(run.state, RunState::Success));65+ item["outcome"] = json!(outcome);
55- item66+ Some(item)
56 })67 })
57 .collect();68 .collect();
58 let waiting: Vec<Value> = waiting69 let waiting: Vec<Value> = waiting
crates/forge-web/src/pages/ci_badge.rsmodified+10 -4
@@ -41,6 +41,7 @@ pub enum BadgeStatus {
41 Passing,41 Passing,
42 Failing,42 Failing,
43 Error,43 Error,
44+ Cancelled,
44 Running,45 Running,
45 Pending,46 Pending,
46 Skipped,47 Skipped,
@@ -54,6 +55,7 @@ impl BadgeStatus {
54 BadgeStatus::Passing => "passing",55 BadgeStatus::Passing => "passing",
55 BadgeStatus::Failing => "failing",56 BadgeStatus::Failing => "failing",
56 BadgeStatus::Error => "error",57 BadgeStatus::Error => "error",
58+ BadgeStatus::Cancelled => "cancelled",
57 BadgeStatus::Running => "running",59 BadgeStatus::Running => "running",
58 BadgeStatus::Pending => "pending",60 BadgeStatus::Pending => "pending",
59 BadgeStatus::Skipped => "skipped",61 BadgeStatus::Skipped => "skipped",
@@ -68,7 +70,7 @@ impl BadgeStatus {
68 BadgeStatus::Failing => "#e05d44",70 BadgeStatus::Failing => "#e05d44",
69 BadgeStatus::Error => "#9a5b5b",71 BadgeStatus::Error => "#9a5b5b",
70 BadgeStatus::Running | BadgeStatus::Pending => "#dfb317",72 BadgeStatus::Running | BadgeStatus::Pending => "#dfb317",
71- BadgeStatus::Skipped | BadgeStatus::NoStatus => GREY,73+ BadgeStatus::Cancelled | BadgeStatus::Skipped | BadgeStatus::NoStatus => GREY,
72 }74 }
73 }75 }
74 }76 }
@@ -78,7 +80,8 @@ pub fn status_of_run(state: RunState) -> BadgeStatus {
78 match state {80 match state {
79 RunState::Success => BadgeStatus::Passing,81 RunState::Success => BadgeStatus::Passing,
80 RunState::Failure => BadgeStatus::Failing,82 RunState::Failure => BadgeStatus::Failing,
81- RunState::Error | RunState::Cancelled => BadgeStatus::Error,83+ RunState::Error => BadgeStatus::Error,
84+ RunState::Cancelled => BadgeStatus::Cancelled,
82 RunState::Queued | RunState::Running => BadgeStatus::Running,85 RunState::Queued | RunState::Running => BadgeStatus::Running,
83 RunState::WaitingApproval => BadgeStatus::Pending,86 RunState::WaitingApproval => BadgeStatus::Pending,
84 }87 }
@@ -89,7 +92,8 @@ pub fn status_of_job(state: JobState) -> BadgeStatus {
89 match state {92 match state {
90 JobState::Success => BadgeStatus::Passing,93 JobState::Success => BadgeStatus::Passing,
91 JobState::Failure => BadgeStatus::Failing,94 JobState::Failure => BadgeStatus::Failing,
92- JobState::Error | JobState::Cancelled => BadgeStatus::Error,95+ JobState::Error => BadgeStatus::Error,
96+ JobState::Cancelled => BadgeStatus::Cancelled,
93 JobState::Blocked | JobState::Queued | JobState::Running => BadgeStatus::Running,97 JobState::Blocked | JobState::Queued | JobState::Running => BadgeStatus::Running,
94 JobState::Skipped => BadgeStatus::Skipped,98 JobState::Skipped => BadgeStatus::Skipped,
95 }99 }
@@ -289,6 +293,7 @@ mod tests {
289 (BadgeStatus::Error, "#9a5b5b", "error"),293 (BadgeStatus::Error, "#9a5b5b", "error"),
290 (BadgeStatus::Running, "#dfb317", "running"),294 (BadgeStatus::Running, "#dfb317", "running"),
291 (BadgeStatus::Pending, "#dfb317", "pending"),295 (BadgeStatus::Pending, "#dfb317", "pending"),
296+ (BadgeStatus::Cancelled, "#9f9f9f", "cancelled"),
292 (BadgeStatus::Skipped, "#9f9f9f", "skipped"),297 (BadgeStatus::Skipped, "#9f9f9f", "skipped"),
293 (BadgeStatus::NoStatus, "#9f9f9f", "no status"),298 (BadgeStatus::NoStatus, "#9f9f9f", "no status"),
294 ];299 ];
@@ -305,7 +310,7 @@ mod tests {
305 fn run_and_job_states_map_to_badge_statuses() {310 fn run_and_job_states_map_to_badge_statuses() {
306 assert_eq!(status_of_run(RunState::Success), BadgeStatus::Passing);311 assert_eq!(status_of_run(RunState::Success), BadgeStatus::Passing);
307 assert_eq!(status_of_run(RunState::Failure), BadgeStatus::Failing);312 assert_eq!(status_of_run(RunState::Failure), BadgeStatus::Failing);
308- assert_eq!(status_of_run(RunState::Cancelled), BadgeStatus::Error);313+ assert_eq!(status_of_run(RunState::Cancelled), BadgeStatus::Cancelled);
309 assert_eq!(status_of_run(RunState::Error), BadgeStatus::Error);314 assert_eq!(status_of_run(RunState::Error), BadgeStatus::Error);
310 assert_eq!(status_of_run(RunState::Queued), BadgeStatus::Running);315 assert_eq!(status_of_run(RunState::Queued), BadgeStatus::Running);
311 assert_eq!(status_of_run(RunState::Running), BadgeStatus::Running);316 assert_eq!(status_of_run(RunState::Running), BadgeStatus::Running);
@@ -314,6 +319,7 @@ mod tests {
314 BadgeStatus::Pending319 BadgeStatus::Pending
315 );320 );
316 assert_eq!(status_of_job(JobState::Blocked), BadgeStatus::Running);321 assert_eq!(status_of_job(JobState::Blocked), BadgeStatus::Running);
322+ assert_eq!(status_of_job(JobState::Cancelled), BadgeStatus::Cancelled);
317 assert_eq!(status_of_job(JobState::Skipped), BadgeStatus::Skipped);323 assert_eq!(status_of_job(JobState::Skipped), BadgeStatus::Skipped);
318 }324 }
319 325
crates/forge-web/src/pages/ci_job.rsmodified+14 -4
@@ -11,7 +11,7 @@ use std::sync::Arc;
11 use std::time::Duration;11 use std::time::Duration;
12 12
13 use bytes::Bytes;13 use bytes::Bytes;
14-use forge_core::ci::{CiArtifact, CiJob, CiRun};14+use forge_core::ci::{CiArtifact, CiJob, CiRun, JobState};
15 use forge_core::{Store, User};15 use forge_core::{Store, User};
16 use futures_util::{Stream, TryStreamExt};16 use futures_util::{Stream, TryStreamExt};
17 use http::header::{CONTENT_DISPOSITION, CONTENT_LENGTH, CONTENT_TYPE};17 use http::header::{CONTENT_DISPOSITION, CONTENT_LENGTH, CONTENT_TYPE};
@@ -304,6 +304,16 @@ fn job_fingerprint(status: &str, artifact_ids: &[&str], log_kept: bool) -> Strin
304 )304 )
305 }305 }
306 306
307+/// The status the job page shows and fingerprints: `stopping` for a running job with a cancel
308+/// request its runner has not acted on yet, else the job's state.
309+pub fn job_status(job: &CiJob) -> &'static str {
310+ if job.state == JobState::Running && job.cancel_requested {
311+ "stopping"
312+ } else {
313+ job.state.as_str()
314+ }
315+}
316+
307 /// The job's fingerprint now. `None` when the job row is gone.317 /// The job's fingerprint now. `None` when the job row is gone.
308 async fn job_fingerprint_now(store: &Store, job_id: &str) -> Result<Option<String>> {318 async fn job_fingerprint_now(store: &Store, job_id: &str) -> Result<Option<String>> {
309 let Some(job) = store.job_by_id(job_id).await? else {319 let Some(job) = store.job_by_id(job_id).await? else {
@@ -312,7 +322,7 @@ async fn job_fingerprint_now(store: &Store, job_id: &str) -> Result<Option<Strin
312 let artifacts = store.list_artifacts(job_id).await?;322 let artifacts = store.list_artifacts(job_id).await?;
313 let ids: Vec<&str> = artifacts.iter().map(|artifact| artifact.id.as_str()).collect();323 let ids: Vec<&str> = artifacts.iter().map(|artifact| artifact.id.as_str()).collect();
314 Ok(Some(job_fingerprint(324 Ok(Some(job_fingerprint(
315- job.state.as_str(),325+ job_status(&job),
316 &ids,326 &ids,
317 job.log_bytes > 0,327 job.log_bytes > 0,
318 )))328 )))
@@ -422,7 +432,7 @@ async fn job_page(cx: &Cx) -> Result<impl View> {
422 } = log_tail(&log_path(&state.config.data_dir, &job.id)).await?;432 } = log_tail(&log_path(&state.config.data_dir, &job.id)).await?;
423 let listed = state.store.list_artifacts(&job.id).await?;433 let listed = state.store.list_artifacts(&job.id).await?;
424 let ids: Vec<&str> = listed.iter().map(|artifact| artifact.id.as_str()).collect();434 let ids: Vec<&str> = listed.iter().map(|artifact| artifact.id.as_str()).collect();
425- let fingerprint = job_fingerprint(job.state.as_str(), &ids, job.log_bytes > 0);435+ let fingerprint = job_fingerprint(job_status(&job), &ids, job.log_bytes > 0);
426 let artifacts = listed436 let artifacts = listed
427 .into_iter()437 .into_iter()
428 .map(|artifact| ArtifactRow {438 .map(|artifact| ArtifactRow {
@@ -451,7 +461,7 @@ async fn job_page(cx: &Cx) -> Result<impl View> {
451 let view = JobView {461 let view = JobView {
452 name: job.name.clone(),462 name: job.name.clone(),
453 fingerprint,463 fingerprint,
454- state: state_text(lang, job.state.as_str()),464+ state: state_text(lang, job_status(&job)),
455 state_class: format!("ci-state ci-{}", job.state.as_str()),465 state_class: format!("ci-state ci-{}", job.state.as_str()),
456 runner,466 runner,
457 exit_code: job467 exit_code: job
crates/forge-web/src/pages/ci_runs.rsmodified+24 -3
@@ -202,7 +202,7 @@ pub(crate) fn duration_text(lang: Lang, started: Option<&str>, finished: Option<
202 202
203 /// The duration formats of `lang` with `{m}` and `{s}` where the numbers go, for the client ticker:203 /// The duration formats of `lang` with `{m}` and `{s}` where the numbers go, for the client ticker:
204 /// the one with minutes and the seconds-only one.204 /// the one with minutes and the seconds-only one.
205-fn duration_templates(lang: Lang) -> (String, String) {205+pub(crate) fn duration_templates(lang: Lang) -> (String, String) {
206 (206 (
207 g::duration_minutes(lang, 111_111, 222_222)207 g::duration_minutes(lang, 111_111, 222_222)
208 .replace("111111", "{m}")208 .replace("111111", "{m}")
@@ -221,6 +221,7 @@ pub fn state_text(lang: Lang, state: &str) -> String {
221 "success" => K::StateSuccess,221 "success" => K::StateSuccess,
222 "failure" => K::StateFailure,222 "failure" => K::StateFailure,
223 "cancelled" => K::StateCancelled,223 "cancelled" => K::StateCancelled,
224+ "stopping" => K::StateStopping,
224 "error" => K::StateError,225 "error" => K::StateError,
225 "blocked" => K::StateBlocked,226 "blocked" => K::StateBlocked,
226 "skipped" => K::StateSkipped,227 "skipped" => K::StateSkipped,
@@ -282,10 +283,11 @@ pub(crate) async fn after_change(state: &AppState, run_id: &str, before: &[CiJob
282 state.ci_live.bump_run(run_id);283 state.ci_live.bump_run(run_id);
283 state.ci_live.bump_repo(&run.repo_id);284 state.ci_live.bump_repo(&run.repo_id);
284 for job in state.store.jobs_for_run(run_id).await? {285 for job in state.store.jobs_for_run(run_id).await? {
286+ // A cancel request on a running job changes no state, but its row shows "stopping".
285 let changed = before287 let changed = before
286 .iter()288 .iter()
287 .find(|old| old.id == job.id)289 .find(|old| old.id == job.id)
288- .is_none_or(|old| old.state != job.state);290+ .is_none_or(|old| old.state != job.state || old.cancel_requested != job.cancel_requested);
289 if changed {291 if changed {
290 if job.state.is_terminal() {292 if job.state.is_terminal() {
291 state.ci_live.close_job(&job.id);293 state.ci_live.close_job(&job.id);
@@ -395,6 +397,8 @@ struct JobLine {
395 expanded: bool,397 expanded: bool,
396 /// The POST target that runs this job again. Set for a writer, once the job has finished.398 /// The POST target that runs this job again. Set for a writer, once the job has finished.
397 rerun: Option<String>,399 rerun: Option<String>,
400+ /// A running job whose cancel was requested: it shows as stopping until its runner stops it.
401+ stopping: bool,
398 }402 }
399 403
400 /// One artifact of the run: its download link, the job that made it, its name and size.404 /// One artifact of the run: its download link, the job that made it, its name and size.
@@ -426,6 +430,8 @@ struct RunDetail {
426 action_base: String,430 action_base: String,
427 can_approve: bool,431 can_approve: bool,
428 can_cancel: bool,432 can_cancel: bool,
433+ /// A running job of the run has a cancel request: the run shows Stopping in place of Cancel.
434+ stopping: bool,
429 /// A finished run with a failed, errored or cancelled job, for a writer.435 /// A finished run with a failed, errored or cancelled job, for a writer.
430 can_rerun_failed: bool,436 can_rerun_failed: bool,
431 /// The config keys this forge ignored when it made the run.437 /// The config keys this forge ignored when it made the run.
@@ -606,9 +612,15 @@ struct Timing {
606 queued: Option<i64>,612 queued: Option<i64>,
607 started: Option<i64>,613 started: Option<i64>,
608 finished: Option<i64>,614 finished: Option<i64>,
615+ cancel_requested: bool,
609 }616 }
610 617
611 impl Timing {618 impl Timing {
619+ /// Whether the job runs and has a cancel request its runner has not yet acted on.
620+ fn stopping(&self) -> bool {
621+ self.cancel_requested && self.state == JobState::Running
622+ }
623+
612 /// Where the job ends, in unix seconds: its finish, or `now` while it runs. None before it starts.624 /// Where the job ends, in unix seconds: its finish, or `now` while it runs. None before it starts.
613 fn end(&self, now: i64) -> Option<i64> {625 fn end(&self, now: i64) -> Option<i64> {
614 self.started?;626 self.started?;
@@ -1112,6 +1124,7 @@ fn timing_of(job: &CiJob, runner: String, lang: Lang) -> Timing {
1112 queued: job.queued_at.as_deref().and_then(unix_of),1124 queued: job.queued_at.as_deref().and_then(unix_of),
1113 started: job.started_at.as_deref().and_then(unix_of),1125 started: job.started_at.as_deref().and_then(unix_of),
1114 finished: job.finished_at.as_deref().and_then(unix_of),1126 finished: job.finished_at.as_deref().and_then(unix_of),
1127+ cancel_requested: job.cancel_requested,
1115 }1128 }
1116 }1129 }
1117 1130
@@ -1535,6 +1548,7 @@ async fn run_detail(
1535 since: (job.finished.is_none() && job.state == JobState::Running)1548 since: (job.finished.is_none() && job.state == JobState::Running)
1536 .then(|| job.started.map(|at| at.to_string()))1549 .then(|| job.started.map(|at| at.to_string()))
1537 .flatten(),1550 .flatten(),
1551+ stopping: job.stopping(),
1538 });1552 });
1539 }1553 }
1540 let can_rerun_failed = writer1554 let can_rerun_failed = writer
@@ -1572,6 +1586,7 @@ async fn run_detail(
1572 action_base: run_href(title, run.number),1586 action_base: run_href(title, run.number),
1573 can_approve: header.writer_csrf.is_some() && run.state == RunState::WaitingApproval,1587 can_approve: header.writer_csrf.is_some() && run.state == RunState::WaitingApproval,
1574 can_cancel: header.writer_csrf.is_some() && !run_finished(&run.state),1588 can_cancel: header.writer_csrf.is_some() && !run_finished(&run.state),
1589+ stopping: jobs.iter().any(Timing::stopping),
1575 can_rerun_failed,1590 can_rerun_failed,
1576 warnings,1591 warnings,
1577 artifacts,1592 artifacts,
@@ -1704,7 +1719,9 @@ async fn runs_body(
1704 if run.can_approve {1719 if run.can_approve {
1705 action_button(action: format!("{}/approve", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::ApproveAndRun))1720 action_button(action: format!("{}/approve", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::ApproveAndRun))
1706 }1721 }
1707- if run.can_cancel {1722+ if run.can_cancel && run.stopping {
1723+ <button type="button" class="ci-stopping" disabled="disabled">(g::t(lang, K::StoppingButton))</button>
1724+ } else if run.can_cancel {
1708 action_button(action: format!("{}/cancel", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::Cancel))1725 action_button(action: format!("{}/cancel", run.action_base), csrf: csrf.clone(), label: g::t(lang, K::Cancel))
1709 }1726 }
1710 if run.can_rerun_failed {1727 if run.can_rerun_failed {
@@ -1800,6 +1817,9 @@ async fn runs_body(
1800 </span>1817 </span>
1801 <span class="ci-job-runner">(job.runner.as_str())</span>1818 <span class="ci-job-runner">(job.runner.as_str())</span>
1802 <span class="ci-job-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>1819 <span class="ci-job-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>
1820+ if job.stopping {
1821+ <span class="ci-job-stopping muted small">(g::t(lang, K::StateStopping))</span>
1822+ }
1803 <span class="ci-chev" aria-hidden="true"></span>1823 <span class="ci-chev" aria-hidden="true"></span>
1804 </a>1824 </a>
1805 if let (Some(action), Some(csrf)) = (job.rerun.as_ref(), run.writer_csrf.as_ref()) {1825 if let (Some(action), Some(csrf)) = (job.rerun.as_ref(), run.writer_csrf.as_ref()) {
@@ -2432,6 +2452,7 @@ mod tests {
2432 queued,2452 queued,
2433 started,2453 started,
2434 finished,2454 finished,
2455+ cancel_requested: false,
2435 }2456 }
2436 }2457 }
2437 2458
crates/forge-web/src/pages/repo_side.rsmodified+92 -53
@@ -10,22 +10,22 @@ use std::sync::{Mutex, OnceLock};
10 use forge_core::ci::{JobState, RunState};10 use forge_core::ci::{JobState, RunState};
11 use forge_core::{Repo, Visibility};11 use forge_core::{Repo, Visibility};
12 use forge_git::{browse, history};12 use forge_git::{browse, history};
13+use time::OffsetDateTime;
14+use time::format_description::well_known::Rfc3339;
13 use topcoat::Result;15 use topcoat::Result;
14 use topcoat::view::{View, component, view};16 use topcoat::view::{View, component, view};
15 17
16 use crate::i18n::Lang;18 use crate::i18n::Lang;
17 use crate::i18n::releases_ci as rc;19 use crate::i18n::releases_ci as rc;
18-use crate::pages::ci_runs::{duration_text, run_href};20+use crate::pages::ci_runs::{duration_templates, duration_text, run_href, state_text};
19 use crate::pages::passkeys::s;21 use crate::pages::passkeys::s;
20 use crate::pages::releases::LatestRelease;22 use crate::pages::releases::LatestRelease;
21 use crate::repo_stats::{LangShare, languages, license_file, license_id};23 use crate::repo_stats::{LangShare, languages, license_file, license_id};
22 use crate::state::AppState;24 use crate::state::AppState;
23-use crate::views::{human_size, rel_time, short_oid};25+use crate::views::{human_size, now_unix, rel_time, short_oid};
24 26
25 /// CI runs the column lists.27 /// CI runs the column lists.
26 const RUNS_SHOWN: u32 = 3;28 const RUNS_SHOWN: u32 = 3;
27-/// Jobs shown as pips; a run with more shows a count instead.
28-const MAX_PIPS: usize = 10;
29 /// Languages listed before the rest fold into "Other".29 /// Languages listed before the rest fold into "Other".
30 const TOP_LANGUAGES: usize = 4;30 const TOP_LANGUAGES: usize = 4;
31 /// Files the language count reads at most.31 /// Files the language count reads at most.
@@ -106,38 +106,38 @@ pub async fn tree_facts(
106 Ok(facts)106 Ok(facts)
107 }107 }
108 108
109-/// One CI run as the column shows it.109+/// One CI run as the column shows it: a link to the run, its dot, and one line of words. A run
110+/// still going has a bar of the jobs done and a clock that ticks.
110 pub struct RunRow {111 pub struct RunRow {
111 pub href: String,112 pub href: String,
112 pub number: i64,113 pub number: i64,
113 pub dot: &'static str,114 pub dot: &'static str,
114- pub meta: String,115+ /// The bar's fill and its job count, for a run still going.
115- /// Each job's pip class, or empty when the run has more jobs than pips.116+ pub bar: Option<(String, String)>,
116- pub pips: Vec<&'static str>,117+ /// Unix seconds the run started, for the ticking clock of a run still going.
117- /// "3/12" when the jobs do not fit as pips.118+ pub since: Option<String>,
118- pub count: String,119+ /// The text before the clock: the current job's name.
120+ pub pre: Option<String>,
121+ /// The right-hand text, or the elapsed time of a run still going.
122+ pub label: String,
119 pub title: String,123 pub title: String,
120 }124 }
121 125
122-/// The dot of a run: green passed, red failed, amber in progress, grey otherwise.126+/// The dot of a run: glowing while it goes, green passed, red failed, grey otherwise.
123 fn run_dot(run: RunState) -> &'static str {127 fn run_dot(run: RunState) -> &'static str {
124 match run {128 match run {
125 RunState::Success => "health-dot ok",129 RunState::Success => "health-dot ok",
126 RunState::Failure | RunState::Error => "health-dot bad",130 RunState::Failure | RunState::Error => "health-dot bad",
127- RunState::Running | RunState::Queued => "health-dot warn",131+ RunState::Running | RunState::Queued => "health-dot ember",
128 RunState::Cancelled | RunState::WaitingApproval => "health-dot",132 RunState::Cancelled | RunState::WaitingApproval => "health-dot",
129 }133 }
130 }134 }
131 135
132-/// The pip of a job: filled when it passed, red when it failed, accent while it runs.136+/// Unix seconds of an RFC 3339 stamp.
133-fn job_pip(job: JobState) -> &'static str {137+fn unix(stamp: &str) -> Option<i64> {
134- match job {138+ OffsetDateTime::parse(stamp, &Rfc3339)
135- JobState::Success => "side-pip is-ok",139+ .ok()
136- JobState::Failure | JobState::Error => "side-pip is-bad",140+ .map(|at| at.unix_timestamp())
137- JobState::Running => "side-pip is-on",
138- JobState::Skipped | JobState::Cancelled => "side-pip is-off",
139- JobState::Blocked | JobState::Queued => "side-pip",
140- }
141 }141 }
142 142
143 /// The newest runs of the repo, with their jobs.143 /// The newest runs of the repo, with their jobs.
@@ -147,6 +147,7 @@ pub async fn run_rows(state: &AppState, lang: Lang, repo: &Repo) -> Result<Vec<R
147 let mut rows = Vec::with_capacity(runs.len());147 let mut rows = Vec::with_capacity(runs.len());
148 for run in runs {148 for run in runs {
149 let jobs = state.store.jobs_for_run(&run.id).await?;149 let jobs = state.store.jobs_for_run(&run.id).await?;
150+ let total = jobs.len();
150 let done = jobs151 let done = jobs
151 .iter()152 .iter()
152 .filter(|job| {153 .filter(|job| {
@@ -162,29 +163,66 @@ pub async fn run_rows(state: &AppState, lang: Lang, repo: &Repo) -> Result<Vec<R
162 .strip_prefix("refs/heads/")163 .strip_prefix("refs/heads/")
163 .or_else(|| run.git_ref.strip_prefix("refs/tags/"))164 .or_else(|| run.git_ref.strip_prefix("refs/tags/"))
164 .unwrap_or(&run.git_ref);165 .unwrap_or(&run.git_ref);
165- let mut meta = vec![branch.to_owned(), short_oid(&run.commit_oid).to_owned()];166+ let (bar, since, pre, label) = if matches!(run.state, RunState::Running | RunState::Queued)
166- let took = duration_text(lang, started, run.finished_at.as_deref());167+ {
167- if !took.is_empty() {168+ let current = jobs
168- meta.push(took);169+ .iter()
170+ .find(|job| job.state == JobState::Running)
171+ .or_else(|| jobs.iter().find(|job| job.state == JobState::Queued))
172+ .map(|job| job.name.as_str())
173+ .unwrap_or("");
174+ let current = if current.is_empty() && run.state == RunState::Queued {
175+ s(lang, "queued", "sırada")
176+ } else {
177+ current
178+ };
179+ // A sliver shows even before the first job is done.
180+ let fill = if done == 0 { 0.2 } else { done as f64 };
181+ let since_stamp = started.unwrap_or(run.created_at.as_str());
182+ (
183+ Some((format!("{fill}"), total.max(1).to_string())),
184+ unix(since_stamp).map(|secs| secs.to_string()),
185+ (!current.is_empty()).then(|| format!("{current} \u{b7} ")),
186+ duration_text(lang, Some(since_stamp), None),
187+ )
188+ } else {
189+ let failed = jobs
190+ .iter()
191+ .find(|job| matches!(job.state, JobState::Failure | JobState::Error))
192+ .map(|job| job.name.as_str());
193+ let word = match run.state {
194+ RunState::Success => s(lang, "passed", "geçti").to_owned(),
195+ RunState::Failure | RunState::Error => match failed {
196+ Some(name) => format!("{name} {}", s(lang, "failed", "başarısız")),
197+ None => s(lang, "failed", "başarısız").to_owned(),
198+ },
199+ RunState::Cancelled => s(lang, "cancelled", "iptal edildi").to_owned(),
200+ RunState::WaitingApproval | RunState::Running | RunState::Queued => {
201+ state_text(lang, run.state.as_str())
169 }202 }
170- let fits = jobs.len() <= MAX_PIPS;203+ };
204+ // The same words as the running clock and the CI pages: "4m 12s".
205+ let took = duration_text(lang, started, run.finished_at.as_deref());
206+ let label = if took.is_empty() || run.finished_at.is_none() {
207+ word
208+ } else {
209+ format!("{word} \u{b7} {took}")
210+ };
211+ (None, None, None, label)
212+ };
171 rows.push(RunRow {213 rows.push(RunRow {
172 href: run_href(&title, run.number),214 href: run_href(&title, run.number),
173 number: run.number,215 number: run.number,
174 dot: run_dot(run.state),216 dot: run_dot(run.state),
175- meta: meta.join(" \u{b7} "),217+ bar,
176- pips: if fits {218+ since,
177- jobs.iter().map(|job| job_pip(job.state)).collect()219+ pre,
178- } else {220+ label,
179- Vec::new()221+ title: format!(
180- },222+ "{}: {done}/{total} \u{b7} {branch} \u{b7} {}",
181- count: if fits {223+ s(lang, "Jobs passed", "Geçen işler"),
182- String::new()224+ short_oid(&run.commit_oid)
183- } else {225+ ),
184- format!("{done}/{}", jobs.len())
185- },
186- title: s(lang, "Jobs passed", "Geçen işler").to_owned()
187- + &format!(": {done}/{}", jobs.len()),
188 });226 });
189 }227 }
190 Ok(rows)228 Ok(rows)
@@ -227,6 +265,9 @@ pub async fn repo_side(
227 let size = facts.as_ref().map(|f| human_size(lang, f.size));265 let size = facts.as_ref().map(|f| human_size(lang, f.size));
228 let license = facts.as_ref().and_then(|f| f.license.clone());266 let license = facts.as_ref().and_then(|f| f.license.clone());
229 let langs = facts.map(|f| f.languages).unwrap_or_default();267 let langs = facts.map(|f| f.languages).unwrap_or_default();
268+ // The CI rows' clock: the server's time and the duration words the page's ticker rewrites with.
269+ let now = now_unix();
270+ let (fm, fs) = duration_templates(lang);
230 Ok(view! {271 Ok(view! {
231 <section class="side-sec">272 <section class="side-sec">
232 <h2>(s(lang, "About", "Hakkında"))</h2>273 <h2>(s(lang, "About", "Hakkında"))</h2>
@@ -258,30 +299,28 @@ pub async fn repo_side(
258 </dl>299 </dl>
259 </section>300 </section>
260 if !runs.is_empty() {301 if !runs.is_empty() {
261- <section class="side-sec">302+ <section class="side-sec" data-now=(now.to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())>
262 <div class="side-h">303 <div class="side-h">
263 <h2>"CI"</h2>304 <h2>"CI"</h2>
264 <a class="small" href=(ci_href.as_str())>(s(lang, "All runs", "Tüm çalıştırmalar"))</a>305 <a class="small" href=(ci_href.as_str())>(s(lang, "All runs", "Tüm çalıştırmalar"))</a>
265 </div>306 </div>
266 <ul class="side-rows">307 <ul class="side-rows">
267 for run in runs.iter() {308 for run in runs.iter() {
268- <li class="side-row">309+ <li class="side-run">
269- <div class="side-row-main">310+ <a class="side-run-link" href=(run.href.as_str()) title=(run.title.as_str())>
270- <div class="side-row-title">
271 <span class=(run.dot)></span>311 <span class=(run.dot)></span>
272- <a class="side-row-name" href=(run.href.as_str())>(format!("#{}", run.number))</a>312+ <span class="side-run-name">(format!("#{}", run.number))</span>
273- </div>313+ if let Some((value, max)) = run.bar.as_ref() {
274- <div class="side-row-meta muted">(run.meta.as_str())</div>314+ <progress class="side-run-bar" value=(value.as_str()) max=(max.as_str())></progress>
275- </div>
276- if run.count.is_empty() {
277- <span class="side-pips" title=(run.title.as_str())>
278- for pip in run.pips.iter() {
279- <i class=(*pip)></i>
280 }315 }
281- </span>316+ <span class="side-run-text muted">
317+ if let Some(since) = run.since.as_deref() {
318+ <span data-since=(since) data-pre=(run.pre.as_deref())>(run.label.as_str())</span>
282 } else {319 } else {
283- <span class="side-count muted" title=(run.title.as_str())>(run.count.as_str())</span>320+ (run.label.as_str())
284 }321 }
322+ </span>
323+ </a>
285 </li>324 </li>
286 }325 }
287 </ul>326 </ul>
crates/forge-web/src/views/mod.rsmodified+127 -46
@@ -12,7 +12,7 @@ use std::sync::OnceLock;
12 use forge_core::ci::RunState;12 use forge_core::ci::RunState;
13 use forge_core::store::RepoSort;13 use forge_core::store::RepoSort;
14 use forge_core::store::repo_listing::RepoScope;14 use forge_core::store::repo_listing::RepoScope;
15-use forge_core::store::shell_activity::{ActorRuns, InboxKinds};15+use forge_core::store::shell_activity::{ActorRun, ActorRuns, InboxKinds};
16 use forge_core::{Error as CoreError, Session, User};16 use forge_core::{Error as CoreError, Session, User};
17 use hex::encode;17 use hex::encode;
18 use http::header::{18 use http::header::{
@@ -208,44 +208,82 @@ struct PathCrumb {
208 class: &'static str,208 class: &'static str,
209 }209 }
210 210
211-/// One pill of the live strip: a CI run of the viewer.211+/// One run on the live strip: its pill when it is the only run, and its row in the dropdown otherwise.
212-struct LivePill {212+struct StripRun {
213- class: &'static str,213+ pill_class: String,
214+ row_class: String,
214 label: String,215 label: String,
215- /// The current job's name (with a leading space) or the outcome word; empty when there is none.216+ /// The current job's name or the outcome word, with a leading space; empty when there is none.
216 text: String,217 text: String,
217 href: String,218 href: String,
218 }219 }
219 220
220-/// The live strip's pills, at most two, and how many runs are left over. Running runs come first,221+/// The live strip: every run of the viewer, running ones first, and the pill it shows. With one run
221-/// then the finished ones that passed or failed.222+/// that run's pill; with two or more a summary pill that opens the list of all of them.
222-fn live_pills(lang: Lang, runs: &ActorRuns) -> (Vec<LivePill>, usize) {223+struct LiveStrip {
223- let mut pills = Vec::new();224+ runs: Vec<StripRun>,
225+ summary_class: &'static str,
226+ summary: String,
227+}
228+
229+/// The live strip for the viewer's runs. A finished run that did not pass, fail or get cancelled is
230+/// left out.
231+fn live_strip(lang: Lang, runs: &ActorRuns) -> LiveStrip {
232+ let mut rows = Vec::new();
224 for run in &runs.running {233 for run in &runs.running {
225 let job = run.current_job.as_deref().unwrap_or("");234 let job = run.current_job.as_deref().unwrap_or("");
226- pills.push(LivePill {235+ rows.push(strip_run("hot", run, if job.is_empty() { String::new() } else { format!(" {job}") }));
227- class: "pill hot",
228- label: format!("{} #{}", run.repo, run.number),
229- text: if job.is_empty() { String::new() } else { format!(" {job}") },
230- href: repo_href(&run.owner, &run.repo, "ci", &format!("runs/{}", run.number)),
231- });
232 }236 }
233 for run in &runs.finished {237 for run in &runs.finished {
234- let (class, word) = match run.state {238+ let (state, word) = match run.state {
235- RunState::Success => ("pill ok", mi::t(lang, MK::Passed)),239+ RunState::Success => ("ok", mi::t(lang, MK::Passed)),
236- RunState::Failure | RunState::Error => ("pill bad", mi::t(lang, MK::Failed)),240+ RunState::Failure | RunState::Error => ("bad", mi::t(lang, MK::Failed)),
241+ RunState::Cancelled => ("off", mi::t(lang, MK::Cancelled)),
237 _ => continue,242 _ => continue,
238 };243 };
239- pills.push(LivePill {244+ rows.push(strip_run(state, run, format!(" {word}")));
240- class,245+ }
246+ let count = |pred: fn(RunState) -> bool| runs.finished.iter().filter(|run| pred(run.state)).count() as u64;
247+ let running = runs.running.len() as u64;
248+ let failed = count(|state| matches!(state, RunState::Failure | RunState::Error));
249+ let passed = count(|state| matches!(state, RunState::Success));
250+ let cancelled = count(|state| matches!(state, RunState::Cancelled));
251+ let summary_class = if running > 0 {
252+ "pill hot"
253+ } else if failed > 0 {
254+ "pill bad"
255+ } else if passed > 0 {
256+ "pill ok"
257+ } else {
258+ "pill off"
259+ };
260+ let parts = [
261+ (running, mi::running_count as fn(Lang, u64) -> String),
262+ (failed, mi::failed_count),
263+ (passed, mi::passed_count),
264+ (cancelled, mi::cancelled_count),
265+ ];
266+ let summary = parts
267+ .iter()
268+ .filter(|(n, _)| *n > 0)
269+ .map(|(n, phrase)| phrase(lang, *n))
270+ .collect::<Vec<_>>()
271+ .join(" · ");
272+ LiveStrip {
273+ runs: rows,
274+ summary_class,
275+ summary,
276+ }
277+}
278+
279+fn strip_run(state: &str, run: &ActorRun, text: String) -> StripRun {
280+ StripRun {
281+ pill_class: format!("pill {state}"),
282+ row_class: format!("strip-row {state}"),
241 label: format!("{} #{}", run.repo, run.number),283 label: format!("{} #{}", run.repo, run.number),
242- text: format!(" {word}"),284+ text,
243 href: repo_href(&run.owner, &run.repo, "ci", &format!("runs/{}", run.number)),285 href: repo_href(&run.owner, &run.repo, "ci", &format!("runs/{}", run.number)),
244- });
245 }286 }
246- let more = pills.len().saturating_sub(2);
247- pills.truncate(2);
248- (pills, more)
249 }287 }
250 288
251 /// A count's phrase with its number replaced by `{n}`, for nav.js to fill in again.289 /// A count's phrase with its number replaced by `{n}`, for nav.js to fill in again.
@@ -253,11 +291,6 @@ fn count_template(phrase: &str, n: u64) -> String {
253 phrase.replacen(&n.to_string(), "{n}", 1)291 phrase.replacen(&n.to_string(), "{n}", 1)
254 }292 }
255 293
256-/// The heat ring's fill: the share of a run's jobs that are done, at least 8%.
257-fn heat_percent(done: u64, total: u64) -> u64 {
258- (done * 100).checked_div(total).map_or(8, |p| p.clamp(8, 100))
259-}
260-
261 /// The viewer's runs when there is no viewer or no app context: none.294 /// The viewer's runs when there is no viewer or no app context: none.
262 fn no_runs() -> ActorRuns {295 fn no_runs() -> ActorRuns {
263 ActorRuns {296 ActorRuns {
@@ -278,8 +311,8 @@ struct WaitingRow {
278 dot_class: &'static str,311 dot_class: &'static str,
279 }312 }
280 313
281-/// What the profile corner shows: the viewer, their inbox counts, the newest running run's heat314+/// What the profile corner shows: the viewer, their inbox counts, whether any of their runs is
282-/// (`None` when nothing runs) and the items waiting on them.315+/// going (the ring glows) and the items waiting on them.
283 #[derive(Clone)]316 #[derive(Clone)]
284 struct ProfileCorner {317 struct ProfileCorner {
285 username: String,318 username: String,
@@ -291,7 +324,7 @@ struct ProfileCorner {
291 reviews: u64,324 reviews: u64,
292 mentions: u64,325 mentions: u64,
293 failing: u64,326 failing: u64,
294- heat: Option<u64>,327+ hot: bool,
295 waiting: Vec<WaitingRow>,328 waiting: Vec<WaitingRow>,
296 }329 }
297 330
@@ -300,9 +333,7 @@ struct ProfileCorner {
300 /// and the profile, settings, admin and log out links.333 /// and the profile, settings, admin and log out links.
301 #[component]334 #[component]
302 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {335 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {
303- let ring_class = if corner.heat.is_some() { "heat-ring hot" } else { "heat-ring" };336+ let ring_class = if corner.hot { "heat-ring hot" } else { "heat-ring" };
304- // The fill in steps of 5 (the stylesheet maps each step to --p): the CSP refuses style attributes.
305- let ring_step = (corner.heat.unwrap_or(0).min(100) + 2) / 5 * 5;
306 let review_chip = (corner.reviews > 0).then(|| {337 let review_chip = (corner.reviews > 0).then(|| {
307 (corner.reviews.to_string(), mi::review_requests_count(lang, corner.reviews))338 (corner.reviews.to_string(), mi::review_requests_count(lang, corner.reviews))
308 });339 });
@@ -336,7 +367,7 @@ async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View>
336 Ok(view! {367 Ok(view! {
337 <details class="corner" data-unread-stream="">368 <details class="corner" data-unread-stream="">
338 <summary class="corner-btn" aria-label=(corner.username.as_str())>369 <summary class="corner-btn" aria-label=(corner.username.as_str())>
339- <span class=(ring_class) data-p=(ring_step.to_string())><img class="avatar avatar-sm" src=(corner.avatar.as_str()) alt="" width="28" height="28"></span>370+ <span class=(ring_class)><img class="avatar avatar-sm" src=(corner.avatar.as_str()) alt="" width="28" height="28"></span>
340 <span class="corner-name">(corner.username.as_str())</span>371 <span class="corner-name">(corner.username.as_str())</span>
341 <span class="corner-chips" data-review=(review_template.as_str()) data-review-one=(review_one.as_str()) data-mention=(mention_template.as_str()) data-mention-one=(mention_one.as_str()) data-failing=(failing_template.as_str()) data-failing-one=(failing_one.as_str())>372 <span class="corner-chips" data-review=(review_template.as_str()) data-review-one=(review_one.as_str()) data-mention=(mention_template.as_str()) data-mention-one=(mention_one.as_str()) data-failing=(failing_template.as_str()) data-failing-one=(failing_one.as_str())>
342 if let Some((count, title)) = review_chip {373 if let Some((count, title)) = review_chip {
@@ -569,12 +600,17 @@ pub async fn shell(
569 href,600 href,
570 })601 })
571 .collect();602 .collect();
572- let (pills, more) = live_pills(lang, &runs);603+ let strip = live_strip(lang, &runs);
573- let more_label = format!("+{more}");604+ // The strip's count phrases, as templates for nav.js: `{n}` stands for the count.
605+ let running_tpl = count_template(&mi::running_count(lang, 2), 2);
606+ let failed_tpl = count_template(&mi::failed_count(lang, 2), 2);
607+ let passed_tpl = count_template(&mi::passed_count(lang, 2), 2);
608+ let cancelled_tpl = count_template(&mi::cancelled_count(lang, 2), 2);
609+ let runs_label = mi::t(lang, MK::YourCiRuns);
574 let search_for_label = mi::t(lang, MK::SearchPublicReposFor);610 let search_for_label = mi::t(lang, MK::SearchPublicReposFor);
575 // The profile corner, the signed-in sidebar's account menu. The sidebar and the phone menu611 // The profile corner, the signed-in sidebar's account menu. The sidebar and the phone menu
576 // each get their own copy.612 // each get their own copy.
577- let heat = runs.running.first().map(|run| heat_percent(run.jobs_done, run.jobs_total));613+ let hot = !runs.running.is_empty();
578 let waiting_rows: Vec<WaitingRow> = waiting614 let waiting_rows: Vec<WaitingRow> = waiting
579 .iter()615 .iter()
580 .map(|item| WaitingRow {616 .map(|item| WaitingRow {
@@ -603,7 +639,7 @@ pub async fn shell(
603 reviews: inbox.reviews,639 reviews: inbox.reviews,
604 mentions: inbox.mentions,640 mentions: inbox.mentions,
605 failing: runs.failing,641 failing: runs.failing,
606- heat,642+ hot,
607 waiting: waiting_rows,643 waiting: waiting_rows,
608 });644 });
609 let corner_panel = corner.clone();645 let corner_panel = corner.clone();
@@ -678,12 +714,23 @@ pub async fn shell(
678 }714 }
679 </nav>715 </nav>
680 if signed_in {716 if signed_in {
681- <div class="live-strip" data-activity="/-/activity" data-passed=(mi::t(lang, MK::Passed)) data-failed=(mi::t(lang, MK::Failed)) aria-live="polite">717+ <div class="live-strip" data-activity="/-/activity" data-passed=(mi::t(lang, MK::Passed)) data-failed=(mi::t(lang, MK::Failed)) data-cancelled=(mi::t(lang, MK::Cancelled))
682- for pill in pills.iter() {718+ data-count-running=(running_tpl.as_str()) data-count-failed=(failed_tpl.as_str()) data-count-passed=(passed_tpl.as_str()) data-count-cancelled=(cancelled_tpl.as_str())
683- <a class=(pill.class) href=(pill.href.as_str())><span class="pill-dot"></span><b>(pill.label.as_str())</b>(pill.text.as_str())</a>719+ data-runs-label=(runs_label) aria-live="polite">
720+ if strip.runs.len() == 1 {
721+ for run in strip.runs.iter() {
722+ <a class=(run.pill_class.as_str()) href=(run.href.as_str())><span class="pill-dot"></span><b>(run.label.as_str())</b>(run.text.as_str())</a>
723+ }
724+ }
725+ if strip.runs.len() > 1 {
726+ <details class="strip-runs" id="strip-runs">
727+ <summary class=(strip.summary_class) aria-label=(runs_label)><span class="pill-dot"></span>(strip.summary.as_str())</summary>
728+ <ul class="strip-list">
729+ for run in strip.runs.iter() {
730+ <li><a class=(run.row_class.as_str()) href=(run.href.as_str())><span class="pill-dot"></span><b>(run.label.as_str())</b>(run.text.as_str())</a></li>
684 }731 }
685- if more > 0 {732+ </ul>
686- <span class="pill more">(more_label.as_str())</span>733+ </details>
687 }734 }
688 </div>735 </div>
689 } else {736 } else {
@@ -1699,6 +1746,40 @@ mod tests {
1699 assert_eq!(enc("a~b.c_d-e"), "a~b.c_d-e");1746 assert_eq!(enc("a~b.c_d-e"), "a~b.c_d-e");
1700 }1747 }
1701 1748
1749+ #[test]
1750+ fn live_strip_is_one_pill_for_one_run_and_a_summary_for_more() {
1751+ let run = |state, number| ActorRun {
1752+ owner: "tahinli".into(),
1753+ repo: "proj".into(),
1754+ number,
1755+ git_ref: "main".into(),
1756+ state,
1757+ created_at: String::new(),
1758+ finished_at: None,
1759+ jobs_total: 0,
1760+ jobs_done: 0,
1761+ current_job: None,
1762+ };
1763+ let many = ActorRuns {
1764+ running: vec![run(RunState::Running, 3)],
1765+ finished: vec![run(RunState::Failure, 2), run(RunState::Cancelled, 1)],
1766+ failing: 0,
1767+ };
1768+ let strip = live_strip(Lang::En, &many);
1769+ assert_eq!(strip.runs.len(), 3);
1770+ assert_eq!(strip.summary, "1 running · 1 failed · 1 cancelled");
1771+ assert_eq!(strip.summary_class, "pill hot");
1772+ let alone = ActorRuns {
1773+ running: Vec::new(),
1774+ finished: vec![run(RunState::Cancelled, 1)],
1775+ failing: 0,
1776+ };
1777+ let one = live_strip(Lang::En, &alone);
1778+ assert_eq!(one.runs.len(), 1);
1779+ assert_eq!(one.runs[0].pill_class, "pill off");
1780+ assert_eq!(one.runs[0].text, " cancelled");
1781+ }
1782+
1702 #[test]1783 #[test]
1703 fn repo_href_builds_each_form() {1784 fn repo_href_builds_each_form() {
1704 assert_eq!(repo_href("tahinli", "demo", "", ""), "/tahinli/demo");1785 assert_eq!(repo_href("tahinli", "demo", "", ""), "/tahinli/demo");
style/_repo_side.scssmodified+68 -25
@@ -102,45 +102,88 @@
102 white-space: nowrap;102 white-space: nowrap;
103 }103 }
104 104
105-// One pip per job, as on the runners list: filled when it passed, red when it failed, the accent105+// One row per CI run, the whole row a link: an ember dot that glows while the run goes, the number,
106-// while it runs, a hollow pip while it waits.106+// a slim heat bar of the jobs done (while it goes), and one muted line on the right: the current
107-.side-pips {107+// job and its clock, or the result and the total time.
108- display: inline-flex;108+.side-run + .side-run {
109- gap: 3px;109+ border-top: 1px solid var(--border);
110 }110 }
111 111
112-.side-pip {112+.side-run-link {
113- box-sizing: border-box;113+ display: flex;
114- width: 12px;114+ align-items: center;
115- height: 6px;115+ gap: 8px;
116- border-radius: 2px;116+ min-width: 0;
117- background: var(--surface-2);117+ padding: 11px 0;
118- box-shadow: inset 0 0 0 1px var(--border);118+ color: inherit;
119+ text-decoration: none;
119 120
120- &.is-ok {121+ &:hover .side-run-name {
121- background: var(--ok);122+ text-decoration: underline;
122- box-shadow: none;
123 }123 }
124+}
125+
126+.health-dot.ember {
127+ background: var(--heat-3);
128+ box-shadow: 0 0 6px var(--heat-glow);
129+ animation: ember-pulse 1.8s ease-in-out infinite;
124 130
125- &.is-bad {131+ @media (prefers-reduced-motion: reduce) {
126- background: var(--bad);132+ animation: none;
127- box-shadow: none;133+ }
128 }134 }
129 135
130- &.is-on {136+@keyframes ember-pulse {
131- background: var(--accent);137+ 50% {
132- box-shadow: none;138+ box-shadow: 0 0 10px var(--heat-glow);
139+ }
140+}
141+
142+.side-run-name {
143+ flex: none;
144+ color: var(--text);
145+ font-size: 14px;
146+ font-weight: 600;
147+ font-variant-numeric: tabular-nums;
148+}
149+
150+progress.side-run-bar {
151+ -webkit-appearance: none;
152+ appearance: none;
153+ flex: 1 1 auto;
154+ box-sizing: border-box;
155+ min-width: 24px;
156+ height: 4px;
157+ margin: 0;
158+ border: 0;
159+ border-radius: 2px;
160+ overflow: hidden;
161+ background: var(--border);
162+ color: var(--heat-3);
163+
164+ &::-webkit-progress-bar {
165+ background: var(--border);
133 }166 }
134 167
135- &.is-off {168+ &::-webkit-progress-value {
136- background: var(--border-strong);169+ border-radius: 2px;
137- box-shadow: none;170+ background: linear-gradient(90deg, var(--heat-2), var(--heat-3), var(--heat-4));
171+ }
172+
173+ &::-moz-progress-bar {
174+ border-radius: 2px;
175+ background: linear-gradient(90deg, var(--heat-2), var(--heat-3), var(--heat-4));
138 }176 }
139 }177 }
140 178
141-.side-count {179+.side-run-text {
180+ min-width: 0;
181+ margin-left: auto;
182+ overflow: hidden;
142 font-size: 12px;183 font-size: 12px;
143 font-variant-numeric: tabular-nums;184 font-variant-numeric: tabular-nums;
185+ text-overflow: ellipsis;
186+ white-space: nowrap;
144 }187 }
145 188
146 // Languages: the name and what it is made of, a thin meter in the accent, the share on the right.189 // Languages: the name and what it is made of, a thin meter in the accent, the share on the right.
style/_shell.scssmodified+82 -21
@@ -333,9 +333,83 @@
333 }333 }
334 }334 }
335 335
336-.pill.more {336+// Two or more runs: the summary pill opens a list of all of them, right-aligned under it.
337- color: var(--muted);337+.strip-runs {
338- border-style: dashed;338+ position: relative;
339+
340+ > summary {
341+ list-style: none;
342+ cursor: pointer;
343+
344+ &::-webkit-details-marker {
345+ display: none;
346+ }
347+ }
348+}
349+
350+.strip-list {
351+ position: absolute;
352+ top: calc(100% + 6px);
353+ right: 0;
354+ z-index: 60;
355+ display: grid;
356+ gap: 2px;
357+ box-sizing: border-box;
358+ width: max-content;
359+ min-width: 240px;
360+ max-width: min(420px, 92vw);
361+ max-height: min(60vh, 420px);
362+ overflow-y: auto;
363+ margin: 0;
364+ padding: 6px;
365+ list-style: none;
366+ background: var(--surface);
367+ border: 1px solid var(--border);
368+ border-radius: var(--radius-md);
369+ box-shadow: var(--shadow);
370+
371+ li {
372+ min-width: 0;
373+ }
374+}
375+
376+.strip-row {
377+ display: flex;
378+ align-items: center;
379+ gap: 8px;
380+ min-width: 0;
381+ padding: 6px 8px;
382+ border-radius: var(--radius-md);
383+ color: var(--text-2);
384+ font-size: 12.5px;
385+ white-space: nowrap;
386+ text-decoration: none;
387+
388+ b {
389+ min-width: 0;
390+ overflow: hidden;
391+ font-weight: 600;
392+ color: var(--text);
393+ text-overflow: ellipsis;
394+ }
395+
396+ &:hover {
397+ background: var(--surface-2);
398+ text-decoration: none;
399+ }
400+
401+ &.ok .pill-dot {
402+ background: var(--ok);
403+ }
404+
405+ &.bad .pill-dot {
406+ background: var(--danger);
407+ }
408+
409+ &.hot .pill-dot {
410+ background: var(--heat-4);
411+ animation: pill-pulse 1.6s ease-out infinite;
412+ }
339 }413 }
340 414
341 @keyframes pill-pulse {415 @keyframes pill-pulse {
@@ -583,7 +657,8 @@
583 white-space: nowrap;657 white-space: nowrap;
584 }658 }
585 659
586-// The avatar inside a ring: the ring fills with the running run's progress (--p), and glows while hot.660+// The avatar inside a ring: a plain border ring when nothing runs, a full ember ring while a run
661+// of the viewer's is queued or running (.hot), glowing softly.
587 .heat-ring {662 .heat-ring {
588 display: grid;663 display: grid;
589 flex: none;664 flex: none;
@@ -591,18 +666,10 @@
591 width: 34px;666 width: 34px;
592 height: 34px;667 height: 34px;
593 border-radius: 50%;668 border-radius: 50%;
594- background: conic-gradient(
595- var(--heat-2) 0%,
596- var(--heat-3) calc(var(--p, 8%) * 0.6),
597- var(--heat-4) var(--p, 8%),
598- var(--border) var(--p, 8%)
599- );
600-
601- &:not(.hot) {
602 background: var(--border);669 background: var(--border);
603- }
604 670
605 &.hot {671 &.hot {
672+ background: conic-gradient(var(--heat-2), var(--heat-3), var(--heat-4), var(--heat-2));
606 filter: drop-shadow(0 0 5px var(--heat-glow));673 filter: drop-shadow(0 0 5px var(--heat-glow));
607 }674 }
608 675
@@ -615,13 +682,6 @@
615 }682 }
616 }683 }
617 684
618-// The fill arrives as data-p in steps of 5: the CSP refuses style attributes.
619-@for $i from 0 through 20 {
620- .heat-ring[data-p="#{$i * 5}"] {
621- --p: #{$i * 5}%;
622- }
623-}
624-
625 .corner-chips {685 .corner-chips {
626 display: flex;686 display: flex;
627 align-items: center;687 align-items: center;
@@ -1074,7 +1134,8 @@ html[aria-busy="true"] body::before {
1074 opacity: 0.45;1134 opacity: 0.45;
1075 }1135 }
1076 1136
1077- .pill.hot .pill-dot {1137+ .pill.hot .pill-dot,
1138+ .strip-row.hot .pill-dot {
1078 animation: none;1139 animation: none;
1079 }1140 }
1080 }1141 }
style/main.scssmodified+19 -0
@@ -6184,6 +6184,25 @@ html.js form.runner-load[data-dirty-form][data-dirty] .runner-save {
6184 white-space: nowrap;6184 white-space: nowrap;
6185 }6185 }
6186 6186
6187+// A running job being stopped: a small label tinted toward the heat colour, in its own grid track
6188+// (the row then has one more track, so the chevron keeps its place).
6189+.ci-job-line:has(.ci-job-stopping) {
6190+ grid-template-columns: 8px minmax(0, 1fr) auto auto auto 12px;
6191+}
6192+
6193+.ci-job-stopping {
6194+ font-size: 0.75rem;
6195+ color: color-mix(in srgb, var(--heat-3) 60%, var(--muted));
6196+ white-space: nowrap;
6197+}
6198+
6199+// Cancel's stand-in while the run is being stopped: disabled, so it reads as taken.
6200+button.ci-stopping {
6201+ cursor: not-allowed;
6202+ color: var(--muted);
6203+ opacity: 0.65;
6204+}
6205+
6187 .ci-chev {6206 .ci-chev {
6188 justify-self: end;6207 justify-self: end;
6189 width: 6px;6208 width: 6px;