forge
Explore
Log in

Don't you dare go Hollow

Runner row shows running jobs as one pip per slot and a compact joined Max stepper

Browse files at this commit

12e6ee09290b9845a4803fd229d8d9f6a85ab6d0Ahmet Kaan GümüşParent: 67ea129
  • style
    • runner row shows running jobs as one pip per slot and a compact joined Max stepper
Show full message
💄 style: runner row shows running jobs as one pip per slot and a compact joined Max stepper
crates/forge-web/src/pages/admin_runners.rsmodified+37 -14
@@ -494,9 +494,13 @@ async fn restart_control(
494 })494 })
495 }495 }
496 496
497-/// The load cell of a runner: the jobs running out of the concurrency, a meter of the two, and the497+/// Above this many slots the running jobs show as a meter, not as one pip per slot.
498-/// concurrency as a stepper. The − and + buttons step the input (nav.js); Save shows only once the498+const PIP_MAX: u32 = 16;
499-/// value has changed, and stays visible without JavaScript. A reset button shows while an override is set.499+
500+/// The load cell of a runner, in two parts: the jobs running, as a pip per concurrency slot (a
501+/// meter past `PIP_MAX`), and the concurrency as a stepper. The − and + buttons step the input
502+/// (nav.js); Save shows only once the value has changed, and stays visible without JavaScript. A
503+/// reset button shows while an override is set.
500 #[component]504 #[component]
501 async fn concurrency_form(505 async fn concurrency_form(
502 lang: Lang,506 lang: Lang,
@@ -510,26 +514,45 @@ async fn concurrency_form(
510 running: u32,514 running: u32,
511 max: u32,515 max: u32,
512 ) -> Result<impl View> {516 ) -> Result<impl View> {
513- let running = running.to_string();517+ let running_text = running.to_string();
514 let meter_max = max.max(1).to_string();518 let meter_max = max.max(1).to_string();
519+ let use_pips = (1..=PIP_MAX).contains(&max);
520+ let pips: Vec<&'static str> = (0..max)
521+ .map(|slot| if slot < running { "runner-pip is-on" } else { "runner-pip" })
522+ .collect();
523+ let pips_label = match lang {
524+ Lang::En => format!("{running} of {max} jobs running"),
525+ Lang::Tr => format!("{running}/{max} iş çalışıyor"),
526+ };
515 Ok(view! {527 Ok(view! {
516 <form method="post" action=(action) class="runner-load" data-dirty-form="">528 <form method="post" action=(action) class="runner-load" data-dirty-form="">
517 <input type="hidden" name="csrf" value=(csrf)>529 <input type="hidden" name="csrf" value=(csrf)>
518 <input type="hidden" name="key" value=(key)>530 <input type="hidden" name="key" value=(key)>
519 <input type="hidden" name="back" value=(back)>531 <input type="hidden" name="back" value=(back)>
520- <span class="runner-cap muted">(s(lang, "Jobs", "İşler"))</span>532+ <div class="runner-running">
521- <div class="runner-line">533+ <span class="runner-count"><span class="runner-n">(running_text.as_str())</span>" "<span class="muted">(s(lang, "running", "çalışıyor"))</span></span>
522- <span class="runner-count">(running.as_str())</span>534+ if use_pips {
523- <span class="muted">"/"</span>535+ <span class="runner-pips" role="img" aria-label=(pips_label.as_str())>
524- <button type="button" class="runner-step" data-step="-1" aria-label=(s(lang, "Fewer", "Azalt"))>"−"</button>536+ for pip in pips.iter() {
525- <input type="number" name="value" value=(value) min="1" max="64" step="1" inputmode="numeric" required="required" aria-label=(s(lang, "Concurrency", "Eşzamanlılık")) title=(source_title(lang, source))>537+ <span class=(*pip)></span>
526- <button type="button" class="runner-step" data-step="1" aria-label=(s(lang, "More", "Artır"))>"+"</button>538+ }
527- <button type="submit" class="runner-save">(s(lang, "Save", "Kaydet"))</button>539+ </span>
540+ } else {
541+ <progress class="runner-meter" value=(running_text.as_str()) max=(meter_max.as_str()) aria-label=(s(lang, "Running jobs", "Çalışan işler"))></progress>
542+ }
543+ </div>
544+ <div class="runner-stepper">
545+ <span class="runner-cap muted">(s(lang, "Max", "En çok"))</span>
546+ <div class="runner-pill">
547+ <button type="button" class="runner-step" data-step="-1" aria-label=(s(lang, "Fewer", "Azalt"))>"−"</button>
548+ <input type="number" name="value" value=(value) min="1" max="64" step="1" inputmode="numeric" required="required" aria-label=(s(lang, "Concurrency", "Eşzamanlılık")) title=(source_title(lang, source))>
549+ <button type="button" class="runner-step" data-step="1" aria-label=(s(lang, "More", "Artır"))>"+"</button>
550+ </div>
551+ <button type="submit" class="primary runner-save">(s(lang, "Save", "Kaydet"))</button>
528 if has_override {552 if has_override {
529- <button type="submit" name="reset" value="1" formnovalidate="formnovalidate" title=(s(lang, "Use the runner.toml value", "runner.toml değerini kullan")) aria-label=(s(lang, "Use the runner.toml value", "runner.toml değerini kullan"))>"↺"</button>553+ <button type="submit" name="reset" value="1" class="runner-reset" formnovalidate="formnovalidate" title=(s(lang, "Use the runner.toml value", "runner.toml değerini kullan")) aria-label=(s(lang, "Use the runner.toml value", "runner.toml değerini kullan"))>"↺"</button>
530 }554 }
531 </div>555 </div>
532- <progress class="runner-meter" value=(running.as_str()) max=(meter_max.as_str()) aria-label=(s(lang, "Running jobs", "Çalışan işler"))></progress>
533 </form>556 </form>
534 })557 })
535 }558 }
style/main.scssmodified+162 -75
@@ -5313,26 +5313,22 @@ $ansi-colours: (
5313 }5313 }
5314 }5314 }
5315 5315
5316-// Admin runners: a vertical list, one card row per runner. Four columns: identity (dot, name, labels,5316+// Admin runners: a list, one line per runner. Four columns: identity (dot, name, labels, last seen),
5317-// last seen), load (the jobs meter and the concurrency stepper), version, and the actions menu. The5317+// load (the running pips and the concurrency stepper), version, and the actions menu. The load cell
5318-// load cell is the form that saves the concurrency. Its Save shows only once the value changes5318+// is the form that saves the concurrency. Its Save shows only once the value changes (nav.js sets
5319-// (nav.js sets data-dirty), and only where nav.js has run (html.js), so without JavaScript it stays.5319+// data-dirty), and only where nav.js has run (html.js), so without JavaScript it stays.
5320 .runner-list {5320 .runner-list {
5321- margin: 0 -20px;5321+ margin: 0;
5322 padding: 0;5322 padding: 0;
5323 list-style: none;5323 list-style: none;
5324 }5324 }
5325 5325
5326 .runner-row {5326 .runner-row {
5327 display: grid;5327 display: grid;
5328- grid-template-columns: minmax(180px, 1.4fr) 1fr 1fr auto;5328+ grid-template-columns: minmax(180px, 1.3fr) minmax(260px, 1.4fr) auto auto;
5329 align-items: center;5329 align-items: center;
5330- column-gap: 16px;5330+ column-gap: 28px;
5331- padding: 14px 20px;5331+ padding: 14px 0;
5332-
5333- &:hover {
5334- background: var(--surface-2);
5335- }
5336 5332
5337 > .row-menu {5333 > .row-menu {
5338 justify-self: end;5334 justify-self: end;
@@ -5406,35 +5402,129 @@ $ansi-colours: (
5406 font-family: var(--mono);5402 font-family: var(--mono);
5407 }5403 }
5408 5404
5405+// The load cell: the running status on the left, the concurrency stepper on the right.
5409 .runner-load {5406 .runner-load {
5407+ display: flex;
5408+ align-items: center;
5409+ justify-content: space-between;
5410+ gap: 16px;
5411+ min-width: 0;
5412+ margin: 0;
5413+}
5414+
5415+.runner-running {
5410 display: flex;5416 display: flex;
5411 flex-direction: column;5417 flex-direction: column;
5412 align-items: flex-start;5418 align-items: flex-start;
5413- gap: 4px;5419+ gap: 6px;
5420+ min-width: 0;
5421+}
5422+
5423+.runner-count {
5424+ font-size: 0.875rem;
5425+ white-space: nowrap;
5426+}
5427+
5428+.runner-n {
5429+ color: var(--text);
5430+ font-weight: 600;
5431+ font-variant-numeric: tabular-nums;
5432+}
5433+
5434+// One pip per concurrency slot: accent when a job runs in it, a surface pip with an inset edge when free.
5435+.runner-pips {
5436+ display: inline-flex;
5437+ gap: 3px;
5438+}
5439+
5440+.runner-pip {
5441+ box-sizing: border-box;
5442+ width: 14px;
5443+ height: 6px;
5444+ border-radius: 2px;
5445+ background: var(--surface-2);
5446+ box-shadow: inset 0 0 0 1px var(--border);
5447+
5448+ &.is-on {
5449+ background: var(--accent);
5450+ box-shadow: none;
5451+ }
5452+}
5453+
5454+// The meter, for a concurrency past the pips: running jobs out of the concurrency, 80 by 4 pixels,
5455+// accent fill on a surface track.
5456+progress.runner-meter {
5457+ -webkit-appearance: none;
5458+ appearance: none;
5459+ display: block;
5460+ box-sizing: border-box;
5461+ width: 80px;
5462+ height: 4px;
5414 margin: 0;5463 margin: 0;
5464+ border: 0;
5465+ border-radius: 2px;
5466+ overflow: hidden;
5467+ background: var(--surface-2);
5468+ color: var(--accent);
5469+
5470+ &::-webkit-progress-bar {
5471+ background: var(--surface-2);
5472+ }
5473+
5474+ &::-webkit-progress-value {
5475+ background: var(--accent);
5476+ }
5477+
5478+ &::-moz-progress-bar {
5479+ background: var(--accent);
5480+ }
5481+}
5482+
5483+// The concurrency: a small label, then one joined pill (− value +), then Save and the reset.
5484+.runner-stepper {
5485+ display: flex;
5486+ flex: none;
5487+ align-items: center;
5488+ gap: 8px;
5415 }5489 }
5416 5490
5417 .runner-cap {5491 .runner-cap {
5418 font-size: 0.75rem;5492 font-size: 0.75rem;
5493+ white-space: nowrap;
5419 }5494 }
5420 5495
5421-.runner-line {5496+.runner-pill {
5422- display: flex;5497+ box-sizing: border-box;
5423- flex-wrap: wrap;5498+ display: inline-flex;
5424- align-items: center;5499+ align-items: stretch;
5425- gap: 6px;5500+ height: 28px;
5501+ border: 1px solid var(--border-strong);
5502+ border-radius: var(--radius-md);
5503+ overflow: hidden;
5504+ background: var(--surface);
5426 5505
5427 input[type="number"] {5506 input[type="number"] {
5428 box-sizing: border-box;5507 box-sizing: border-box;
5429- flex: none;5508+ width: 34px;
5430- width: 44px;5509+ height: 100%;
5431- height: var(--control-h);5510+ margin: 0;
5432 padding: 0;5511 padding: 0;
5433- text-align: center;5512+ border: 0;
5513+ border-left: 1px solid var(--border);
5514+ border-right: 1px solid var(--border);
5515+ border-radius: 0;
5516+ background: transparent;
5517+ color: var(--text);
5518+ font-weight: 600;
5434 font-variant-numeric: tabular-nums;5519 font-variant-numeric: tabular-nums;
5520+ text-align: center;
5435 -moz-appearance: textfield;5521 -moz-appearance: textfield;
5436 appearance: textfield;5522 appearance: textfield;
5437 5523
5524+ &:focus-visible {
5525+ outline-offset: -2px;
5526+ }
5527+
5438 &::-webkit-inner-spin-button,5528 &::-webkit-inner-spin-button,
5439 &::-webkit-outer-spin-button {5529 &::-webkit-outer-spin-button {
5440 -webkit-appearance: none;5530 -webkit-appearance: none;
@@ -5442,76 +5532,73 @@ $ansi-colours: (
5442 }5532 }
5443 }5533 }
5444 5534
5445- .runner-count {
5446- font-size: 0.9375rem;
5447- font-variant-numeric: tabular-nums;
5448- }
5449-
5450 .runner-step {5535 .runner-step {
5451 box-sizing: border-box;5536 box-sizing: border-box;
5537+ display: inline-flex;
5538+ align-items: center;
5539+ justify-content: center;
5452 flex: none;5540 flex: none;
5453- width: 32px;5541+ width: 28px;
5454- height: var(--control-h);5542+ min-width: 28px;
5543+ height: 100%;
5455 padding: 0;5544 padding: 0;
5545+ border: 0;
5546+ border-radius: 0;
5547+ background: none;
5548+ color: var(--muted);
5456 font-size: 1rem;5549 font-size: 1rem;
5457 line-height: 1;5550 line-height: 1;
5458- }
5459 5551
5460- .runner-save {5552+ &:hover {
5461- box-sizing: border-box;5553+ background: var(--surface-2);
5462- height: var(--control-h);5554+ color: var(--text);
5463- }5555+ }
5464 5556
5465- button[name="reset"] {5557+ &:focus-visible {
5466- box-sizing: border-box;5558+ outline-offset: -2px;
5467- min-width: var(--control-h);5559+ border-radius: 0;
5468- height: var(--control-h);5560+ }
5469- padding: 0;
5470 }5561 }
5471 }5562 }
5472 5563
5473-html.js form.runner-load[data-dirty-form] .runner-save {5564+.runner-save {
5474- display: none;5565+ box-sizing: border-box;
5475-}5566+ height: 28px;
5476-5567+ padding: 0 10px;
5477-html.js form.runner-load[data-dirty-form][data-dirty] .runner-save {5568+ font-size: 0.8125rem;
5478- display: inline-block;
5479 }5569 }
5480 5570
5481-// The meter: running jobs out of the concurrency, 80 by 4 pixels, accent fill on a surface track.5571+.runner-reset {
5482-progress.runner-meter {
5483- -webkit-appearance: none;
5484- appearance: none;
5485- display: block;
5486 box-sizing: border-box;5572 box-sizing: border-box;
5487- width: 80px;5573+ flex: none;
5488- height: 4px;5574+ width: 28px;
5489- margin: 2px 0 0;5575+ height: 28px;
5576+ padding: 0;
5490 border: 0;5577 border: 0;
5491- border-radius: 2px;5578+ background: none;
5492- overflow: hidden;5579+ color: var(--muted);
5493- background: var(--surface-2);
5494- color: var(--accent);
5495 5580
5496- &::-webkit-progress-bar {5581+ &:hover {
5497 background: var(--surface-2);5582 background: var(--surface-2);
5583+ color: var(--text);
5498 }5584 }
5585+}
5499 5586
5500- &::-webkit-progress-value {5587+html.js form.runner-load[data-dirty-form] .runner-save {
5501- background: var(--accent);5588+ display: none;
5502- }5589+}
5503 5590
5504- &::-moz-progress-bar {5591+html.js form.runner-load[data-dirty-form][data-dirty] .runner-save {
5505- background: var(--accent);5592+ display: inline-block;
5506- }
5507 }5593 }
5508 5594
5509 .runner-version {5595 .runner-version {
5510 display: flex;5596 display: flex;
5511- flex-wrap: wrap;5597+ flex-wrap: nowrap;
5512 align-items: center;5598 align-items: center;
5513 gap: 8px;5599 gap: 8px;
5514 justify-self: start;5600 justify-self: start;
5601+ white-space: nowrap;
5515 }5602 }
5516 5603
5517 .runner-hash {5604 .runner-hash {
@@ -5536,10 +5623,10 @@ progress.runner-meter {
5536 color: var(--ok);5623 color: var(--ok);
5537 }5624 }
5538 5625
5539-// Phone: each runner is two rows. Identity and the menu, then the load and the version.5626+// Phone: identity first, with the version and the menu on its right. The load cell takes the second line.
5540-@media (max-width: 700px) {5627+@media (max-width: 760px) {
5541 .runner-row {5628 .runner-row {
5542- grid-template-columns: minmax(0, 1fr) auto;5629+ grid-template-columns: minmax(0, 1fr) auto auto;
5543 row-gap: 12px;5630 row-gap: 12px;
5544 }5631 }
5545 5632
@@ -5548,20 +5635,20 @@ progress.runner-meter {
5548 grid-row: 1;5635 grid-row: 1;
5549 }5636 }
5550 5637
5551- .runner-row > .row-menu {5638+ .runner-version {
5552 grid-column: 2;5639 grid-column: 2;
5553 grid-row: 1;5640 grid-row: 1;
5641+ justify-self: end;
5554 }5642 }
5555 5643
5556- .runner-load {5644+ .runner-row > .row-menu {
5557- grid-column: 1;5645+ grid-column: 3;
5558- grid-row: 2;5646+ grid-row: 1;
5559 }5647 }
5560 5648
5561- .runner-version {5649+ .runner-load {
5562- grid-column: 2;5650+ grid-column: 1 / -1;
5563 grid-row: 2;5651 grid-row: 2;
5564- justify-self: end;
5565 }5652 }
5566 }5653 }
5567 5654