diff --git a/.claude/worktrees/agent-ad1405076d481b501 b/.claude/worktrees/agent-ad1405076d481b501 new file mode 160000 index 0000000..b0649a2 --- /dev/null +++ b/.claude/worktrees/agent-ad1405076d481b501 @@ -0,0 +1 @@ +Subproject commit b0649a2b0f6303ab2693fd24f529b4a0d052ee2e diff --git a/.claude/worktrees/agent-ae096288739fa88c6 b/.claude/worktrees/agent-ae096288739fa88c6 new file mode 160000 index 0000000..b0649a2 --- /dev/null +++ b/.claude/worktrees/agent-ae096288739fa88c6 @@ -0,0 +1 @@ +Subproject commit b0649a2b0f6303ab2693fd24f529b4a0d052ee2e diff --git a/.claude/worktrees/agent-afb59039872290877 b/.claude/worktrees/agent-afb59039872290877 new file mode 160000 index 0000000..b0649a2 --- /dev/null +++ b/.claude/worktrees/agent-afb59039872290877 @@ -0,0 +1 @@ +Subproject commit b0649a2b0f6303ab2693fd24f529b4a0d052ee2e diff --git a/crates/forge-web/assets/nav.js b/crates/forge-web/assets/nav.js index 0292be4..05d9433 100644 --- a/crates/forge-web/assets/nav.js +++ b/crates/forge-web/assets/nav.js @@ -1389,6 +1389,23 @@ .then(function () { done(true); }, function () { done(false); }); } + // `data-copy=""`: copies the text of that element, with the same Copied/Failed feedback. + document.addEventListener('click', function (e) { + var cb = e.target && e.target.closest ? e.target.closest('[data-copy]') : null; + if (!cb || cb.disabled) { return; } + var src = document.getElementById(cb.getAttribute('data-copy')); + if (!src) { return; } + e.preventDefault(); + var label = cb.getAttribute('data-label') || cb.textContent; + cb.setAttribute('data-label', label); + cb.disabled = true; + var done = function (ok) { + cb.textContent = cb.getAttribute(ok ? 'data-copied' : 'data-failed') || label; + setTimeout(function () { cb.textContent = label; cb.disabled = false; }, 1500); + }; + copyText(src.textContent.trim()).then(function () { done(true); }, function () { done(false); }); + }, false); + document.addEventListener('click', function (e) { var btn = e.target && e.target.closest ? e.target.closest('[data-copy-log]') : null; if (btn) { e.preventDefault(); copyLog(btn); } diff --git a/crates/forge-web/src/pages/admin_runners.rs b/crates/forge-web/src/pages/admin_runners.rs index 3852369..ad7b7ab 100644 --- a/crates/forge-web/src/pages/admin_runners.rs +++ b/crates/forge-web/src/pages/admin_runners.rs @@ -264,7 +264,7 @@ fn back_to_list(notice: &str) -> SeeOther { /// The command a new runner runs. The base URL comes from the server config. fn register_command(base_url: &str, token: &str) -> String { format!( - "forge runner register --url {} --token {token} --name --labels linux", + "forge runner register --url {} --token {token} --name --labels linux,x86_64 --config ~/.config/forge-runner/runner.toml", base_url.trim_end_matches('/') ) } @@ -342,16 +342,17 @@ 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![])
@@ -373,6 +374,51 @@ async fn runners_view( }) } +/// A destructive button that opens the shared `confirm-inline` popover; the POST only fires from the +/// confirm button inside it, and Cancel closes the popover. +#[component] +async fn confirm_post( + lang: Lang, + csrf: &str, + action: &str, + label: &'static str, + message: String, + confirm: &'static str, + danger: bool, + fields: Vec<(&'static str, &'static str)>, +) -> Result { + Ok(view! { +
+ (label) +
+

(message)

+
+ + for (name, value) in fields.iter() { + + } + + +
+
+
+ }) +} + +fn delete_message(lang: Lang, name: &str) -> String { + match lang { + Lang::Tr => format!("{name} silinsin mi? Makinenin sonrasında yeniden kaydolması gerekir."), + _ => format!("Delete runner {name}? The machine has to register again afterwards."), + } +} + +fn disable_message(lang: Lang, name: &str) -> String { + match lang { + Lang::Tr => format!("{name} devre dışı bırakılsın mı? Yeni iş almayı bırakır."), + _ => format!("Disable runner {name}? It stops taking new jobs."), + } +} + /// The restart control of a runner: a confirm popover with the two ways to restart. A runner that /// reports no boot id is too old to obey, so the control is off with a hint. While a restart is /// pending the control shows that instead, and the runner clears it by coming back with a new id. @@ -429,7 +475,7 @@ async fn concurrency_form( if has_override { - + } if !source.is_empty() { (source) @@ -455,10 +501,16 @@ async fn token_view(

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

