-
Notifications
You must be signed in to change notification settings - Fork 1.3k
UI: Add comprehensive domain deletion confirmation dialog (Feature Request #11497) #12380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Conversation
|
@Imvedansh a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
|
@DaanHoogland WDYT? |
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
|
@Imvedansh , I moved it to 4.20 as this is the oldest supported LTS. |
|
@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12380 +/- ##
============================================
- Coverage 17.10% 16.24% -0.86%
- Complexity 13392 13393 +1
============================================
Files 5255 5658 +403
Lines 466415 499171 +32756
Branches 54746 60585 +5839
============================================
+ Hits 79763 81082 +1319
- Misses 377768 409050 +31282
- Partials 8884 9039 +155
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
UI build: ✔️ |
I was working on
Yeah , was thinking same. |
shwstppr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need update for async deleteDomain (try deleting a domain which has an account)
ui/src/views/iam/DomainView.vue
Outdated
| confirmDeleteDomain () { | ||
| const params = { id: this.deleteDomainResource.id } | ||
| api('deleteDomain', params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Imvedansh deleteDomain is an async API. You would mostly always get a 200 response as it would return the jobid. So you'll have to poll that job ID instead showing success immediately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, alrightyy.
I ll shoot changes shortly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification @shwstppr
I’ve updated the UI to treat deleteDomain as an async API by polling the returned jobId using the existing $pollJob helper, consistent with other async actions in the UI.
Success and failure are now shown only after the async job completes.
WDYS?
2af3738 to
3562cd3
Compare
|
@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
Thanks Daan for checking this out Deleting an empty domain works as expected. When a domain contains accounts, users, or sub-domains, the deletion fails because the CloudStack backend does not allow cascading deletion of users or accounts during domain deletion, in order to avoid catastrophic actions. The error shown is therefore correct and comes from the backend async job result. The UI change in this PR does not attempt to change backend deletion semantics. Instead, it focuses on: Correctly handling deleteDomain as an async job . Improving user awareness by clearly showing associated accounts and instances before attempting deletion Providing better verbiage around domain deletion expectations, as requested in #11497 Previously, after an unsuccessful domain deletion, users had to manually navigate through accounts and instances to identify what was still associated with the domain, quite not cool With the current change, the UI presents the list of associated accounts and active/stopped instances upfront, making it easier to clean up the domain by deleting the related accounts first and then retrying the domain deletion. So far this is my understanding , |
|
Ok @Imvedansh , I do not care either way, but as https://cloudstack.staged.apache.org/api/apidocs-4.22/apis/deleteDomain.html states there is a |
Gotcha, |
Just need to add cleanup:true in domainDelete funtion. |
|
Delete dialog needs cleanup options. @Imvedansh I don't think you need to check if all resources are actually cleaned up. That is an existing flag and you just need to make sure API is called with the correct value. |
I remember after adding the flag cleanup true, i tried deleting the domain with running instance ,It took some time and after some, instance and account did got deleted but domain didn't ,didn't think much of it then and assumed this may need testing. |
Implements a confirmation modal for domain deletion that shows detailed impact before proceeding, making it consistent with account deletion
0ae1d89 to
a84c486
Compare
|
@Imvedansh a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
|
@blueorangutan package |
|
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16499 |
|
@shwstppr Are all your concerns answered? |
|
@abh1sar no. |
|
@shwstppr , I think on entering the name you want a deep clean and being able to do a safe/shallow delete should be possible as well. I am not sure what the right ux element would be. A switch could be used as you suggest. (in short; my opinion is of no value) |
The expected behavior of this PR is to allow deletion of a domain along with all associated accounts and sub-domains (including all resources) while showing any Associated accounts and VM in the gui ( Make's it easier for admin to delete the domains as they can see the list of accounts and any running VM's ) --- This domain may contain accounts, users, or sub-domains. All of these must be removed before the domain can be deleted. This action cannot be undone.--- is the current verbiage for the form ,It should be more like All associated accounts WILL BE DELETED If a cleanup flag is added and not checked, the API would simply return an error, and it’s unclear if that would provide a good user experience. Current solution make it very easy to see all the accounts and vm in single container of parent domain and extra check of entering the domain name their removes the scope of deleting the resources by mistake while keeping it simpler to do action. WDYT? |
|
Thanks @Imvedansh. I don't have a suggestion at this point. It would be good if any of the real users or the reporter could have a look at it. If the behaviour is accepted by others, then 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing Summary
Overall Assessment LGTM (with minor observations)
Great work on this PR, @Imvedansh! The domain deletion confirmation dialog is a significant UX improvement. The implementation is solid and handles the key scenarios well.
Test Results
| Test Case | Description | Result |
|---|---|---|
| TC1 | Delete empty domain | PASS |
| TC2 | Delete domain with account (no VMs) | PASS |
| TC3 | Delete domain with mixed VM states | PASS |
| TC4 | Cascading deletion (parent with children) | PASS |
| TC5 | Mass delete (rapid succession) | PASS |
| TC6 | Whitespace handling + navigation | PARTIAL |
What Works Well
- Modal displays accurate information - Account/VM breakdown is correct and helpful
- Input validation - Exact domain name match required; child domain names correctly rejected
- Whitespace handling -
.trim()correctly handles leading/trailing spaces - Async job handling -
$pollJobimplementation works correctly - Cascading deletion -
cleanup=truesuccessfully removes child domains, accounts, VMs, and networks - Mass deletion - Multiple rapid deletions queue and complete without conflicts
- Dynamic UI updates - Domain tree refreshes correctly after each deletion
Observations & Suggestions
1. Navigation Issue (TC6)
When deleting a domain while viewing it, the UI does not navigate away. The detail panel shows stale data for the deleted domain.
- Current behavior: Domain tree updates, but detail panel shows deleted domain
- Expected behavior: Should navigate to
/domainafter deletion - Workaround: Hard browser refresh (F5) fixes it
The code exists but doesn't seem to execute:
if (this.$route.params.id === domain.id) {
this.$router.push({ path: '/domain' })
}2. Warning Message Verbiage (Minor)
Current text: "All of these must be removed before the domain can be deleted."
Since cleanup=true is always passed, the resources are removed automatically. Consider updating to something like:
"All associated accounts, users, VMs, and sub-domains will be permanently deleted. This action cannot be undone."
This better reflects the actual behavior and addresses the concern raised by @shwstppr about accidental deletion.
Detailed Test Execution Report
TC1: Delete Empty Domain
Objective:
Verify that an empty domain (no accounts, no VMs, no sub-domains) can be deleted using the new confirmation dialog.
Test Steps:
- Login to CloudStack UI as admin
- Navigate to Domains section
- Expand ROOT → TestDeleteParent → Click on TestChild3
- Click Delete Domain action button (trash icon) & Observe the confirmation modal displays
- Verify the Account/VM table shows "No Data"
- Verify "Delete domain" button is disabled
- Type
TestChild3in the confirmation input field (try with whitespaces, etc) - Verify "Delete domain" button becomes enabled only on exact match (or exact match with whitespaces at the beginnin/end)
- Click "Delete domain" button
- Verify domain is removed from the tree
Expected Result:
- Modal displays with warning message and empty table
- Delete button disabled until correct domain name is entered
- Domain deletes successfully and is removed from UI
Actual Result:
- Modal displayed correctly with warning: "This domain may contain accounts, users, or sub-domains. All of these must be removed before the domain can be deleted. This action cannot be undone."
- Table showed "No Data" (empty domain)
- Delete button was disabled until domain name was typed
- Domain deleted successfully and removed from tree dynamically
- Note: No success notification displayed after deletion
Test Evidence:
-
Pre-test: TestChild3 existed (ID: 8a64ede9-b598-4be3-b9b9-e6c01b548443)
-
Post-deletion verification:
(admin) 🐱 > list domains listall=true
{
"count": 6,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... },
{ "name": "TestDeleteParent", ... },
{ "name": "TestChild1", "vmtotal": 2, ... },
{ "name": "TestChild2", "vmtotal": 0, ... }
]
}
- TestChild3 no longer present - deletion confirmed
Status: PASS
- domain deletion modal
- domain is deleted and dynamically removed from domains list (left side)
Screencast from 2026-01-27 16-44-44.webm
TC2: Delete Domain with Account, No VMs + Input Validation
Objective:
Verify that a domain containing an account (but no VMs) displays correctly in the confirmation modal, validates input correctly, and deletes successfully with cleanup=true.
Test Steps:
- Navigate to Domains section
- Click on TestChild2 (has testuser2 account, 0 VMs)
- Click Delete Domain action button
- Observe modal displays account in table with VM counts
- Verify "Delete domain" button is disabled
- Type incorrect name → verify button stays disabled
- Type
TestChild2→ verify button becomes enabled - Click "Delete domain" button
- Verify domain and account are deleted via CLI
Expected Result:
- Modal shows testuser2 account with 0/0/0 VM counts
- Input validation prevents deletion until correct name entered
- Domain and associated account deleted successfully (cleanup=true)
Actual Result:
- Modal displayed testuser2 account correctly: Total VMs=0, Running=0, Stopped=0
- Delete button was disabled until correct domain name entered
- Domain deleted successfully
- Account testuser2 also deleted (cleanup=true worked)
- Domain count reduced from 6 to 5
Screencast.from.2026-01-27.16-58-53.webm
- Post-deletion verification:
(admin) 🐱 > list domains listall=true
{
"count": 5,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... },
{ "name": "TestDeleteParent", "vmtotal": 2, ... },
{ "name": "TestChild1", "vmtotal": 2, ... }
]
}
- TestChild2 no longer present
(admin) 🐱 > list accounts domainid=426023be-6fcd-4b20-ad27-b2b64ff79b30 listall=true
🙈 Error: (HTTP 431, error code 4350) Domain id=8 doesn't exist
# Confirms domain and account were deleted
Status: PASS
TC3: Delete Domain with Mixed VM States (cleanup=true)
Objective:
Verify that a domain containing an account with running and stopped VMs displays correct counts in the modal and deletes successfully with cleanup=true (cascading deletion of VMs, networks, and account).
Test Steps:
- Navigate to Domains section
- Click on TestChild1 (has testuser1 account with 2 VMs)
- Click Delete Domain action button
- Observe modal displays account with VM breakdown
- Verify Running/Stopped VM counts are accurate
- Type
TestChild1in confirmation input - Click "Delete domain" button
- Observe success notification
- Verify domain, account, and VMs deleted via CLI
Expected Result:
- Modal shows testuser1 with Total=2, Running=1, Stopped=1
- Domain, account, and all VMs deleted via cleanup=true
- Success notification displayed
Actual Result:
-
Modal correctly displayed: testuser1 | 2 | 1 | 1
-
Success notification appeared upon deletion
-
Domain TestChild1 deleted
-
Account testuser1 deleted
-
Both VMs (testvm1, testvm2) deleted
-
Network resources cleaned up
-
Domain count reduced from 5 to 4
-
VM count reduced from 3 to 1 (only admin's iso-test-vm remains)
-
domain with mixed VM states - displays correctly
- deletion
Screencast.from.2026-01-27.16-58-53.webm
- Post-deletion - Domains:
(admin) 🐱 > list domains listall=true
{
"count": 4,
"domain": [
{ "name": "ROOT", "vmtotal": 1, ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... },
{ "name": "TestDeleteParent", "haschild": false, "vmtotal": 0, ... }
]
}
-
TestChild1 deleted, TestDeleteParent now has no children
-
Post-deletion - VMs:
(admin) 🐱 > list virtualmachines listall=true
{
"count": 1,
"virtualmachine": [
{ "name": "iso-test-vm", "account": "admin", "domain": "ROOT", ... }
]
}
# testvm1 and testvm2 deleted - only admin's VM remains
Status: PASS
TC4: Delete Parent Domain with Children (Cascading Deletion)
Objective:
Verify that deleting a parent domain with child domains triggers cascading deletion of all sub-domains and their associated resources (accounts, users) using cleanup=true.
Test Steps:
- Create test hierarchy: TestDeleteParent → CascadeChild1 (with account), CascadeChild2 (empty)
- Navigate to Domains section in UI
- Click on TestDeleteParent
- Click Delete Domain action button
- Observe modal shows accounts from child domains
- Try typing child domain name (e.g., "CascadeChild1") → verify button stays disabled
- Type
TestDeleteParent→ verify button becomes enabled - Click "Delete domain" button
- Verify all domains and accounts deleted via CLI
Expected Result:
- Modal displays accounts from entire hierarchy
- Only exact parent domain name enables delete button
- Parent and all children deleted with cleanup=true
- All associated accounts deleted
Actual Result:
- Modal correctly displayed cascadeuser account (from child domain CascadeChild1)
- Typing child domain name did NOT enable delete button (correct behavior)
- Only typing exact name "TestDeleteParent" enabled the button
- Cascading deletion successful:
- TestDeleteParent deleted
- CascadeChild1 deleted
- CascadeChild2 deleted
- cascadeuser account deleted
- Domain count reduced from 6 to 3
Test Evidence:
- Pre-deletion structure (6 domains):
- Modal showed:
- Deletion
Screencast.from.2026-01-27.17-14-06.webm
- Post-deletion verification:
(admin) 🐱 > list domains listall=true
{
"count": 3,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... }
]
}
- TestDeleteParent, CascadeChild1, CascadeChild2 all deleted
(admin) 🐱 > list accounts listall=true
{
"count": 3,
"account": [
{ "name": "admin", ... },
{ "name": "baremetal-system-account", ... },
{ "name": "ACSUser", ... }
]
}
- cascadeuser account deleted - only system accounts remain
Status: PASS
Additional Observation:
Input validation correctly rejects child domain names - only the exact parent domain name enables deletion. This prevents accidental deletion of wrong domain.
TC5: Mass Delete - Multiple Domains in Rapid Succession
Objective:
Verify that multiple domains can be deleted in rapid succession without conflicts, errors, or UI issues. Tests async job handling when multiple deletions are triggered quickly.
Test Steps:
- Create 3 test domains: MassDelete1, MassDelete2, MassDelete3 under ROOT
- Refresh UI to display all domains
- Delete MassDelete1: Click → Delete action → type name → confirm
- Immediately delete MassDelete2: Click → Delete action → type name → confirm
- Immediately delete MassDelete3: Click → Delete action → type name → confirm
- Observe UI behavior during rapid deletions
- Verify all domains deleted via CLI
Expected Result:
- All 3 domains delete without errors
- Async jobs queue and complete properly
- UI updates dynamically after each deletion
- No conflicts between concurrent delete operations
Actual Result:
-
All 3 domains (MassDelete1, MassDelete2, MassDelete3) deleted successfully
-
No UI lag or delays observed
-
No error messages or conflicts
-
Domain tree updated dynamically after each deletion
-
Async jobs handled properly without interference
-
Domain count reduced from 6 to 3
-
Pre-deletion (6 domains):
(admin) 🐱 > list domains listall=true
{
"count": 6,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... },
{ "name": "MassDelete1", "id": "b77d9d7e-20ef-4d52-a1e0-0729a30e8829", ... },
{ "name": "MassDelete2", "id": "93b278bd-ea8a-41f4-a7a4-05a1688fa7e5", ... },
{ "name": "MassDelete3", "id": "9a6a17ad-993c-4ac7-bad2-f09909c97880", ... }
]
}
- Post-deletion (3 domains):
(admin) 🐱 > list domains listall=true
{
"count": 3,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... }
]
}
- All MassDelete domains successfully removed
Screencast.from.2026-01-27.17-21-09.webm
Status: PASS
TC6: Whitespace Handling + Delete While Viewing Domain
Objective:
Verify that (1) domain name input correctly handles leading/trailing whitespace, and (2) UI navigates away when deleting a domain while viewing it.
Test Steps:
- Create WhitespaceTest domain under ROOT
- Navigate to Domains section and click on WhitespaceTest
- Click Delete Domain action button
- Type
WhitespaceTest(with leading and trailing spaces) - Observe if Delete button becomes enabled
- Click "Delete domain" button
- Observe if UI navigates away from deleted domain
- Click UI Refresh button
- Perform hard browser refresh (F5)
- Verify domain deleted via CLI
Expected Result:
- Whitespace trimmed - button should enable despite extra spaces
- After deletion, UI should navigate away to /domain (domains list)
- Detail panel should not show stale data
Actual Result:
- Whitespace handling: PASS - Button enabled with spaces (trim() working correctly)
- X Navigation after deletion: FAIL - UI did not navigate away
- X Detail panel showed stale data for deleted domain
- X UI Refresh button did not clear stale view
- Hard browser refresh (F5) correctly navigated to ROOT
- Domain tree correctly removed WhitespaceTest from list
- Domain deletion successful (confirmed via CLI)
Test Evidence:
- Whitespace input accepted - button enabled with " WhitespaceTest "
- Code correctly uses .trim() for comparison:
- canDelete () { return this.confirmText.trim() === this.domain.name.trim() }
-> After deletion:
-
Domain tree: WhitespaceTest removed
-
Detail panel: Still showing WhitespaceTest (stale)
-
URL: Still on deleted domain's route
-
UI Refresh: No effect
-
Hard refresh (F5): Navigates to ROOT
-
Post-deletion verification:
(admin) 🐱 > list domains listall=true
{
"count": 3,
"domain": [
{ "name": "ROOT", ... },
{ "name": "Test_With_Subdomain", ... },
{ "name": "Test_Sub_1", ... }
]
}
- WhitespaceTest successfully deleted but right panel not refreshed even via Refresh button (needs hard bewser refresh)
Screencast.from.2026-01-27.17-29-27.webm
Status: PARTIAL PASS (Whitespace: PASS, Navigation: FAIL - BUG)
|
@Imvedansh , can you look at @RosiKyu ’s last test case? |




Implements a confirmation modal for domain deletion that shows detailed impact before proceeding, making it consistent with account deletion
Description
This PR implements a comprehensive domain deletion confirmation dialog, making the domain deletion process consistent with account deletion and providing better warnings to users about the impact of their actions.
Fixes #11497
New Component: DomainDeleteConfirm
listAccountsandlistVirtualMachinesAPIsTypes of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?