From 1604f0f6f4289d1473d3d69427de03b8ff645bb4 Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Thu, 21 May 2026 14:17:07 +0200 Subject: [PATCH] (ui) Clarify destructive action flows Make retention apply, incomplete cleanup, and SSH key deletion visibly destructive with warning copy, danger styling, and consistent cancel actions while keeping the existing confirmation requirements intact. Refs #25 --- .../pobsync_backend/retention_plan.html | 20 ++++++++++++++----- .../pobsync_backend/ssh_credential_form.html | 1 + src/pobsync_backend/tests/test_views.py | 7 +++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/pobsync_backend/templates/pobsync_backend/retention_plan.html b/src/pobsync_backend/templates/pobsync_backend/retention_plan.html index c1547b8..02fd800 100644 --- a/src/pobsync_backend/templates/pobsync_backend/retention_plan.html +++ b/src/pobsync_backend/templates/pobsync_backend/retention_plan.html @@ -104,8 +104,12 @@ {% if plan.delete %} -
+

Apply Retention

+

+ This permanently deletes the snapshot directories listed in Would Delete. Confirm the host and delete count + before applying the plan. +

{% csrf_token %} {{ apply_form.non_field_errors }} @@ -138,8 +142,9 @@
{{ apply_form.confirm_delete_count.help_text }}
-
- +
+ + Cancel
@@ -200,6 +205,10 @@

Cleanup Incomplete Snapshots

+

+ This deletes only incomplete snapshot directories and their tracking records. Successful manual and scheduled + snapshots are not touched. +

{% csrf_token %} {{ incomplete_cleanup_form.non_field_errors }} @@ -225,8 +234,9 @@
{{ incomplete_cleanup_form.confirm_delete_count.help_text }}
-
- +
+ + Cancel
diff --git a/src/pobsync_backend/templates/pobsync_backend/ssh_credential_form.html b/src/pobsync_backend/templates/pobsync_backend/ssh_credential_form.html index 0cdf441..f0bbd6f 100644 --- a/src/pobsync_backend/templates/pobsync_backend/ssh_credential_form.html +++ b/src/pobsync_backend/templates/pobsync_backend/ssh_credential_form.html @@ -67,6 +67,7 @@
+ Cancel
diff --git a/src/pobsync_backend/tests/test_views.py b/src/pobsync_backend/tests/test_views.py index 76ebdc6..5099734 100644 --- a/src/pobsync_backend/tests/test_views.py +++ b/src/pobsync_backend/tests/test_views.py @@ -554,6 +554,8 @@ class ViewTests(TestCase): self.assertEqual(response.status_code, 200) self.assertContains(response, "Cancel") self.assertContains(response, reverse("ssh_credentials")) + self.assertContains(edit_response, "Delete SSH key") + self.assertContains(edit_response, 'class="danger"', html=False) def test_ssh_credentials_view_generates_filesystem_key(self) -> None: self.client.force_login(self.staff_user) @@ -1835,6 +1837,9 @@ class ViewTests(TestCase): self.assertNotContains(response, "
Source
", html=True) self.assertContains(response, "Confirm delete count") self.assertContains(response, "Type 1 to confirm the current number of planned deletions.") + self.assertContains(response, "This permanently deletes the snapshot directories listed in Would Delete.") + self.assertContains(response, 'class="danger"', html=False) + self.assertContains(response, "Cancel") def test_retention_plan_warns_when_scheduled_prune_limit_is_exceeded(self) -> None: self.client.force_login(self.staff_user) @@ -1910,6 +1915,8 @@ class ViewTests(TestCase): self.assertContains(response, "excluded from retention cleanup") self.assertContains(response, "Delete incomplete snapshots") self.assertContains(response, "Type 1 to confirm the current number of incomplete snapshots.") + self.assertContains(response, "This deletes only incomplete snapshot directories") + self.assertContains(response, 'class="danger"', html=False) def test_incomplete_cleanup_deletes_incomplete_snapshot_after_confirmation(self) -> None: self.client.force_login(self.staff_user)