-
(token.as_str())
+
+ (token.as_str()) + +

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

(g::t(lang, K::ReplacePrefix))""(g::t(lang, K::ReplaceSuffix))

-
(command.as_str())
+
+ (command.as_str()) + +

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

}) @@ -1419,7 +1471,7 @@ mod tests { let cmd = register_command("https://forge.example/", "tok123"); assert_eq!( cmd, - "forge runner register --url https://forge.example --token tok123 --name --labels linux" + "forge runner register --url https://forge.example --token tok123 --name --labels linux,x86_64 --config ~/.config/forge-runner/runner.toml" ); } @@ -1507,7 +1559,7 @@ mod tests { .to_owned(); assert!(created.contains("forge runner register --url")); assert!( - created.contains("--name <name> --labels linux"), + created.contains("--name <name> --labels linux,x86_64 --config ~/.config/forge-runner/runner.toml"), "placeholder is escaped" ); assert_eq!( @@ -1779,7 +1831,7 @@ mod tests { ); let (_, list) = send(&router, "GET", "/admin/runners", Some(ADMIN_TOKEN), None).await; assert!(list.contains(r#"value="3""#)); - assert!(list.contains("Use runner.toml value")); + assert!(list.contains("Use the runner.toml value")); assert!(list.contains(r#"data-live="/admin/runners/events""#)); // Out of range, wrong kind of field and a read-only field change nothing. diff --git a/style/main.scss b/style/main.scss index dce211b..6900367 100644 --- a/style/main.scss +++ b/style/main.scss @@ -4242,34 +4242,24 @@ $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. -// Cells are vertically centered; the actions sit flush right. State reuses the `.ci-state` pill. +// 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`. .table.runners { th.runner-conc, td.runner-conc, th.runner-running, td.runner-running, + th.runner-build, + td.runner-build, th.runner-seen, - th.runner-state, td.runner-seen, + th.runner-state, td.runner-state { width: 1%; white-space: nowrap; } - th.runner-conc, - td.runner-conc { - min-width: 9.75rem; - } - - th.runner-build, - td.runner-build { - width: 1%; - white-space: nowrap; - } - - th.runner-running, td.runner-running { - text-align: right; font-variant-numeric: tabular-nums; } @@ -4288,7 +4278,7 @@ $ansi-colours: ( th, td { - padding-right: 8px; + padding-right: 10px; } th.runner-actions, @@ -4297,13 +4287,19 @@ $ansi-colours: ( } td.runner-name { + min-width: 6rem; max-width: 11rem; overflow-wrap: anywhere; } - td.runner-state .ci-state { + td.runner-build > *, + td.runner-state > * { vertical-align: middle; } + + form.runner-conc-form { + flex-wrap: nowrap; + } } .runner-label-list { @@ -4324,8 +4320,8 @@ $ansi-colours: ( white-space: nowrap; } -// Runner concurrency and config forms: a compact input and its buttons on one line, the source hint -// on a line of its own below. `form.` outranks the later plain `.inline-form { display: inline }`. +// 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 }`. form.runner-conc-form { display: flex; flex-wrap: wrap; @@ -4336,7 +4332,7 @@ form.runner-conc-form { input[type="number"] { width: 4.5rem; min-width: 0; - text-align: center; + text-align: left; } input, @@ -4348,8 +4344,7 @@ form.runner-conc-form { } .runner-source { - flex-basis: 100%; - line-height: 1.2; + flex: none; white-space: nowrap; } } @@ -4385,11 +4380,22 @@ form.runner-conc-form { margin: 0; } - button { + .confirm-inline { + display: flex; + } + + button, + summary.button { box-sizing: border-box; - min-width: 5rem; + 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; } } @@ -6436,3 +6442,35 @@ button.ci-job-last { } @import "account_admin"; + +// A monospace value with its Copy button on the right; long values wrap inside the box. +.copy-box { + display: flex; + align-items: flex-start; + gap: 12px; + margin: 0 0 16px; + padding: 10px 12px; + border: 1px solid var(--border); + border-radius: var(--radius); + background: var(--code-bg); + + code { + flex: 1; + min-width: 0; + padding: 0; + background: none; + font-family: var(--mono); + font-size: 0.8125rem; + line-height: 1.6; + overflow-wrap: anywhere; + white-space: pre-wrap; + user-select: all; + } + + button { + flex: none; + height: var(--control-h); + margin: 0; + min-width: 5rem; + } +}