feat(hosts): a host's page stays short — Docker folds past the busiest, monitors add on their own form, agent actions under Manage (#5276, #5277, #5278)
Docker panel (#5276): problems first, then the 8 busiest running containers by CPU; the other running and the stopped fold behind one "+N more running · M stopped" line. Containers that are not swarm tasks read the way the Docker page reads them: CI jobs as "CI: workflow · job", buildx builders as "BuildKit builder · name". Monitors card (#5277): the edit/delete icon buttons and the inline add form are gone. Each row links to its monitor's page; "Add monitor" opens the add form filed under this host, starting from its address, with the host in its breadcrumbs and Cancel back to it. Agent card (#5278): Full metrics stays in view; Update, Rotate token, Unregister agent (was "Remove") and Re-provision sit under "Manage agent". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,11 +88,21 @@ async def add_monitor():
|
||||
|
||||
|
||||
async def _new_form(form, mtype: str, error: str | None = None) -> str:
|
||||
"""The add form, holding what was typed when `error` sends it back."""
|
||||
"""The add form, holding what was typed when `error` sends it back. Opened
|
||||
from a host's page (host_id), it files the monitor under that host and
|
||||
starts from the host's address."""
|
||||
values = {k: form.get(k, "") for k in ("name", "target", "host_id")}
|
||||
values["check_interval_seconds"] = form.get("check_interval_seconds", 0)
|
||||
host = None
|
||||
if values["host_id"]:
|
||||
async with current_app.db_sessionmaker() as db:
|
||||
host = await db.get(Host, values["host_id"])
|
||||
if host is None:
|
||||
values["host_id"] = ""
|
||||
elif not values["target"]:
|
||||
values["target"] = host.address or host.name
|
||||
return await render_template(
|
||||
"monitors/form.html", monitor=None, values=values,
|
||||
"monitors/form.html", monitor=None, values=values, host=host,
|
||||
mtype=mtype if mtype in MONITOR_TYPE_VALUES else MonitorType.icmp.value,
|
||||
config=_form_opts(form, mtype) if error and mtype in MONITOR_TYPE_VALUES else {},
|
||||
types=list(MonitorType), error=error,
|
||||
|
||||
Reference in New Issue
Block a user