From b256147d28114131f00a59a946dfdcaa6ddccee3 Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Tue, 18 Aug 2026 03:19:07 +0000 Subject: [PATCH] Refine task form controls --- python-tools/static/style.css | 42 ++++++++++++++++++++----------- python-tools/templates/index.html | 17 ++++++++++--- python-tools/tests/test_web.py | 1 + 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/python-tools/static/style.css b/python-tools/static/style.css index f373021..e4e3523 100644 --- a/python-tools/static/style.css +++ b/python-tools/static/style.css @@ -61,15 +61,18 @@ a { align-items: end; display: grid; gap: .75rem; - grid-template-columns: repeat(5, minmax(0, 1fr)) auto; + grid-template-columns: minmax(20rem, 1fr) auto; min-width: 0; } -.task-input { - margin: 0; +.task-options { + display: grid; + gap: .75rem; min-width: 0; } +.task-input { margin: 0; } + .task-input label, .task-input fieldset label { display: block; @@ -110,22 +113,31 @@ button { } .task-action { - align-items: stretch; - border-left: 1px solid color-mix(in srgb, currentColor 15%, transparent); - display: flex; - gap: .4rem; - grid-column: -1; - grid-row: 1; - margin-left: .25rem; - padding-left: .75rem; + justify-self: end; } -.task-action select, -.task-action button { +.split-button { + display: inline-flex; +} + +.split-button select, +.split-button button, +.task-action > button { margin: 0; white-space: nowrap; } +.split-button select { + border-bottom-right-radius: 0; + border-right: 0; + border-top-right-radius: 0; +} + +.split-button button { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} + .visually-hidden { height: 1px; margin: -1px; @@ -179,11 +191,11 @@ button:disabled { @media (max-width: 42rem) { .task-form { - grid-template-columns: minmax(0, 1fr) auto; + grid-template-columns: 1fr; } .task-action { - grid-column: 2; + justify-self: start; } } diff --git a/python-tools/templates/index.html b/python-tools/templates/index.html index 4ba6944..d919028 100644 --- a/python-tools/templates/index.html +++ b/python-tools/templates/index.html @@ -40,6 +40,7 @@
{% set values = form_values.get(task.id, {}) %} {% set errors = input_errors.get(task.id, {}) %} +
{% for field in task.inputs %} {% if not task.execution or field.name != task.execution.field.name %}
@@ -88,8 +89,10 @@
{% endif %} {% endfor %} +
{% if task.execution %} +
{% set execution = task.execution.field %} {% set selected = values.get(execution.name, execution.default) %} @@ -98,11 +101,17 @@ {% endfor %} + +
+ {% else %} + {% endif %} -
{% if task.wait_for_result %}

{% endif %}
diff --git a/python-tools/tests/test_web.py b/python-tools/tests/test_web.py index c8d0e28..d1e47d2 100644 --- a/python-tools/tests/test_web.py +++ b/python-tools/tests/test_web.py @@ -231,6 +231,7 @@ print(Path(os.environ["SERVER_MAINTENANCE_INPUT"]).read_text()) assert b"Report only" in page.data assert b"Apply changes" in page.data assert b"data-execution-mode" in page.data + assert b'class="split-button"' in page.data response = client.post("/tasks/examples/migrate.py/run") run_id = int(response.headers["Location"].rsplit("/", 1)[1]) deadline = time.monotonic() + 3