A CI job's log bar shows its previous and next match arrows only while the log search has matches, instead of two arrows that did nothing before a search
Browse files at this commit8e5a2cf49f498321a089d01341aab80fd30f2269Parent: a169f73- style
- a CI job's log bar shows its previous and next match arrows only while the log search has matches, instead of two arrows that did nothing before a search
2 changed files +9 -0
- crates/forge-web/assets/nav.js +3 -0
- style/main.scss +6 -0
crates/forge-web/assets/nav.jsmodified+3 -0
| @@ -2115,11 +2115,14 @@ | |||
| 2115 | pre._ci.hit = -1; | 2115 | pre._ci.hit = -1; |
| 2116 | } | 2116 | } |
| 2117 | 2117 | ||
| 2118 | + // Writes the match counter. The previous and next buttons show only while there are matches. | ||
| 2118 | function logCount(text, none) { | 2119 | function logCount(text, none) { |
| 2119 | var out = document.querySelector('[data-log-count]'); | 2120 | var out = document.querySelector('[data-log-count]'); |
| 2120 | if (!out) { return; } | 2121 | if (!out) { return; } |
| 2121 | out.textContent = text; | 2122 | out.textContent = text; |
| 2122 | out.classList.toggle('ci-none', !!none); | 2123 | out.classList.toggle('ci-none', !!none); |
| 2124 | + var bar = out.closest('.ci-logbar'); | ||
| 2125 | + if (bar) { bar.classList.toggle('has-hits', !!text && !none); } | ||
| 2123 | } | 2126 | } |
| 2124 | 2127 | ||
| 2125 | // Highlights every match of `q` (case-insensitive) in the log and selects the one at `keep`. | 2128 | // Highlights every match of `q` (case-insensitive) in the log and selects the one at `keep`. |
style/main.scssmodified+6 -0
| @@ -4914,6 +4914,12 @@ button.ci-mini { | |||
| 4914 | font-size: 0.8125rem; | 4914 | font-size: 0.8125rem; |
| 4915 | } | 4915 | } |
| 4916 | 4916 | ||
| 4917 | +// The log's previous and next match buttons show only while a search has matches. | ||
| 4918 | +.ci-logbar:not(.has-hits) [data-log-prev], | ||
| 4919 | +.ci-logbar:not(.has-hits) [data-log-next] { | ||
| 4920 | + display: none; | ||
| 4921 | +} | ||
| 4922 | + | ||
| 4917 | // The config keys this forge ignored, above the timeline. | 4923 | // The config keys this forge ignored, above the timeline. |
| 4918 | .ci-warnings { | 4924 | .ci-warnings { |
| 4919 | margin: 8px 0 12px; | 4925 | margin: 8px 0 12px; |