(refactor) Unify run progress panels
Use a shared Run Progress presentation for dry-runs and normal backup runs so live run feedback is consistent across run types. Keep mode-specific metrics while aligning status, mode, log, and warning layout. Refs #52
This commit is contained in:
@@ -1513,7 +1513,8 @@ class ViewTests(TestCase):
|
||||
self.assertContains(response, "--archive")
|
||||
self.assertContains(response, "Rsync Log")
|
||||
self.assertContains(response, "sending incremental file list")
|
||||
self.assertContains(response, "Dry Run Summary")
|
||||
self.assertContains(response, "Run Progress")
|
||||
self.assertContains(response, "dry run")
|
||||
self.assertContains(response, "Files Seen")
|
||||
self.assertContains(response, "Would Transfer")
|
||||
self.assertContains(response, "Transfer Estimate")
|
||||
@@ -1563,7 +1564,8 @@ class ViewTests(TestCase):
|
||||
response = self.client.get(reverse("run_detail", args=[run.id]))
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "Dry Run Summary")
|
||||
self.assertContains(response, "Run Progress")
|
||||
self.assertContains(response, "dry run")
|
||||
self.assertContains(response, "failed")
|
||||
self.assertContains(response, "Files Seen")
|
||||
self.assertContains(response, "25")
|
||||
@@ -1749,6 +1751,8 @@ class ViewTests(TestCase):
|
||||
self.assertContains(response, f'data-refresh-url="{reverse("run_detail_live", args=[run.id])}"', html=False)
|
||||
self.assertContains(response, 'data-refresh-interval="5000"', html=False)
|
||||
self.assertContains(response, 'data-refresh-active="true"', html=False)
|
||||
self.assertContains(response, "Live Updates")
|
||||
self.assertContains(response, "Pause refresh")
|
||||
|
||||
def test_run_detail_live_returns_partial_for_active_run(self) -> None:
|
||||
self.client.force_login(self.staff_user)
|
||||
@@ -1767,6 +1771,45 @@ class ViewTests(TestCase):
|
||||
self.assertContains(response, "sending incremental file list")
|
||||
self.assertNotContains(response, "<html", html=False)
|
||||
|
||||
def test_run_detail_live_shows_progress_for_running_real_run(self) -> None:
|
||||
self.client.force_login(self.staff_user)
|
||||
host = HostConfig.objects.create(host="web-01", address="web-01.example.test")
|
||||
with TemporaryDirectory() as tmp:
|
||||
snapshot_path = Path(tmp) / "backups" / host.host / ".incomplete" / "20260523-010000Z__ABCDEFGH"
|
||||
data_path = snapshot_path / "data"
|
||||
log_path = snapshot_path / "meta" / "rsync.log"
|
||||
data_path.mkdir(parents=True)
|
||||
log_path.parent.mkdir(parents=True)
|
||||
(data_path / "payload.txt").write_text("payload", encoding="utf-8")
|
||||
log_path.write_text("sending incremental file list\npayload.txt\n", encoding="utf-8")
|
||||
run = BackupRun.objects.create(
|
||||
host=host,
|
||||
status=BackupRun.Status.RUNNING,
|
||||
snapshot_path=str(snapshot_path),
|
||||
result={
|
||||
"requested": {"dry_run": False},
|
||||
"execution": {
|
||||
"phase": "rsync",
|
||||
"snapshot": str(snapshot_path),
|
||||
"log": str(log_path),
|
||||
"heartbeat_at": "2026-05-23T01:00:00+02:00",
|
||||
},
|
||||
"rsync": {"pid": 1234, "pgid": 1234, "command": ["rsync"]},
|
||||
},
|
||||
)
|
||||
|
||||
response = self.client.get(reverse("run_detail_live", args=[run.id]))
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "Run Progress")
|
||||
self.assertContains(response, "backup")
|
||||
self.assertContains(response, "rsync")
|
||||
self.assertContains(response, "1234")
|
||||
self.assertContains(response, "Data Files")
|
||||
self.assertContains(response, "Open full rsync log")
|
||||
self.assertContains(response, "payload.txt")
|
||||
self.assertContains(response, "sending incremental file list")
|
||||
|
||||
def test_run_detail_live_stops_refresh_for_terminal_run(self) -> None:
|
||||
self.client.force_login(self.staff_user)
|
||||
host = HostConfig.objects.create(host="web-01", address="web-01.example.test")
|
||||
|
||||
Reference in New Issue
Block a user