diff --git a/crates/forge-web/assets/nav.js b/crates/forge-web/assets/nav.js index 05d9433..30f0462 100644 --- a/crates/forge-web/assets/nav.js +++ b/crates/forge-web/assets/nav.js @@ -1351,9 +1351,45 @@ if (cancel) { var det = cancel.closest('details'); if (det) { det.open = false; } + var owner = det && det.closest('details.row-menu'); + if (owner) { owner.open = false; } + } + // Row action menus: one open at a time, closed by a click anywhere outside. + var menu = t.closest('details.row-menu'); + document.querySelectorAll('details.row-menu[open]').forEach(function (d) { + if (d !== menu) { d.open = false; } + }); + }, false); + + // Escape closes an open confirm popover first, then the menu (focus returns to its button). The + // arrow keys move between the menu's items. + document.addEventListener('keydown', function (e) { + var menu = document.querySelector('details.row-menu[open]'); + if (!menu) { return; } + if (e.key === 'Escape') { + var inner = menu.querySelector('details.confirm-inline[open]'); + if (inner) { inner.open = false; var sm = inner.querySelector('summary'); if (sm) { sm.focus(); } } + else { menu.open = false; menu.querySelector('summary').focus(); } + e.preventDefault(); + } else if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !menu.querySelector('details.confirm-inline[open]')) { + var items = Array.prototype.slice.call(menu.querySelectorAll('.row-menu-panel > form > button, .row-menu-panel > button:not(:disabled), .row-menu-panel > .confirm-inline > summary')); + if (!items.length) { return; } + var at = items.indexOf(document.activeElement); + var next = e.key === 'ArrowDown' ? (at + 1) % items.length : (at <= 0 ? items.length - 1 : at - 1); + items[next].focus(); + e.preventDefault(); } }, false); + // Opening a menu puts focus on its first item, so the keyboard continues from there. + document.addEventListener('toggle', function (e) { + var d = e.target; + if (d && d.matches && d.matches('details.row-menu') && d.open) { + var first = d.querySelector('.row-menu-panel > form > button, .row-menu-panel > button:not(:disabled), .row-menu-panel > .confirm-inline > summary'); + if (first) { first.focus(); } + } + }, true); + // "Copy log": fetches the job's log.txt once and puts the whole text on the clipboard. The button is // disabled meanwhile, so a big log is not fetched twice; its label shows the outcome, then returns. function copyText(text) { diff --git a/crates/forge-web/src/i18n/admin.rs b/crates/forge-web/src/i18n/admin.rs index 55dd0fa..d3fa1be 100644 --- a/crates/forge-web/src/i18n/admin.rs +++ b/crates/forge-web/src/i18n/admin.rs @@ -157,7 +157,6 @@ pub enum K { TableDuration, TableError, TableKind, - TableLabels, TableLastError, TableName, TableQueued, @@ -548,8 +547,6 @@ pub fn t(lang: Lang, key: K) -> &'static str { (TableError, Tr) => "Hata", (TableKind, En) => "Kind", (TableKind, Tr) => "Tür", - (TableLabels, En) => "Labels", - (TableLabels, Tr) => "Etiketler", (TableLastError, En) => "Last error", (TableLastError, Tr) => "Son hata", (TableName, En) => "Name", @@ -946,7 +943,6 @@ mod tests { K::TableDuration, K::TableError, K::TableKind, - K::TableLabels, K::TableLastError, K::TableName, K::TableQueued, diff --git a/crates/forge-web/src/pages/admin_runners.rs b/crates/forge-web/src/pages/admin_runners.rs index ad7b7ab..ba18e89 100644 --- a/crates/forge-web/src/pages/admin_runners.rs +++ b/crates/forge-web/src/pages/admin_runners.rs @@ -294,43 +294,42 @@ async fn runners_view( if rows.is_empty() {

(g::t(lang, K::NoRunnersYet))

} else { -
+
- - + for row in rows.iter() { - - - - - + - - + } @@ -405,6 +407,17 @@ async fn confirm_post( }) } +/// The tooltip of the concurrency input: where the shown value comes from. +fn source_title(lang: Lang, source: &str) -> String { + match (source, lang) { + ("", _) => String::new(), + ("UI", Lang::Tr) => "Değer arayüzden ayarlandı".to_owned(), + ("UI", _) => "Value set in the UI".to_owned(), + (other, Lang::Tr) => format!("Değer {other} dosyasından"), + (other, _) => format!("Value from {other}"), + } +} + fn delete_message(lang: Lang, name: &str) -> String { match lang { Lang::Tr => format!("{name} silinsin mi? Makinenin sonrasında yeniden kaydolması gerekir."), @@ -472,13 +485,10 @@ async fn concurrency_form( - + if has_override { - - } - if !source.is_empty() { - (source) + } }) diff --git a/style/main.scss b/style/main.scss index 6900367..cb64622 100644 --- a/style/main.scss +++ b/style/main.scss @@ -4240,11 +4240,20 @@ $ansi-colours: ( } } -// Admin runners table: every column sizes to its content except Name and Labels, which share the -// slack in fixed proportions so a long label list wraps instead of pushing the rest to the right. -// All text is left aligned and th and td share the base padding, so a header sits over its cell. -// Cells are single lines centered on one axis; the actions sit flush right. State reuses `.ci-state`. +// Admin runners table: Name takes the slack and carries the label chips under it; every other column +// sizes to its content so the table fits without sideways scroll. All text is left aligned and th +// and td share one padding, so a header sits over its cell. The row actions live in a menu; its +// panel is absolutely positioned, so the wrapper must not clip it. State reuses `.ci-state`. +.table-wrap.runners-wrap { + overflow: visible; +} + .table.runners { + th, + td { + padding-right: 8px; + } + th.runner-conc, td.runner-conc, th.runner-running, @@ -4254,7 +4263,9 @@ $ansi-colours: ( th.runner-seen, td.runner-seen, th.runner-state, - td.runner-state { + td.runner-state, + th.runner-actions, + td.runner-actions { width: 1%; white-space: nowrap; } @@ -4265,40 +4276,169 @@ $ansi-colours: ( th.runner-actions, td.runner-actions { - width: 1%; padding-right: 0; text-align: right; - white-space: nowrap; } - td.runner-labels { - width: 20%; + td.runner-name { min-width: 8rem; + overflow-wrap: anywhere; + + .runner-label-list { + margin-top: 4px; + } } - th, - td { - padding-right: 10px; + td.runner-build > *, + td.runner-state > * { + vertical-align: middle; } +} - th.runner-actions, - td.runner-actions { - padding-right: 0; +// The row actions menu: a "..." button that opens a small panel of the actions. Each item is a plain +// button or a `confirm-inline` summary; the confirm popover is fixed, so the panel does not clip it. +.row-menu { + display: inline-block; + position: relative; + text-align: left; + + > summary { + list-style: none; + cursor: pointer; + + &::-webkit-details-marker { + display: none; + } } - td.runner-name { - min-width: 6rem; - max-width: 11rem; - overflow-wrap: anywhere; + .row-menu-btn { + box-sizing: border-box; + min-width: var(--control-h); + height: var(--control-h); + padding: 0 8px; + font-size: 1.125rem; + line-height: 1; } - td.runner-build > *, - td.runner-state > * { - vertical-align: middle; + .row-menu-panel { + position: absolute; + top: calc(100% + 4px); + right: 0; + z-index: 40; + display: flex; + flex-direction: column; + min-width: 11rem; + padding: 4px; + background: var(--surface); + border: 1px solid var(--border-strong); + border-radius: var(--radius-lg); + box-shadow: var(--shadow); } - form.runner-conc-form { - flex-wrap: nowrap; + .row-menu-panel form.inline-form, + .row-menu-panel .confirm-inline { + display: block; + margin: 0; + } + + .row-menu-panel > form > button, + .row-menu-panel > button, + .row-menu-panel > .confirm-inline > summary.button { + display: flex; + align-items: center; + box-sizing: border-box; + width: 100%; + height: 34px; + margin: 0; + padding: 0 10px; + border: 0; + border-radius: var(--radius-md); + background: none; + box-shadow: none; + text-align: left; + font-weight: 400; + + &:hover:not(:disabled), + &:focus-visible { + background: var(--code-bg); + } + + &.danger { + color: var(--danger); + } + } + + .row-menu-panel > button:disabled { + color: var(--muted); + cursor: default; + } + + .row-menu-panel > .muted { + padding: 0 10px; + line-height: 34px; + } +} + +// Phone: each runner is a card, every cell a label and value row, the menu at the card's end. +@media (max-width: 720px) { + .table.runners { + display: block; + + thead { + display: none; + } + + tbody, + tr { + display: block; + } + + tr { + padding: 12px 0; + border-bottom: 1px solid var(--border); + } + + th, + td, + td[class] { + display: block; + width: auto; + padding: 0; + border: 0; + } + + tr { + position: relative; + } + + td.runner-name { + padding-bottom: 8px; + } + + td[data-label] { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; + min-height: 36px; + + &::before { + content: attr(data-label); + color: var(--muted); + font-size: 0.78125rem; + } + } + + td.runner-name { + padding-right: 48px; + } + + // The menu sits in the card's top right corner, beside the name. + td.runner-actions { + position: absolute; + top: 12px; + right: 0; + } } } @@ -4320,17 +4460,17 @@ $ansi-colours: ( white-space: nowrap; } -// Runner concurrency and config forms: a compact input, its buttons and the muted source tag on one -// line. `form.` outranks the later plain `.inline-form { display: inline }`. +// Runner concurrency form: a compact input, Save and, while an override is set, a small reset icon, +// all on one line. The value's source is the input's tooltip, so nothing else widens the cell. form.runner-conc-form { display: flex; - flex-wrap: wrap; + flex-wrap: nowrap; align-items: center; - gap: 4px 8px; + gap: 6px; margin: 0; input[type="number"] { - width: 4.5rem; + width: 3.75rem; min-width: 0; text-align: left; } @@ -4343,9 +4483,9 @@ form.runner-conc-form { margin: 0; } - .runner-source { - flex: none; - white-space: nowrap; + button[name="reset"] { + min-width: var(--control-h); + padding: 0; } } @@ -4369,35 +4509,6 @@ form.runner-conc-form { color: var(--muted); } -.runner-action-row { - display: flex; - justify-content: flex-end; - align-items: center; - gap: 8px; - - form { - display: flex; - margin: 0; - } - - .confirm-inline { - display: flex; - } - - button, - summary.button { - box-sizing: border-box; - min-width: 4.25rem; - height: var(--control-h); - margin: 0; - padding-inline: 12px; - } - - // The popover buttons keep their natural width. - .confirm-pop button { - min-width: 0; - } -} // CI: runs list and run detail. The split view has the runs on the left and the selected run on the // right. Bars and the timeline are SVG, so their sizes are in viewBox units and need no inline style.
(g::t(lang, K::TableName))(g::t(lang, K::TableLabels)) (s(lang, "Concurrency", "Eşzamanlılık")) (s(lang, "Running", "Çalışan")) (s(lang, "Version", "Sürüm")) (g::t(lang, K::LastSeen)) (g::t(lang, K::TableState))(s(lang, "Actions", "İşlemler"))
(row.name.as_str()) + + (row.name.as_str()) for label in row.labels.iter() { (label.as_str()) } + concurrency_form(lang: lang, csrf: csrf.as_str(), action: row.config_action.as_str(), key: "concurrency", value: row.concurrency.as_str(), source: row.concurrency_source, has_override: row.has_override, back: "list") (row.running.to_string()) + (row.running.to_string()) if !row.build_short.is_empty() { (row.build_short.as_str()) } (row.build_label) (row.last_seen.as_str()) + (row.last_seen.as_str()) if row.disabled { (g::t(lang, K::Disabled)) } else { @@ -341,19 +340,22 @@ async fn runners_view( } -
- if row.disabled { -
- - - -
- } else { - confirm_post(lang: lang, csrf: csrf.as_str(), action: row.toggle_action.as_str(), label: g::t(lang, K::Disable), message: disable_message(lang, row.name.as_str()), confirm: s(lang, "Yes, disable", "Evet, devre dışı bırak"), danger: false, fields: vec![("disabled", "1")]) - } - restart_control(lang: lang, csrf: csrf.as_str(), action: row.restart_action.as_str(), back: "list", can_restart: row.can_restart, pending: row.restart_pending) - confirm_post(lang: lang, csrf: csrf.as_str(), action: row.delete_action.as_str(), label: i18n::t(lang, Key::Delete), message: delete_message(lang, row.name.as_str()), confirm: s(lang, "Yes, delete", "Evet, sil"), danger: true, fields: vec![]) -
+
+ "⋯" + +