A run's log tools are the job, Log or Timeline, the search with Exact and Aa, and Full log: the match count and arrows show only while searching, Collapse all and Expand all are one word that follows the steps, Copy log is gone, Re-run job stays on the job page, and Download all sits in the Artifacts topic
Browse files at this commit656d47871ed14fb35e31c934235c2c315a754800Parent: a2e388fAll checks have passed
Show checks
ci/buildSucceededDetails
- style
- a run's log tools are the job, Log or Timeline, the search with Exact and Aa, and Full log: the match count and arrows show only while searching, Collapse all and Expand all are one word that follows the steps, Copy log is gone, Re-run job stays on the job page, and Download all sits in the Artifacts topic
9 changed files +42 -192
- crates/forge-web-base/src/i18n/misc.rs +0 -4
- crates/forge-web-base/src/i18n/releases_ci.rs +6 -10
- crates/forge-web/assets/nav.js +15 -24
- crates/forge-web/src/pages/ci_job.rs +1 -3
- crates/forge-web/src/pages/ci_runs.rs +7 -18
- crates/forge-web/src/pages/notifications.rs +2 -119
- scripts/audit/measure.ts +2 -2
- style/_one_ci.scss +9 -0
- style/main.scss +0 -12
crates/forge-web-base/src/i18n/misc.rsmodified+0 -4
| @@ -146,7 +146,6 @@ pub enum K { | |||
| 146 | YourCiRuns, | 146 | YourCiRuns, |
| 147 | SearchPublicReposFor, | 147 | SearchPublicReposFor, |
| 148 | // The bell's popover: the newest notifications, opened from the profile corner. | 148 | // The bell's popover: the newest notifications, opened from the profile corner. |
| 149 | - AllCaughtUp, | ||
| 150 | } | 149 | } |
| 151 | 150 | ||
| 152 | /// Every variant, for the coverage test below. | 151 | /// Every variant, for the coverage test below. |
| @@ -270,7 +269,6 @@ const ALL: &[K] = &[ | |||
| 270 | K::Cancelled, | 269 | K::Cancelled, |
| 271 | K::YourCiRuns, | 270 | K::YourCiRuns, |
| 272 | K::SearchPublicReposFor, | 271 | K::SearchPublicReposFor, |
| 273 | - K::AllCaughtUp, | ||
| 274 | ]; | 272 | ]; |
| 275 | 273 | ||
| 276 | pub fn t(lang: Lang, key: K) -> &'static str { | 274 | pub fn t(lang: Lang, key: K) -> &'static str { |
| @@ -523,8 +521,6 @@ pub fn t(lang: Lang, key: K) -> &'static str { | |||
| 523 | (Cancelled, Tr) => "iptal edildi", | 521 | (Cancelled, Tr) => "iptal edildi", |
| 524 | (YourCiRuns, En) => "Your CI runs", | 522 | (YourCiRuns, En) => "Your CI runs", |
| 525 | (YourCiRuns, Tr) => "CI çalıştırmaların", | 523 | (YourCiRuns, Tr) => "CI çalıştırmaların", |
| 526 | - (AllCaughtUp, En) => "You're all caught up", | ||
| 527 | - (AllCaughtUp, Tr) => "Hepsini gördünüz", | ||
| 528 | (SearchPublicReposFor, En) => "Search public repositories for", | 524 | (SearchPublicReposFor, En) => "Search public repositories for", |
| 529 | (SearchPublicReposFor, Tr) => "Herkese açık depolarda ara:", | 525 | (SearchPublicReposFor, Tr) => "Herkese açık depolarda ara:", |
| 530 | } | 526 | } |
crates/forge-web-base/src/i18n/releases_ci.rsmodified+6 -10
| @@ -58,7 +58,6 @@ pub enum K { | |||
| 58 | Exit, | 58 | Exit, |
| 59 | Log, | 59 | Log, |
| 60 | FullLog, | 60 | FullLog, |
| 61 | - CopyLog, | ||
| 62 | CopyDone, | 61 | CopyDone, |
| 63 | CopyFailed, | 62 | CopyFailed, |
| 64 | Duration, | 63 | Duration, |
| @@ -218,10 +217,10 @@ pub fn t(lang: Lang, key: K) -> &'static str { | |||
| 218 | (LogNext, Tr) => "Sonraki eşleşme", | 217 | (LogNext, Tr) => "Sonraki eşleşme", |
| 219 | (LogNoMatches, En) => "No matches", | 218 | (LogNoMatches, En) => "No matches", |
| 220 | (LogNoMatches, Tr) => "Eşleşme yok", | 219 | (LogNoMatches, Tr) => "Eşleşme yok", |
| 221 | - (LogCollapseAll, En) => "Collapse groups", | 220 | + (LogCollapseAll, En) => "Collapse all", |
| 222 | - (LogCollapseAll, Tr) => "Grupları daralt", | 221 | + (LogCollapseAll, Tr) => "Hepsini daralt", |
| 223 | - (LogExpandAll, En) => "Expand groups", | 222 | + (LogExpandAll, En) => "Expand all", |
| 224 | - (LogExpandAll, Tr) => "Grupları genişlet", | 223 | + (LogExpandAll, Tr) => "Hepsini genişlet", |
| 225 | (Rerun, En) => "Re-run", | 224 | (Rerun, En) => "Re-run", |
| 226 | (Rerun, Tr) => "Yeniden çalıştır", | 225 | (Rerun, Tr) => "Yeniden çalıştır", |
| 227 | (Runs, En) => "Runs", | 226 | (Runs, En) => "Runs", |
| @@ -254,10 +253,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { | |||
| 254 | (Exit, Tr) => "çıkış", | 253 | (Exit, Tr) => "çıkış", |
| 255 | (Log, En) => "Log", | 254 | (Log, En) => "Log", |
| 256 | (Log, Tr) => "Günlük", | 255 | (Log, Tr) => "Günlük", |
| 257 | - (FullLog, En) => "Full log (log.txt)", | 256 | + (FullLog, En) => "Full log", |
| 258 | - (FullLog, Tr) => "Tam günlük (log.txt)", | 257 | + (FullLog, Tr) => "Tam günlük", |
| 259 | - (CopyLog, En) => "Copy log", | ||
| 260 | - (CopyLog, Tr) => "Günlüğü kopyala", | ||
| 261 | (CopyDone, En) => "Copied", | 258 | (CopyDone, En) => "Copied", |
| 262 | (CopyDone, Tr) => "Kopyalandı", | 259 | (CopyDone, Tr) => "Kopyalandı", |
| 263 | (CopyFailed, En) => "Copy failed", | 260 | (CopyFailed, En) => "Copy failed", |
| @@ -572,7 +569,6 @@ mod tests { | |||
| 572 | K::Exit, | 569 | K::Exit, |
| 573 | K::Log, | 570 | K::Log, |
| 574 | K::FullLog, | 571 | K::FullLog, |
| 575 | - K::CopyLog, | ||
| 576 | K::CopyDone, | 572 | K::CopyDone, |
| 577 | K::CopyFailed, | 573 | K::CopyFailed, |
| 578 | K::Duration, | 574 | K::Duration, |
crates/forge-web/assets/nav.jsmodified+15 -24
| @@ -2549,11 +2549,24 @@ | |||
| 2549 | if (el.hasAttribute('data-log-prev')) { logGo(pre, pre._ci.hit - 1, true); } | 2549 | if (el.hasAttribute('data-log-prev')) { logGo(pre, pre._ci.hit - 1, true); } |
| 2550 | else if (el.hasAttribute('data-log-next')) { logGo(pre, pre._ci.hit + 1, true); } | 2550 | else if (el.hasAttribute('data-log-next')) { logGo(pre, pre._ci.hit + 1, true); } |
| 2551 | else { | 2551 | else { |
| 2552 | - var open = el.getAttribute('data-log-fold') === 'open'; | 2552 | + var groups = pre.querySelectorAll('details.lg'); |
| 2553 | - Array.prototype.forEach.call(pre.querySelectorAll('details.lg'), function (d) { d.open = open; }); | 2553 | + var open = !Array.prototype.some.call(groups, function (d) { return d.open; }); |
| 2554 | + Array.prototype.forEach.call(groups, function (d) { d.open = open; }); | ||
| 2554 | } | 2555 | } |
| 2555 | }, true); | 2556 | }, true); |
| 2556 | 2557 | ||
| 2558 | + function logFoldLabel() { | ||
| 2559 | + var btn = document.querySelector('[data-log-fold="toggle"]'); | ||
| 2560 | + var pre = document.querySelector('[data-live-log]'); | ||
| 2561 | + if (!btn || !pre) { return; } | ||
| 2562 | + var any = Array.prototype.some.call(pre.querySelectorAll('details.lg'), function (d) { return d.open; }); | ||
| 2563 | + btn.textContent = btn.getAttribute(any ? 'data-collapse' : 'data-expand'); | ||
| 2564 | + } | ||
| 2565 | + | ||
| 2566 | + document.addEventListener('toggle', function (e) { | ||
| 2567 | + if (e.target && e.target.matches && e.target.matches('details.lg')) { logFoldLabel(); } | ||
| 2568 | + }, true); | ||
| 2569 | + | ||
| 2557 | window.addEventListener('hashchange', function () { | 2570 | window.addEventListener('hashchange', function () { |
| 2558 | if (/^#L\d+$/.test(location.hash)) { logSelect(location.hash.slice(1), true); } | 2571 | if (/^#L\d+$/.test(location.hash)) { logSelect(location.hash.slice(1), true); } |
| 2559 | }); | 2572 | }); |
| @@ -5172,8 +5185,6 @@ | |||
| 5172 | } | 5185 | } |
| 5173 | }, true); | 5186 | }, true); |
| 5174 | 5187 | ||
| 5175 | - // "Copy log": fetches the job's log.txt once and puts the whole text on the clipboard. The button is | ||
| 5176 | - // disabled meanwhile, so a big log is not fetched twice; its label shows the outcome, then returns. | ||
| 5177 | function copyText(text) { | 5188 | function copyText(text) { |
| 5178 | if (navigator.clipboard && navigator.clipboard.writeText) { | 5189 | if (navigator.clipboard && navigator.clipboard.writeText) { |
| 5179 | return navigator.clipboard.writeText(text); | 5190 | return navigator.clipboard.writeText(text); |
| @@ -5192,21 +5203,6 @@ | |||
| 5192 | }); | 5203 | }); |
| 5193 | } | 5204 | } |
| 5194 | 5205 | ||
| 5195 | - function copyLog(btn) { | ||
| 5196 | - if (btn.disabled) { return; } | ||
| 5197 | - var label = btn.getAttribute('data-label') || btn.textContent; | ||
| 5198 | - btn.setAttribute('data-label', label); | ||
| 5199 | - btn.disabled = true; | ||
| 5200 | - var done = function (ok) { | ||
| 5201 | - btn.textContent = btn.getAttribute(ok ? 'data-copied' : 'data-failed') || label; | ||
| 5202 | - setTimeout(function () { btn.textContent = label; btn.disabled = false; }, 1500); | ||
| 5203 | - }; | ||
| 5204 | - fetch(btn.getAttribute('data-copy-log'), { credentials: 'include' }) | ||
| 5205 | - .then(function (r) { if (!r.ok) { throw new Error('fetch'); } return r.text(); }) | ||
| 5206 | - .then(function (text) { return copyText(text.replace(/\u001b\[[0-9;?]*[ -\/]*[@-~]/g, '')); }) | ||
| 5207 | - .then(function () { done(true); }, function () { done(false); }); | ||
| 5208 | - } | ||
| 5209 | - | ||
| 5210 | // Selects an element's text, so the reader can copy it by hand (a long press on a phone). | 5206 | // Selects an element's text, so the reader can copy it by hand (a long press on a phone). |
| 5211 | function selectText(el) { | 5207 | function selectText(el) { |
| 5212 | var range = document.createRange(); | 5208 | var range = document.createRange(); |
| @@ -5234,11 +5230,6 @@ | |||
| 5234 | copyText(text.trim()).then(function () { done(true); }, function () { selectText(src); done(false); }); | 5230 | copyText(text.trim()).then(function () { done(true); }, function () { selectText(src); done(false); }); |
| 5235 | }, false); | 5231 | }, false); |
| 5236 | 5232 | ||
| 5237 | - document.addEventListener('click', function (e) { | ||
| 5238 | - var btn = e.target && e.target.closest ? e.target.closest('[data-copy-log]') : null; | ||
| 5239 | - if (btn) { e.preventDefault(); copyLog(btn); } | ||
| 5240 | - }, false); | ||
| 5241 | - | ||
| 5242 | // ---- branch switcher ------------------------------------------------------------------------ | 5233 | // ---- branch switcher ------------------------------------------------------------------------ |
| 5243 | // The ref popover in the browse bar: one filter over a Branches and a Tags section, the matched | 5234 | // The ref popover in the browse bar: one filter over a Branches and a Tags section, the matched |
| 5244 | // part of each name marked, and arrow keys (or the pointer) through the visible entries as in the | 5235 | // part of each name marked, and arrow keys (or the pointer) through the visible entries as in the |
crates/forge-web/src/pages/ci_job.rsmodified+1 -3
| @@ -484,11 +484,9 @@ async fn job_body( | |||
| 484 | <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> | 484 | <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> |
| 485 | <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev))>"\u{2191}"</button> | 485 | <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev))>"\u{2191}"</button> |
| 486 | <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext))>"\u{2193}"</button> | 486 | <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext))>"\u{2193}"</button> |
| 487 | - <button type="button" class="act" data-copy-log=(job.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button> | ||
| 488 | <a class="act" href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a> | 487 | <a class="act" href=(job.log_href.as_str())>(g::t(lang, K::FullLog))</a> |
| 489 | <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> | 488 | <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> |
| 490 | - <button type="button" class="act" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button> | 489 | + <button type="button" class="act" data-log-fold="toggle" data-collapse=(g::t(lang, K::LogCollapseAll)) data-expand=(g::t(lang, K::LogExpandAll))>(g::t(lang, K::LogExpandAll))</button> |
| 491 | - <button type="button" class="act" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button> | ||
| 492 | </span> | 490 | </span> |
| 493 | </div> | 491 | </div> |
| 494 | </div> | 492 | </div> |
crates/forge-web/src/pages/ci_runs.rsmodified+7 -18
| @@ -560,8 +560,6 @@ struct JobLog { | |||
| 560 | log_href: String, | 560 | log_href: String, |
| 561 | /// The job's event stream (plain lines) while the job is not finished; None once it is. | 561 | /// The job's event stream (plain lines) while the job is not finished; None once it is. |
| 562 | live: Option<String>, | 562 | live: Option<String>, |
| 563 | - /// The POST target that runs this job again, for a writer once the job has finished. | ||
| 564 | - rerun: Option<String>, | ||
| 565 | text: String, | 563 | text: String, |
| 566 | truncated: bool, | 564 | truncated: bool, |
| 567 | offset: String, | 565 | offset: String, |
| @@ -2048,7 +2046,6 @@ async fn run_detail( | |||
| 2048 | log_href: format!("{href}/log.txt"), | 2046 | log_href: format!("{href}/log.txt"), |
| 2049 | live: (!job.state.is_terminal()).then(|| format!("{href}/events?plain=1")), | 2047 | live: (!job.state.is_terminal()).then(|| format!("{href}/events?plain=1")), |
| 2050 | href, | 2048 | href, |
| 2051 | - rerun: lines[index].rerun.clone(), | ||
| 2052 | // Line for line, so line numbers and the byte offset of the stream still match. | 2049 | // Line for line, so line numbers and the byte offset of the stream still match. |
| 2053 | text: text | 2050 | text: text |
| 2054 | .split('\n') | 2051 | .split('\n') |
| @@ -2411,8 +2408,6 @@ async fn run_timeline(lang: Lang, run: &RunDetail) -> Result<impl View> { | |||
| 2411 | <div class="ci-job-tail" data-job-tail="true" hidden=(if job.expanded { None } else { Some("hidden") })> | 2408 | <div class="ci-job-tail" data-job-tail="true" hidden=(if job.expanded { None } else { Some("hidden") })> |
| 2412 | <pre class="ci-logpre">(job.tail.as_str())</pre> | 2409 | <pre class="ci-logpre">(job.tail.as_str())</pre> |
| 2413 | <a class="ci-job-full" href=(job.href.as_str())>(g::t(lang, K::FullLog))</a> | 2410 | <a class="ci-job-full" href=(job.href.as_str())>(g::t(lang, K::FullLog))</a> |
| 2414 | - " " | ||
| 2415 | - <button type="button" class="act ci-job-copy" data-copy-log=(format!("{}/log.txt", job.href)) data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button> | ||
| 2416 | </div> | 2411 | </div> |
| 2417 | } else if !job.preview.is_empty() { | 2412 | } else if !job.preview.is_empty() { |
| 2418 | <p class="ci-job-last" title=(job.preview.as_str())> | 2413 | <p class="ci-job-last" title=(job.preview.as_str())> |
| @@ -2576,7 +2571,12 @@ async fn run_artifacts(lang: Lang, run: &RunDetail) -> Result<impl View> { | |||
| 2576 | Ok(view! { | 2571 | Ok(view! { |
| 2577 | if !run.artifacts.is_empty() { | 2572 | if !run.artifacts.is_empty() { |
| 2578 | <div class="sec"> | 2573 | <div class="sec"> |
| 2579 | - <h2>(g::t(lang, K::Artifacts))</h2> | 2574 | + <div class="sec-tools"> |
| 2575 | + <h2>(g::t(lang, K::Artifacts))</h2> | ||
| 2576 | + if let Some(href) = run.zip_href.as_ref() { | ||
| 2577 | + <a class="act" href=(href.as_str()) download="">(g::t(lang, K::DownloadAll))</a> | ||
| 2578 | + } | ||
| 2579 | + </div> | ||
| 2580 | for artifact in run.artifacts.iter() { | 2580 | for artifact in run.artifacts.iter() { |
| 2581 | <div class="line"> | 2581 | <div class="line"> |
| 2582 | <span class="name">(artifact.name.as_str())</span> | 2582 | <span class="name">(artifact.name.as_str())</span> |
| @@ -2625,20 +2625,9 @@ async fn run_log( | |||
| 2625 | <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> | 2625 | <span class="ci-logcount" data-log-count="true" data-none=(g::t(lang, K::LogNoMatches)) aria-live="polite"></span> |
| 2626 | <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev))>"\u{2191}"</button> | 2626 | <button type="button" class="act" data-log-prev="true" aria-label=(g::t(lang, K::LogPrev))>"\u{2191}"</button> |
| 2627 | <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext))>"\u{2193}"</button> | 2627 | <button type="button" class="act" data-log-next="true" aria-label=(g::t(lang, K::LogNext))>"\u{2193}"</button> |
| 2628 | - <button type="button" class="act" data-copy-log=(log.log_href.as_str()) data-palette-action="click" data-copied=(g::t(lang, K::CopyDone)) data-failed=(g::t(lang, K::CopyFailed))>(g::t(lang, K::CopyLog))</button> | ||
| 2629 | <a class="act" href=(log.href.as_str())>(g::t(lang, K::FullLog))</a> | 2628 | <a class="act" href=(log.href.as_str())>(g::t(lang, K::FullLog))</a> |
| 2630 | - if let Some(href) = run.zip_href.as_ref() { | ||
| 2631 | - <a class="act" href=(href.as_str()) download="">(g::t(lang, K::DownloadAll))</a> | ||
| 2632 | - } | ||
| 2633 | - if let (Some(action), Some(csrf)) = (log.rerun.as_ref(), run.writer_csrf.as_ref()) { | ||
| 2634 | - <form method="post" action=(action.as_str()) class="act-form ci-job-rerun"> | ||
| 2635 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 2636 | - <button type="submit" class="act">(crate::pages::passkeys::s(lang, "Re-run job", "İşi yeniden çalıştır"))</button> | ||
| 2637 | - </form> | ||
| 2638 | - } | ||
| 2639 | <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> | 2629 | <span class="ci-logfold" data-log-fold-box="true" hidden="hidden"> |
| 2640 | - <button type="button" class="act" data-log-fold="close">(g::t(lang, K::LogCollapseAll))</button> | 2630 | + <button type="button" class="act" data-log-fold="toggle" data-collapse=(g::t(lang, K::LogCollapseAll)) data-expand=(g::t(lang, K::LogExpandAll))>(g::t(lang, K::LogExpandAll))</button> |
| 2641 | - <button type="button" class="act" data-log-fold="open">(g::t(lang, K::LogExpandAll))</button> | ||
| 2642 | </span> | 2631 | </span> |
| 2643 | </div> | 2632 | </div> |
| 2644 | } | 2633 | } |
crates/forge-web/src/pages/notifications.rsmodified+2 -119
| @@ -19,9 +19,9 @@ use topcoat::context::{Cx, app_context}; | |||
| 19 | use topcoat::router::content::Form; | 19 | use topcoat::router::content::Form; |
| 20 | use topcoat::router::content::sse::Event; | 20 | use topcoat::router::content::sse::Event; |
| 21 | use topcoat::router::error::{SeeOther, bad_request, not_found, see_other}; | 21 | use topcoat::router::error::{SeeOther, bad_request, not_found, see_other}; |
| 22 | -use topcoat::router::response::{IntoResponse, Response}; | 22 | +use topcoat::router::response::Response; |
| 23 | use topcoat::router::{Body, StatusCode, page, path_param, query_params, route}; | 23 | use topcoat::router::{Body, StatusCode, page, path_param, query_params, route}; |
| 24 | -use topcoat::view::{View, ViewExt, component, view}; | 24 | +use topcoat::view::{View, component, view}; |
| 25 | 25 | ||
| 26 | use crate::auth::{current_user, percent_encode, require_csrf, require_user}; | 26 | use crate::auth::{current_user, percent_encode, require_csrf, require_user}; |
| 27 | use crate::i18n::alerts as alert_text; | 27 | use crate::i18n::alerts as alert_text; |
| @@ -52,9 +52,6 @@ path_param!(admin_note); | |||
| 52 | /// The pseudo repo id of the admin alerts group in the inbox. | 52 | /// The pseudo repo id of the admin alerts group in the inbox. |
| 53 | const ADMIN_GROUP: &str = "admin"; | 53 | const ADMIN_GROUP: &str = "admin"; |
| 54 | 54 | ||
| 55 | -/// Rows in the bell's popover. | ||
| 56 | -const PEEK_SIZE: u32 = 8; | ||
| 57 | - | ||
| 58 | #[query_params(error = bad_request)] | 55 | #[query_params(error = bad_request)] |
| 59 | struct InboxQuery { | 56 | struct InboxQuery { |
| 60 | all: Option<String>, | 57 | all: Option<String>, |
| @@ -320,76 +317,6 @@ async fn entry_visible( | |||
| 320 | && (!matches!(entry, Entry::Advisory(_)) | 317 | && (!matches!(entry, Entry::Advisory(_)) |
| 321 | || can_manage_alerts(state, user, repo_id).await?)) | 318 | || can_manage_alerts(state, user, repo_id).await?)) |
| 322 | } | 319 | } |
| 323 | - | ||
| 324 | -/// The newest entries of each list the inbox reads, unread ones only or all of them, at most | ||
| 325 | -/// `limit` from each list. | ||
| 326 | -async fn list_entries( | ||
| 327 | - state: &AppState, | ||
| 328 | - user: &User, | ||
| 329 | - unread_only: bool, | ||
| 330 | - limit: u32, | ||
| 331 | -) -> Result<Vec<Entry>> { | ||
| 332 | - let mut entries: Vec<Entry> = state | ||
| 333 | - .store | ||
| 334 | - .list_notifications(&user.id, unread_only, None, limit) | ||
| 335 | - .await? | ||
| 336 | - .into_iter() | ||
| 337 | - .map(Entry::Issue) | ||
| 338 | - .collect(); | ||
| 339 | - entries.extend( | ||
| 340 | - state | ||
| 341 | - .store | ||
| 342 | - .list_discussion_notifications(&user.id, unread_only, None, limit) | ||
| 343 | - .await? | ||
| 344 | - .into_iter() | ||
| 345 | - .map(Entry::Discussion), | ||
| 346 | - ); | ||
| 347 | - entries.extend( | ||
| 348 | - state | ||
| 349 | - .store | ||
| 350 | - .list_advisory_notifications(&user.id, unread_only, None, limit) | ||
| 351 | - .await? | ||
| 352 | - .into_iter() | ||
| 353 | - .map(Entry::Advisory), | ||
| 354 | - ); | ||
| 355 | - if user.is_admin { | ||
| 356 | - entries.extend( | ||
| 357 | - state | ||
| 358 | - .store | ||
| 359 | - .list_admin_notices(&user.id, unread_only, None, limit) | ||
| 360 | - .await? | ||
| 361 | - .into_iter() | ||
| 362 | - .map(Entry::Admin), | ||
| 363 | - ); | ||
| 364 | - } | ||
| 365 | - Ok(entries) | ||
| 366 | -} | ||
| 367 | - | ||
| 368 | -/// The bell's popover rows: the viewer's newest unread entries, newest first. Read entries are | ||
| 369 | -/// left out, and so are entries the viewer can no longer read. | ||
| 370 | -async fn peek_rows(state: &AppState, user: &User, lang: Lang, now: i64) -> Result<Vec<RowView>> { | ||
| 371 | - let tz = user.timezone.clone(); | ||
| 372 | - let mut entries = list_entries(state, user, true, PEEK_SIZE).await?; | ||
| 373 | - entries.sort_by(|a, b| b.updated_at().cmp(a.updated_at())); | ||
| 374 | - let mut readable = HashMap::new(); | ||
| 375 | - let mut rows = Vec::new(); | ||
| 376 | - for entry in &entries { | ||
| 377 | - if rows.len() == PEEK_SIZE as usize { | ||
| 378 | - break; | ||
| 379 | - } | ||
| 380 | - if !entry_visible(state, user, &mut readable, entry).await? { | ||
| 381 | - continue; | ||
| 382 | - } | ||
| 383 | - rows.push(match entry { | ||
| 384 | - Entry::Issue(note) => issue_row(lang, note, &tz, now), | ||
| 385 | - Entry::Discussion(note) => discussion_row(lang, note, &tz, now), | ||
| 386 | - Entry::Advisory(note) => advisory_row(lang, note, &tz, now), | ||
| 387 | - Entry::Admin(note) => admin_row(lang, note, &tz, now), | ||
| 388 | - }); | ||
| 389 | - } | ||
| 390 | - Ok(rows) | ||
| 391 | -} | ||
| 392 | - | ||
| 393 | #[page("/notifications")] | 320 | #[page("/notifications")] |
| 394 | async fn inbox(cx: &Cx) -> Result<impl View> { | 321 | async fn inbox(cx: &Cx) -> Result<impl View> { |
| 395 | let viewer = require_user(cx).await?; | 322 | let viewer = require_user(cx).await?; |
| @@ -547,50 +474,6 @@ async fn inbox(cx: &Cx) -> Result<impl View> { | |||
| 547 | }) | 474 | }) |
| 548 | } | 475 | } |
| 549 | 476 | ||
| 550 | -/// `GET /notifications/peek`: the bell's popover, the viewer's newest unread notifications as an HTML | ||
| 551 | -/// fragment. Anonymous viewers get a bare 401. | ||
| 552 | -#[route(GET "/notifications/peek")] | ||
| 553 | -async fn peek(cx: &Cx) -> Result<Response> { | ||
| 554 | - let Some((user, _)) = current_user(cx).await? else { | ||
| 555 | - let mut res = Response::new(Body::empty()); | ||
| 556 | - *res.status_mut() = StatusCode::UNAUTHORIZED; | ||
| 557 | - return Ok(res); | ||
| 558 | - }; | ||
| 559 | - let state = app_context::<AppState>(cx); | ||
| 560 | - let lang = i18n::lang(cx, Some(&user)); | ||
| 561 | - let rows = peek_rows(state, &user, lang, now_unix()).await?; | ||
| 562 | - let fragment = view! { peek_list(lang: lang, rows: rows) }; | ||
| 563 | - fragment.first().await?.into_response(cx) | ||
| 564 | -} | ||
| 565 | - | ||
| 566 | -/// The bell's popover list of unread rows: each row opens through its open route, which marks it | ||
| 567 | -/// read. An empty list says the viewer is all caught up. | ||
| 568 | -#[component] | ||
| 569 | -async fn peek_list(lang: Lang, rows: Vec<RowView>) -> Result<impl View> { | ||
| 570 | - let empty = rows.is_empty(); | ||
| 571 | - Ok(view! { | ||
| 572 | - if empty { | ||
| 573 | - <p class="bell-empty muted">(g::t(lang, K::AllCaughtUp))</p> | ||
| 574 | - } | ||
| 575 | - <ul class="bell-rows"> | ||
| 576 | - for row in rows.into_iter() { | ||
| 577 | - <li> | ||
| 578 | - <a class="bell-item" href=(row.open_href.as_str())> | ||
| 579 | - <span class="bell-dot unread" aria-hidden="true"></span> | ||
| 580 | - <span class="bell-text"> | ||
| 581 | - <span class="bell-line">(row.title_line.as_str())</span> | ||
| 582 | - <span class="bell-meta muted"> | ||
| 583 | - <span>(row.kind_label)</span> | ||
| 584 | - <time data-rel="true" datetime=(row.iso.as_str()) title=(row.absolute.as_str())>(row.relative.as_str())</time> | ||
| 585 | - </span> | ||
| 586 | - </span> | ||
| 587 | - </a> | ||
| 588 | - </li> | ||
| 589 | - } | ||
| 590 | - </ul> | ||
| 591 | - }) | ||
| 592 | -} | ||
| 593 | - | ||
| 594 | /// The URL of the inbox's live stream for the tab the viewer is on. | 477 | /// The URL of the inbox's live stream for the tab the viewer is on. |
| 595 | fn inbox_live_url(all: bool) -> String { | 478 | fn inbox_live_url(all: bool) -> String { |
| 596 | if all { | 479 | if all { |
scripts/audit/measure.tsmodified+2 -2
| @@ -143,7 +143,7 @@ const DESIGN = `(() => { | |||
| 143 | const tag = e.tagName; | 143 | const tag = e.tagName; |
| 144 | const isText = tag === 'INPUT' && !['checkbox','radio','color','file','range','hidden'].includes(e.type); | 144 | const isText = tag === 'INPUT' && !['checkbox','radio','color','file','range','hidden'].includes(e.type); |
| 145 | const isBtn = tag === 'BUTTON' || (tag === 'INPUT' && ['submit','button'].includes(e.type)) || e.matches('summary.button, a.button, summary.act, a.act'); | 145 | const isBtn = tag === 'BUTTON' || (tag === 'INPUT' && ['submit','button'].includes(e.type)) || e.matches('summary.button, a.button, summary.act, a.act'); |
| 146 | - if (isBtn && !e.closest('.heat-grid, .corner-theme-set, .choice, .swatches, .colour-grid') && !e.matches('.icon-btn, .rail-item, .line, .corner-link, .swatch')) { | 146 | + if (isBtn && !e.closest('.heat-grid, .choice, .swatches, .colour-grid') && !e.matches('.icon-btn, .rail-item, .line, .corner-link, .swatch')) { |
| 147 | if (!CONTROLS.some(([h, r, fs]) => p.h === h && p.r === r && p.fs === fs)) bad.push('control shape ' + p.h + '/' + p.r + '/' + p.fs + ': ' + label); | 147 | if (!CONTROLS.some(([h, r, fs]) => p.h === h && p.r === r && p.fs === fs)) bad.push('control shape ' + p.h + '/' + p.r + '/' + p.fs + ': ' + label); |
| 148 | } | 148 | } |
| 149 | if (isText || tag === 'SELECT') { | 149 | if (isText || tag === 'SELECT') { |
| @@ -167,7 +167,7 @@ const DESIGN = `(() => { | |||
| 167 | const sides = [c.borderTopWidth, c.borderRightWidth, c.borderBottomWidth, c.borderLeftWidth].filter((v) => parseFloat(v) > 0).length; | 167 | const sides = [c.borderTopWidth, c.borderRightWidth, c.borderBottomWidth, c.borderLeftWidth].filter((v) => parseFloat(v) > 0).length; |
| 168 | if (sides === 4 && !e.closest('table') && !e.matches('input[type=checkbox], input[type=radio]')) bad.push('box border: ' + label); | 168 | if (sides === 4 && !e.closest('table') && !e.matches('input[type=checkbox], input[type=radio]')) bad.push('box border: ' + label); |
| 169 | if (parseFloat(c.borderLeftWidth) >= 2 && sides === 1) bad.push('side stripe: ' + label); | 169 | if (parseFloat(c.borderLeftWidth) >= 2 && sides === 1) bad.push('side stripe: ' + label); |
| 170 | - if (c.boxShadow !== 'none' && /\\) -?\\d+px -?\\d+px [1-9]\\d*px/.test(c.boxShadow) && !e.matches('.corner-menu, .menu-list, .pop-panel, .ref-menu, .row-menu-panel, .tab-more-list, .strip-list, .bell-box, .palette-box, .decide, .decide-panel, .status-list, .ci-pop')) bad.push('shadow: ' + label); | 170 | + if (c.boxShadow !== 'none' && /\\) -?\\d+px -?\\d+px [1-9]\\d*px/.test(c.boxShadow) && !e.matches('.corner-menu, .menu-list, .pop-panel, .ref-menu, .row-menu-panel, .tab-more-list, .strip-list, .palette-box, .decide, .decide-panel, .status-list, .ci-pop')) bad.push('shadow: ' + label); |
| 171 | } | 171 | } |
| 172 | // A form's submit and its Cancel are one row: neither sits alone as a child of the fields. | 172 | // A form's submit and its Cancel are one row: neither sits alone as a child of the fields. |
| 173 | for (const e of root.querySelectorAll('.fields > a.act, .fields > button.act')) { | 173 | for (const e of root.querySelectorAll('.fields > a.act, .fields > button.act')) { |
style/_one_ci.scssmodified+9 -0
| @@ -285,6 +285,15 @@ main:has(> .ci-job) > .sheet { | |||
| 285 | display: none; | 285 | display: none; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | +// The count and the match arrows show only while the log search has text. | ||
| 289 | +.ci-tl-tools:has(input:placeholder-shown) { | ||
| 290 | + .ci-logcount, | ||
| 291 | + [data-log-prev], | ||
| 292 | + [data-log-next] { | ||
| 293 | + display: none; | ||
| 294 | + } | ||
| 295 | +} | ||
| 296 | + | ||
| 288 | // The timeline tab: its parts keep their own heights in the scrolling panel (the chart had shrunk to | 297 | // The timeline tab: its parts keep their own heights in the scrolling panel (the chart had shrunk to |
| 289 | // nothing), start on the sheet's inset, and every action sits on the left with the rest. | 298 | // nothing), start on the sheet's inset, and every action sits on the left with the rest. |
| 290 | .ci-tl-panel-timeline { | 299 | .ci-tl-panel-timeline { |
style/main.scssmodified+0 -12
| @@ -3679,14 +3679,6 @@ span.reaction { | |||
| 3679 | 3679 | ||
| 3680 | // Notifications: the header bell, the inbox, the sidebar box and the watch control. | 3680 | // Notifications: the header bell, the inbox, the sidebar box and the watch control. |
| 3681 | 3681 | ||
| 3682 | -.bell { | ||
| 3683 | - display: inline-flex; | ||
| 3684 | - align-items: center; | ||
| 3685 | - gap: 0.35rem; | ||
| 3686 | - color: var(--text); | ||
| 3687 | - text-decoration: none; | ||
| 3688 | -} | ||
| 3689 | - | ||
| 3690 | .bell-count { | 3682 | .bell-count { |
| 3691 | display: inline-block; | 3683 | display: inline-block; |
| 3692 | min-width: 1.4rem; | 3684 | min-width: 1.4rem; |
| @@ -5383,10 +5375,6 @@ button.ci-job-last { | |||
| 5383 | } | 5375 | } |
| 5384 | } | 5376 | } |
| 5385 | 5377 | ||
| 5386 | -.ci-job-copy { | ||
| 5387 | - margin: 6px 0 0 8px; | ||
| 5388 | -} | ||
| 5389 | - | ||
| 5390 | .ci-job-full { | 5378 | .ci-job-full { |
| 5391 | display: inline-block; | 5379 | display: inline-block; |
| 5392 | margin-top: 6px; | 5380 | margin-top: 6px; |