Share live runs table between dashboard and runs
This commit is contained in:
parent
c04efeb189
commit
f3f4badaa2
5 changed files with 159 additions and 181 deletions
|
|
@ -25,6 +25,7 @@ from repub.model import (
|
|||
load_settings_form,
|
||||
save_setting,
|
||||
)
|
||||
from repub.pages import dashboard_page_with_data
|
||||
from repub.pages.runs import runs_page
|
||||
from repub.pages.sources import sources_page
|
||||
from repub.web import (
|
||||
|
|
@ -471,7 +472,7 @@ def test_dashboard_post_serves_morph_component() -> None:
|
|||
assert b"id: " in chunk
|
||||
assert b'<main id="morph"' in chunk
|
||||
assert b"Operational snapshot" in chunk
|
||||
assert b"Running executions" in chunk
|
||||
assert b"Running jobs" in chunk
|
||||
await connection.disconnect()
|
||||
|
||||
asyncio.run(run())
|
||||
|
|
@ -572,6 +573,8 @@ def test_render_stream_stops_when_shutdown_is_requested() -> None:
|
|||
await stream.aclose()
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_render_dashboard_shows_dashboard_information_architecture(
|
||||
monkeypatch, tmp_path: Path
|
||||
) -> None:
|
||||
|
|
@ -583,7 +586,7 @@ def test_render_dashboard_shows_dashboard_information_architecture(
|
|||
body = str(await render_dashboard(app))
|
||||
|
||||
assert "Operational snapshot" in body
|
||||
assert "Running executions" in body
|
||||
assert "Running jobs" in body
|
||||
assert "Published feeds" in body
|
||||
assert 'href="/sources"' in body
|
||||
assert 'href="/runs"' in body
|
||||
|
|
@ -602,12 +605,75 @@ def test_render_dashboard_shows_empty_state_rows(monkeypatch, tmp_path: Path) ->
|
|||
app = create_app()
|
||||
body = str(await render_dashboard(app))
|
||||
|
||||
assert "No job executions are running." in body
|
||||
assert "No jobs are running or queued." in body
|
||||
assert "No feeds have been published yet." in body
|
||||
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
def test_dashboard_running_table_matches_runs_page_live_table_markup() -> None:
|
||||
running_executions = (
|
||||
{
|
||||
"source": "Running source",
|
||||
"slug": "running-source",
|
||||
"job_id": 1,
|
||||
"execution_id": 11,
|
||||
"started_at": "2 minutes ago",
|
||||
"started_at_iso": "2026-03-30T12:00:00+00:00",
|
||||
"duration": "00:00:10",
|
||||
"runtime": "running for 10s",
|
||||
"status": "Running",
|
||||
"stats": "1 requests • 1 items • 1 byte",
|
||||
"worker": "streaming stats from worker",
|
||||
"log_href": "/job/1/execution/11/logs",
|
||||
"cancel_label": "Stop",
|
||||
"cancel_post_path": "/actions/executions/11/cancel",
|
||||
},
|
||||
)
|
||||
queued_executions = (
|
||||
{
|
||||
"source": "Queued source",
|
||||
"slug": "queued-source",
|
||||
"job_id": 2,
|
||||
"execution_id": 22,
|
||||
"queued_at": "2 minutes ago",
|
||||
"queued_at_iso": "2026-03-30T12:28:00+00:00",
|
||||
"queue_position": 1,
|
||||
"status": "Queued",
|
||||
"status_tone": "idle",
|
||||
"run_label": "Queued",
|
||||
"run_disabled": True,
|
||||
"run_post_path": "/actions/jobs/2/run-now",
|
||||
"cancel_post_path": "/actions/queued-executions/22/cancel",
|
||||
"move_up_disabled": True,
|
||||
"move_up_post_path": None,
|
||||
"move_down_disabled": True,
|
||||
"move_down_post_path": None,
|
||||
},
|
||||
)
|
||||
runs_body = str(
|
||||
runs_page(
|
||||
running_executions=running_executions,
|
||||
queued_executions=queued_executions,
|
||||
)
|
||||
)
|
||||
dashboard_body = str(
|
||||
dashboard_page_with_data(
|
||||
running_executions=running_executions,
|
||||
queued_executions=queued_executions,
|
||||
)
|
||||
)
|
||||
|
||||
assert "Running jobs" in dashboard_body
|
||||
assert "Running executions" not in dashboard_body
|
||||
assert "Running source" in dashboard_body
|
||||
assert "running-source" in dashboard_body
|
||||
assert "queued-source" in dashboard_body
|
||||
assert "bg-sky-100 text-sky-800" in dashboard_body
|
||||
assert "/job/1/execution/11/logs" in dashboard_body
|
||||
assert runs_body.count(">State<") >= 1
|
||||
|
||||
|
||||
def test_load_dashboard_view_measures_log_artifact_path(
|
||||
monkeypatch, tmp_path: Path
|
||||
) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue