forge
Explore
Log in

Don't you dare go Hollow

Per-job live last line and expandable log tail on CI run page

Browse files at this commit

48664c553a3d10ddb0647ff3c1210b2fcaedf712Ahmet Kaan GümüşParent: 8609bad
  • ui
    • per-job live last line and expandable log tail on CI run page
Show full message
💄 ui: per-job live last line and expandable log tail on CI run page
crates/forge-web/assets/nav.jsmodified+76 -2
@@ -128,7 +128,7 @@
128 });128 });
129 }129 }
130 130
131- function adopt(doc, keepFields, dd) {131+ function adopt(doc, keepFields, dd, jobs) {
132 document.title = doc.title;132 document.title = doc.title;
133 ['lang', 'data-theme', 'data-accent-light', 'data-accent-dark', 'data-base-light', 'data-base-dark', 'data-sidebar', 'data-ui'].forEach(function (name) {133 ['lang', 'data-theme', 'data-accent-light', 'data-accent-dark', 'data-base-light', 'data-base-dark', 'data-sidebar', 'data-ui'].forEach(function (name) {
134 if (doc.documentElement.hasAttribute(name)) { root.setAttribute(name, doc.documentElement.getAttribute(name)); }134 if (doc.documentElement.hasAttribute(name)) { root.setAttribute(name, doc.documentElement.getAttribute(name)); }
@@ -151,6 +151,7 @@
151 if (kept) { restoreFields(kept); }151 if (kept) { restoreFields(kept); }
152 if (dd) { focusDropdown(dd); }152 if (dd) { focusDropdown(dd); }
153 followTail();153 followTail();
154+ restoreJobs(jobs);
154 syncUnread();155 syncUnread();
155 syncLive();156 syncLive();
156 syncTick();157 syncTick();
@@ -162,6 +163,79 @@
162 if (pre) { pre.scrollTop = pre.scrollHeight; }163 if (pre) { pre.scrollTop = pre.scrollHeight; }
163 }164 }
164 165
166+ // The run page's job rows each have a last-line preview and a tail that opens under the row
167+ // (li[data-job-row], data-open). A row the reader toggled is marked data-touched. A live swap brings
168+ // the server's defaults, so the touched rows and the scroll of every tail are put back after it.
169+ function jobTails() { return document.querySelectorAll('[data-job-row]'); }
170+
171+ function setJobRow(li, open, touch) {
172+ var tail = li.querySelector('[data-job-tail]');
173+ if (!tail) { return; }
174+ li.setAttribute('data-open', open ? 'true' : 'false');
175+ if (touch) { li.setAttribute('data-touched', 'true'); }
176+ tail.hidden = !open;
177+ var btn = li.querySelector('[data-job-toggle]');
178+ if (btn) { btn.setAttribute('aria-expanded', open ? 'true' : 'false'); }
179+ if (open) {
180+ var pre = tail.querySelector('pre');
181+ if (pre) { pre.scrollTop = pre.scrollHeight; }
182+ }
183+ }
184+
185+ function syncJobAll() {
186+ var all = document.querySelector('[data-job-all]');
187+ if (!all) { return; }
188+ var closed = false;
189+ jobTails().forEach(function (li) {
190+ if (li.querySelector('[data-job-tail]') && li.getAttribute('data-open') !== 'true') { closed = true; }
191+ });
192+ all.textContent = all.getAttribute(closed ? 'data-expand' : 'data-collapse');
193+ }
194+
195+ // Taken before a live swap: the rows the reader touched and where each open tail was scrolled.
196+ function captureJobs() {
197+ var out = {};
198+ jobTails().forEach(function (li) {
199+ var pre = li.querySelector('[data-job-tail] pre');
200+ var open = li.getAttribute('data-open') === 'true';
201+ out[li.getAttribute('data-job-row')] = {
202+ touched: li.hasAttribute('data-touched'),
203+ open: open,
204+ top: pre && open ? pre.scrollTop : 0,
205+ end: pre && open ? pre.scrollTop + pre.clientHeight >= pre.scrollHeight - 24 : true
206+ };
207+ });
208+ return out;
209+ }
210+
211+ // Every open tail starts at its end; a captured one goes back to where the reader had it.
212+ function restoreJobs(kept) {
213+ jobTails().forEach(function (li) {
214+ var c = kept ? kept[li.getAttribute('data-job-row')] : null;
215+ if (c && c.touched) { setJobRow(li, c.open, true); }
216+ var pre = li.querySelector('[data-job-tail] pre');
217+ if (!pre || li.getAttribute('data-open') !== 'true') { return; }
218+ pre.scrollTop = c && !c.end ? c.top : pre.scrollHeight;
219+ });
220+ syncJobAll();
221+ }
222+
223+ document.addEventListener('click', function (e) {
224+ var el = e.target && e.target.closest ? e.target : null;
225+ if (!el) { return; }
226+ var all = el.closest('[data-job-all]');
227+ if (all) {
228+ var open = all.textContent === all.getAttribute('data-expand');
229+ jobTails().forEach(function (li) { setJobRow(li, open, true); });
230+ syncJobAll();
231+ return;
232+ }
233+ var btn = el.closest('[data-job-toggle]');
234+ if (!btn) { return; }
235+ var li = btn.closest('[data-job-row]');
236+ if (li) { setJobRow(li, li.getAttribute('data-open') !== 'true', true); syncJobAll(); }
237+ }, false);
238+
165 function focusMain() {239 function focusMain() {
166 var main = document.querySelector('main');240 var main = document.querySelector('main');
167 if (main && main.focus) { main.focus({ preventScroll: true }); }241 if (main && main.focus) { main.focus({ preventScroll: true }); }
@@ -192,7 +266,7 @@
192 // A live change must not shut a menu the reader has open (a run's branch picker, say).266 // A live change must not shut a menu the reader has open (a run's branch picker, say).
193 var dd = how === 'live' ? captureDropdowns() : null;267 var dd = how === 'live' ? captureDropdowns() : null;
194 if (how !== 'live') { closeDropdowns(null); }268 if (how !== 'live') { closeDropdowns(null); }
195- adopt(doc, keepFields, dd);269+ adopt(doc, keepFields, dd, how === 'live' ? captureJobs() : null);
196 if (tailAt) {270 if (tailAt) {
197 var nextTail = document.querySelector('[data-live-log]');271 var nextTail = document.querySelector('[data-live-log]');
198 if (nextTail) { nextTail.scrollTop = tailAt.end ? nextTail.scrollHeight : tailAt.top; }272 if (nextTail) { nextTail.scrollTop = tailAt.end ? nextTail.scrollHeight : tailAt.top; }
crates/forge-web/src/i18n/releases_ci.rsmodified+8 -4
@@ -45,7 +45,8 @@ pub enum K {
45 Artifacts,45 Artifacts,
46 Timeline,46 Timeline,
47 Waiting,47 Waiting,
48- LastLogLines,48+ ExpandAll,
49+ CollapseAll,
49 50
50 // CI status badge, on the run list.51 // CI status badge, on the run list.
51 BadgeHeading,52 BadgeHeading,
@@ -207,8 +208,10 @@ pub fn t(lang: Lang, key: K) -> &'static str {
207 (Timeline, Tr) => "Zaman çizelgesi",208 (Timeline, Tr) => "Zaman çizelgesi",
208 (Waiting, En) => "waiting",209 (Waiting, En) => "waiting",
209 (Waiting, Tr) => "bekliyor",210 (Waiting, Tr) => "bekliyor",
210- (LastLogLines, En) => "last log lines",211+ (ExpandAll, En) => "Expand all",
211- (LastLogLines, Tr) => "son günlük satırları",212+ (ExpandAll, Tr) => "Tümünü aç",
213+ (CollapseAll, En) => "Collapse all",
214+ (CollapseAll, Tr) => "Tümünü kapat",
212 (BadgeHeading, En) => "Status badge",215 (BadgeHeading, En) => "Status badge",
213 (BadgeHeading, Tr) => "Durum rozeti",216 (BadgeHeading, Tr) => "Durum rozeti",
214 (BadgeHelp, En) => {217 (BadgeHelp, En) => {
@@ -507,7 +510,8 @@ mod tests {
507 K::Artifacts,510 K::Artifacts,
508 K::Timeline,511 K::Timeline,
509 K::Waiting,512 K::Waiting,
510- K::LastLogLines,513+ K::ExpandAll,
514+ K::CollapseAll,
511 K::BadgeHeading,515 K::BadgeHeading,
512 K::BadgeHelp,516 K::BadgeHelp,
513 K::BadgeSnippet,517 K::BadgeSnippet,
crates/forge-web/src/pages/ci_runs.rsmodified+114 -40
@@ -345,12 +345,14 @@ struct JobLine {
345 duration: String,345 duration: String,
346 /// Unix seconds a running job's duration counts from.346 /// Unix seconds a running job's duration counts from.
347 since: Option<String>,347 since: Option<String>,
348-}348+ /// The job id: what the page script keys the row on.
349-349+ id: String,
350-/// The last lines of the log of the job the run page points at.350+ /// The last non-empty log line, or the queued reason of a job with no output yet.
351-struct LogBlock {351+ preview: String,
352- caption: String,352+ /// The last lines of the log, at most `LOG_LINES`. Empty when the job has no output.
353- text: String,353+ tail: String,
354+ /// Whether the row starts with its tail open.
355+ expanded: bool,
354 }356 }
355 357
356 /// The right column: the selected run, its timeline, its jobs and the log tail.358 /// The right column: the selected run, its timeline, its jobs and the log tail.
@@ -375,7 +377,6 @@ struct RunDetail {
375 writer_csrf: Option<String>,377 writer_csrf: Option<String>,
376 gantt: Option<Gantt>,378 gantt: Option<Gantt>,
377 jobs: Vec<JobLine>,379 jobs: Vec<JobLine>,
378- log: Option<LogBlock>,
379 }380 }
380 381
381 /// A box in an SVG, with its class and its position and size in the SVG's units.382 /// A box in an SVG, with its class and its position and size in the SVG's units.
@@ -585,9 +586,9 @@ const AXIS_STEPS: [i64; 14] = [
585 60, 120, 300, 600, 900, 1200, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 172800,586 60, 120, 300, 600, 900, 1200, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 172800,
586 ];587 ];
587 /// How far back from the end of a log the run page reads for its last lines.588 /// How far back from the end of a log the run page reads for its last lines.
588-const LOG_TAIL_BYTES: u64 = 8 * 1024;589+const LOG_TAIL_BYTES: u64 = 16 * 1024;
589-/// Lines of a log the run page shows.590+/// Lines of a log an expanded job row shows.
590-const LOG_LINES: usize = 3;591+const LOG_LINES: usize = 20;
591 592
592 /// Where an offset of `offset` seconds falls on a span of `span` seconds drawn `width` units wide.593 /// Where an offset of `offset` seconds falls on a span of `span` seconds drawn `width` units wide.
593 /// The offset is clamped to the span, so nothing is drawn past its end.594 /// The offset is clamped to the span, so nothing is drawn past its end.
@@ -1076,7 +1077,48 @@ fn row_meta(run: &CiRun, jobs: &[Timing], actor: &str, lang: Lang) -> String {
1076 meta1077 meta
1077 }1078 }
1078 1079
1079-/// The last lines of a log, read from its tail only. A log that cannot be read has none.1080+/// Drops the ANSI escape sequences and the other control characters (a tab stays) of a log line.
1081+fn strip_ansi(line: &str) -> String {
1082+ let mut out = String::with_capacity(line.len());
1083+ let mut chars = line.chars().peekable();
1084+ while let Some(c) = chars.next() {
1085+ if c == '\u{1b}' {
1086+ match chars.next() {
1087+ // A CSI sequence ends at a byte from `@` to `~`.
1088+ Some('[') => {
1089+ for n in chars.by_ref() {
1090+ if ('@'..='~').contains(&n) {
1091+ break;
1092+ }
1093+ }
1094+ }
1095+ // An OSC sequence ends at BEL or ESC.
1096+ Some(']') => {
1097+ for n in chars.by_ref() {
1098+ if n == '\u{7}' || n == '\u{1b}' {
1099+ break;
1100+ }
1101+ }
1102+ }
1103+ _ => {}
1104+ }
1105+ } else if c == '\t' || !c.is_control() {
1106+ out.push(c);
1107+ }
1108+ }
1109+ out
1110+}
1111+
1112+/// The last non-empty line of a tail: what a job row previews.
1113+fn last_line(tail: &[String]) -> Option<&str> {
1114+ tail.iter()
1115+ .rev()
1116+ .map(|line| line.trim())
1117+ .find(|line| !line.is_empty())
1118+}
1119+
1120+/// The last lines of a log, read from its tail only, without ANSI codes and trailing blank lines.
1121+/// A log that cannot be read has none.
1080 async fn log_last_lines(path: &Path) -> Vec<String> {1122 async fn log_last_lines(path: &Path) -> Vec<String> {
1081 let Ok(mut file) = tokio::fs::File::open(path).await else {1123 let Ok(mut file) = tokio::fs::File::open(path).await else {
1082 return Vec::new();1124 return Vec::new();
@@ -1096,11 +1138,12 @@ async fn log_last_lines(path: &Path) -> Vec<String> {
1096 if start > 0 && !lines.is_empty() {1138 if start > 0 && !lines.is_empty() {
1097 lines.remove(0);1139 lines.remove(0);
1098 }1140 }
1141+ let mut lines: Vec<String> = lines.iter().map(|line| strip_ansi(line)).collect();
1142+ while lines.last().is_some_and(|line| line.trim().is_empty()) {
1143+ lines.pop();
1144+ }
1099 let skip = lines.len().saturating_sub(LOG_LINES);1145 let skip = lines.len().saturating_sub(LOG_LINES);
1100- lines[skip..]1146+ lines.split_off(skip)
1101- .iter()
1102- .map(|line| (*line).to_owned())
1103- .collect()
1104 }1147 }
1105 1148
1106 /// Maps each user id in `ids` to a display name. A user that no longer exists shows as "deleted user".1149 /// Maps each user id in `ids` to a display name. A user that no longer exists shows as "deleted user".
@@ -1338,8 +1381,12 @@ struct RunHeader {
1338 writer_csrf: Option<String>,1381 writer_csrf: Option<String>,
1339 }1382 }
1340 1383
1341-/// The selected run: its header values, its timeline, its jobs and the last lines of the job to look at.1384+/// Whether a job row starts with its tail open: a failed job does, and so does the only job of a run.
1342-/// That is the failed job, else the running one, else the last job.1385+fn starts_expanded(state: JobState, jobs: usize) -> bool {
1386+ matches!(state, JobState::Failure | JobState::Error) || jobs == 1
1387+}
1388+
1389+/// The selected run: its header values, its timeline and its jobs, each with the last lines of its log.
1343 async fn run_detail(1390 async fn run_detail(
1344 state: &AppState,1391 state: &AppState,
1345 title: &str,1392 title: &str,
@@ -1362,7 +1409,18 @@ async fn run_detail(
1362 let size = human_size(lang, u64::try_from(artifact.size).unwrap_or(0));1409 let size = human_size(lang, u64::try_from(artifact.size).unwrap_or(0));
1363 parts.push(format!("{} {size}", artifact.name));1410 parts.push(format!("{} {size}", artifact.name));
1364 }1411 }
1412+ let tail = log_last_lines(&log_path(&state.config.data_dir, &job.id)).await;
1413+ let preview = match last_line(&tail) {
1414+ Some(line) => line.to_owned(),
1415+ None if job.state == JobState::Queued && !job.message.is_empty() => job.message.clone(),
1416+ None if job.state == JobState::Queued => state_text(lang, job.state.as_str()),
1417+ None => String::new(),
1418+ };
1365 lines.push(JobLine {1419 lines.push(JobLine {
1420+ id: job.id.clone(),
1421+ expanded: !tail.is_empty() && starts_expanded(job.state, jobs.len()),
1422+ preview,
1423+ tail: tail.join("\n"),
1366 href: job_href(title, &job.id),1424 href: job_href(title, &job.id),
1367 name: job.name.clone(),1425 name: job.name.clone(),
1368 dot: format!("ci-dot ci-{}", job.state.as_str()),1426 dot: format!("ci-dot ci-{}", job.state.as_str()),
@@ -1374,21 +1432,6 @@ async fn run_detail(
1374 .flatten(),1432 .flatten(),
1375 });1433 });
1376 }1434 }
1377- let focus = jobs
1378- .iter()
1379- .find(|job| matches!(job.state, JobState::Failure | JobState::Error))
1380- .or_else(|| jobs.iter().find(|job| job.state == JobState::Running))
1381- .or(jobs.last());
1382- let log = match focus {
1383- Some(job) => {
1384- let tail = log_last_lines(&log_path(&state.config.data_dir, &job.id)).await;
1385- (!tail.is_empty()).then(|| LogBlock {
1386- caption: format!("{} \u{b7} {}", job.name, g::t(lang, K::LastLogLines)),
1387- text: tail.join("\n"),
1388- })
1389- }
1390- None => None,
1391- };
1392 Ok(RunDetail {1435 Ok(RunDetail {
1393 number: run.number,1436 number: run.number,
1394 title: header.title,1437 title: header.title,
@@ -1415,7 +1458,6 @@ async fn run_detail(
1415 writer_csrf: header.writer_csrf,1458 writer_csrf: header.writer_csrf,
1416 gantt,1459 gantt,
1417 jobs: lines,1460 jobs: lines,
1418- log,
1419 })1461 })
1420 }1462 }
1421 1463
@@ -1600,9 +1642,14 @@ async fn runs_body(
1600 if run.jobs.is_empty() {1642 if run.jobs.is_empty() {
1601 <p class="muted">(g::t(lang, K::NoJobs))</p>1643 <p class="muted">(g::t(lang, K::NoJobs))</p>
1602 } else {1644 } else {
1645+ if run.jobs.len() > 1 {
1646+ <div class="ci-job-head">
1647+ <button type="button" class="ci-job-all" data-job-all="true" data-expand=(g::t(lang, K::ExpandAll)) data-collapse=(g::t(lang, K::CollapseAll))>(if run.jobs.iter().all(|job| job.tail.is_empty() || job.expanded) { g::t(lang, K::CollapseAll) } else { g::t(lang, K::ExpandAll) })</button>
1648+ </div>
1649+ }
1603 <ul class="ci-job-list">1650 <ul class="ci-job-list">
1604 for job in run.jobs.iter() {1651 for job in run.jobs.iter() {
1605- <li>1652+ <li data-job-row=(job.id.as_str()) data-open=(if job.expanded { "true" } else { "false" })>
1606 <a class="ci-job-line" href=(job.href.as_str())>1653 <a class="ci-job-line" href=(job.href.as_str())>
1607 <span class=(job.dot.as_str())></span>1654 <span class=(job.dot.as_str())></span>
1608 <span class="ci-job-main">1655 <span class="ci-job-main">
@@ -1615,14 +1662,24 @@ async fn runs_body(
1615 <span class="ci-job-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>1662 <span class="ci-job-dur" data-since=(job.since.as_deref())>(job.duration.as_str())</span>
1616 <span class="ci-chev" aria-hidden="true"></span>1663 <span class="ci-chev" aria-hidden="true"></span>
1617 </a>1664 </a>
1665+ if !job.tail.is_empty() {
1666+ <button type="button" class="ci-job-last" data-job-toggle="true" aria-expanded=(if job.expanded { "true" } else { "false" }) title=(job.preview.as_str())>
1667+ <span class="ci-job-caret" aria-hidden="true"></span>
1668+ <span class="ci-job-last-text">(job.preview.as_str())</span>
1669+ </button>
1670+ <div class="ci-job-tail" data-job-tail="true" hidden=(if job.expanded { None } else { Some("hidden") })>
1671+ <pre class="ci-logpre">(job.tail.as_str())</pre>
1672+ <a class="ci-job-full" href=(job.href.as_str())>(g::t(lang, K::FullLog))</a>
1673+ </div>
1674+ } else if !job.preview.is_empty() {
1675+ <p class="ci-job-last" title=(job.preview.as_str())>
1676+ <span class="ci-job-last-text">(job.preview.as_str())</span>
1677+ </p>
1678+ }
1618 </li>1679 </li>
1619 }1680 }
1620 </ul>1681 </ul>
1621 }1682 }
1622- if let Some(log) = run.log.as_ref() {
1623- <p class="ci-cap">(log.caption.as_str())</p>
1624- <pre class="ci-logpre">(log.text.as_str())</pre>
1625- }
1626 } else {1683 } else {
1627 <div class="ci-empty">1684 <div class="ci-empty">
1628 <p>(g::t(lang, K::NoRunsYet))</p>1685 <p>(g::t(lang, K::NoRunsYet))</p>
@@ -2191,12 +2248,29 @@ mod tests {
2191 assert_eq!(bar_text(40, &labels), None);2248 assert_eq!(bar_text(40, &labels), None);
2192 }2249 }
2193 2250
2251+ #[test]
2252+ fn failed_and_lone_jobs_start_expanded() {
2253+ assert!(starts_expanded(JobState::Failure, 3));
2254+ assert!(starts_expanded(JobState::Running, 1));
2255+ assert!(!starts_expanded(JobState::Running, 2));
2256+ assert!(!starts_expanded(JobState::Success, 2));
2257+ }
2258+
2259+ #[test]
2260+ fn previews_skip_blank_lines_and_ansi_codes() {
2261+ assert_eq!(strip_ansi("\u{1b}[31mred\u{1b}[0m ok"), "red ok");
2262+ assert_eq!(strip_ansi("\u{1b}]0;title\u{7}x"), "x");
2263+ let tail = vec!["a".to_owned(), " b ".to_owned(), String::new()];
2264+ assert_eq!(last_line(&tail), Some("b"));
2265+ assert_eq!(last_line(&[]), None);
2266+ }
2267+
2194 #[tokio::test]2268 #[tokio::test]
2195 async fn log_tails_keep_their_last_lines() {2269 async fn log_tails_keep_their_last_lines() {
2196 let dir = tempfile::tempdir().expect("tempdir");2270 let dir = tempfile::tempdir().expect("tempdir");
2197 let path = dir.path().join("log.txt");2271 let path = dir.path().join("log.txt");
2198- std::fs::write(&path, "one\ntwo\nthree\nfour\n").expect("write");2272+ std::fs::write(&path, "one\ntwo\n\u{1b}[1mthree\u{1b}[0m\n\n").expect("write");
2199- assert_eq!(log_last_lines(&path).await, vec!["two", "three", "four"]);2273+ assert_eq!(log_last_lines(&path).await, vec!["one", "two", "three"]);
2200 assert!(log_last_lines(&dir.path().join("none")).await.is_empty());2274 assert!(log_last_lines(&dir.path().join("none")).await.is_empty());
2201 }2275 }
2202 }2276 }
crates/forge-web/src/pages/ci_tests.rsmodified+60 -0
@@ -1393,3 +1393,63 @@ async fn running_runs_carry_ticker_attributes_and_finished_ones_do_not() {
1393 "nothing grows once the run is done"1393 "nothing grows once the run is done"
1394 );1394 );
1395 }1395 }
1396+
1397+/// The run page previews the last log line of every running job in its row, and a failed job's row
1398+/// starts expanded.
1399+#[tokio::test]
1400+async fn run_page_previews_each_job_and_expands_failed_ones() {
1401+ let dir = tempfile::tempdir().expect("tempdir");
1402+ let fx = fixture(dir.path()).await;
1403+ let run = run_with(&fx, &["build", "test", "lint"], false).await;
1404+ let token = fx
1405+ .store
1406+ .create_registration_token(&fx.tahinli, 24)
1407+ .await
1408+ .expect("token");
1409+ let (runner, _) = fx
1410+ .store
1411+ .register_runner(&token, "runner-1", &["linux".to_owned()])
1412+ .await
1413+ .expect("runner");
1414+ for _ in 0..3 {
1415+ fx.store
1416+ .claim_job(&runner)
1417+ .await
1418+ .expect("claim")
1419+ .expect("a queued job");
1420+ }
1421+ let jobs = fx.store.jobs_for_run(&run.id).await.expect("jobs");
1422+ for job in &jobs {
1423+ let path = log_path(&fx.data_dir, &job.id);
1424+ std::fs::create_dir_all(path.parent().expect("log dir")).expect("log dir");
1425+ std::fs::write(
1426+ &path,
1427+ format!("early\n\u{1b}[32mlast of {}\u{1b}[0m\n\n", job.name),
1428+ )
1429+ .expect("log");
1430+ }
1431+ let lint = jobs.iter().find(|job| job.name == "lint").expect("lint");
1432+ fx.store
1433+ .finish_job(&lint.id, JobState::Failure, Some(1), None)
1434+ .await
1435+ .expect("fail");
1436+ let page = get(
1437+ &fx.app,
1438+ &format!("{RUN_BASE}/runs/{}", run.number),
1439+ Some(&cookie_for("tahinli-token")),
1440+ )
1441+ .await;
1442+ assert_eq!(page.status, 200);
1443+ let html = page.text();
1444+ for name in ["build", "test", "lint"] {
1445+ assert!(
1446+ html.contains(&format!("title=\"last of {name}\"")),
1447+ "{name}: {html}"
1448+ );
1449+ }
1450+ assert!(!html.contains('\u{1b}'));
1451+ assert_eq!(html.matches("data-job-row=").count(), 3);
1452+ assert_eq!(html.matches("data-open=\"true\"").count(), 1);
1453+ assert!(html.contains(&format!("data-job-row=\"{}\" data-open=\"true\"", lint.id)));
1454+ assert!(html.contains("data-job-all"));
1455+}
style/main.scssmodified+87 -0
@@ -4600,6 +4600,93 @@ span.reaction {
4600 color: var(--muted);4600 color: var(--muted);
4601 }4601 }
4602 4602
4603+.ci-job-head {
4604+ display: flex;
4605+ justify-content: flex-end;
4606+ margin: 12px 0 -8px;
4607+}
4608+
4609+.ci-job-all {
4610+ padding: 2px 8px;
4611+ font: inherit;
4612+ font-size: 0.8125rem;
4613+ color: var(--muted);
4614+ background: transparent;
4615+ border: 0;
4616+ border-radius: var(--radius-md);
4617+ cursor: pointer;
4618+
4619+ &:hover {
4620+ color: var(--text);
4621+ background: var(--surface-2);
4622+ }
4623+}
4624+
4625+// The last line of a job's log under its row, and the tail that opens below it.
4626+.ci-job-last {
4627+ display: flex;
4628+ align-items: center;
4629+ gap: 8px;
4630+ width: 100%;
4631+ margin: 0;
4632+ padding: 0 6px 8px 26px;
4633+ font-family: var(--mono);
4634+ font-size: 0.75rem;
4635+ color: var(--muted);
4636+ text-align: left;
4637+ background: transparent;
4638+ border: 0;
4639+}
4640+
4641+button.ci-job-last {
4642+ cursor: pointer;
4643+
4644+ &:hover {
4645+ color: var(--text-2);
4646+ }
4647+}
4648+
4649+.ci-job-last-text {
4650+ min-width: 0;
4651+ overflow: hidden;
4652+ white-space: nowrap;
4653+ text-overflow: ellipsis;
4654+}
4655+
4656+.ci-job-caret {
4657+ flex: none;
4658+ width: 5px;
4659+ height: 5px;
4660+ border-right: 1.5px solid currentColor;
4661+ border-bottom: 1.5px solid currentColor;
4662+ transform: rotate(-45deg);
4663+ transition: transform 0.12s;
4664+
4665+ [aria-expanded="true"] > & {
4666+ transform: rotate(45deg);
4667+ }
4668+}
4669+
4670+.ci-job-tail {
4671+ padding: 0 6px 10px 26px;
4672+
4673+ .ci-logpre {
4674+ max-height: 14rem;
4675+ margin: 0;
4676+ overflow: auto;
4677+ }
4678+
4679+ &[hidden] {
4680+ display: none;
4681+ }
4682+}
4683+
4684+.ci-job-full {
4685+ display: inline-block;
4686+ margin-top: 6px;
4687+ font-size: 0.8125rem;
4688+}
4689+
4603 .ci-logpre {4690 .ci-logpre {
4604 max-width: 100%;4691 max-width: 100%;
4605 margin: 8px 0 0;4692 margin: 8px 0 0;