1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(ui): a block or a job's cancel asks first; every delete and save says it is done

- Block in the Users list asks first: the user is signed out and their
  API tokens are deleted, which unblocking does not bring back. Block
  and Unblock then say what they did.
- Cancel on a job's page and in the job panel asks first, naming the
  job; the button says Cancel the job, apart from the dialog's Cancel.
- Deleting a user or a group, removing a host from the panel or an
  owner from a VM, and deleting an interface, a network filter or a
  secret say so, as the other deletes do.
- Renaming a tag and saving a VM's title and description say so.
This commit is contained in:
catborise 2026-11-21 20:47:26 +03:00
parent 00a44f7621
commit e79817e7db
22 changed files with 247 additions and 39 deletions

View file

@ -33,7 +33,8 @@ class SecretRowTests(TestCase):
self.client.post(self.url, {"create": "", "private": "on", "usage_type": "ceph", "usage": "client.admin",
"value": VALUE})
self.client.post(self.url, {"set_value": "", "uuid": UUID, "value": VALUE})
self.client.post(self.url, {"delete": "", "uuid": UUID})
deleted = self.client.post(self.url, {"delete": "", "uuid": UUID}, follow=True)
self.assertContains(deleted, f"Secret {UUID} deleted")
self.assertEqual(rows(), [
("Secret ceph client.admin: add", True),
(f"Secret {UUID}: set value", True),

View file

@ -1,6 +1,7 @@
from admin.decorators import superuser_only
from computes.models import Compute
from django.contrib import messages
from django.utils.translation import gettext as _
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.views.decorators.debug import sensitive_post_parameters
@ -42,6 +43,7 @@ def secrets(request, compute_id):
elif "delete" in request.POST:
with audit(request, compute, f"Secret {uuid}", "delete"):
conn.delete_secret(uuid)
messages.success(request, _("Secret %(uuid)s deleted") % {"uuid": uuid})
return HttpResponseRedirect(request.get_full_path())
# shown only with their users: a list without them would offer to delete secrets in use