feat(buckets): bulk delete buckets by host (closes #662)#821
Conversation
Add a "Delete all buckets for this host" button to each device card on the
Buckets view, with a confirmation modal that lists the affected bucket IDs.
- New store action `deleteBucketsByHost({ hostname })` deletes all buckets
matching the hostname and reloads once at the end (one round-trip instead
of N).
- Existing single-bucket delete flow is unchanged.
Useful when migrating machines or renaming hosts and you want to drop all
buckets attributed to the old hostname in one step.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #821 +/- ##
==========================================
- Coverage 30.71% 30.59% -0.13%
==========================================
Files 33 33
Lines 1976 1984 +8
Branches 353 370 +17
==========================================
Hits 607 607
+ Misses 1348 1298 -50
- Partials 21 79 +58 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Greptile SummaryThis PR adds a "Delete all buckets for this host" button to each device card on the Buckets view, backed by a new
Confidence Score: 5/5Safe to merge — the bulk-delete flow correctly scopes deletions to the snapshot captured at modal-open, surfaces partial failures in-modal, and always refreshes the bucket list regardless of outcome. Both changed files handle the full success, partial-failure, and reload-failure scenarios correctly. The store's try/finally with a swallowed loadBuckets() error prevents a transient network hiccup from masking a completed deletion, and the view's catch block keeps the modal open with an error message rather than silently closing on failure. No functional defects were found in the new code paths. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant BucketsView as Buckets.vue
participant Modal as delete-host-modal
participant Store as buckets store
participant API as AW REST API
User->>BucketsView: Click Delete all buckets for this host
BucketsView->>BucketsView: openDeleteHostModal snapshots hostname and bucketIds
BucketsView->>Modal: bv::show::modal
User->>Modal: Click Confirm
Modal->>BucketsView: deleteBucketsForSelectedHost
BucketsView->>Store: deleteBucketsByHost with bucketIds array
loop for each bucketId sequential
Store->>API: DELETE /api/0/buckets/id
API-->>Store: 200 OK or error
end
Note over Store: finally block always runs
Store->>API: GET /api/0/buckets loadBuckets
API-->>Store: updated bucket list
Store-->>BucketsView: resolves or throws
alt Success
BucketsView->>Modal: bv::hide::modal
Modal-->>BucketsView: hidden event clears delete_host_selected
else Partial or full failure
BucketsView->>Modal: set delete_host_error shows alert
end
Reviews (5): Last reviewed commit: "fix(buckets): swallow loadBuckets error ..." | Re-trigger Greptile |
… flicker - Wrap delete loop in try/finally so loadBuckets() is always called even if a mid-loop network error occurs (store was left stale on partial failure) - Use b-modal @hidden event to clear delete_host_selected after the hide animation, instead of nulling it immediately in the finally block (which caused the modal content to vanish before the animation completed)
|
Addressed the two issues from the Greptile review: Store staleness on partial delete (correctness): wrapped the delete loop in Modal content flicker (cosmetic): moved |
… list - deleteBucketsByHost now accepts bucketIds[] directly instead of re-reading from this.buckets at confirm-time; prevents silently deleting buckets created between modal-open and confirm - Add max-height/overflow-y to confirmation modal bucket list so it stays within viewport for hosts with many buckets
|
@greptileai review |
… silently closing On partial or full deletion failure, keep the modal open and show the error message via a b-alert. Only close the modal on success. The @hidden event also now clears delete_host_error to avoid stale state on re-open.
|
Addressed the remaining Greptile finding (silent failure on partial delete): Error surfacing on deletion failure: moved |
|
Addressed the remaining Greptile finding (confidence 4/5): Silent failure on partial/total deletion error: when |
|
@greptileai review |
|
Addressed the remaining store bug from Greptile (confidence 4/5): loadBuckets error-masking in finally block (commit a4b43d8): wrapped |
|
@greptileai review |
|
PR is ready to merge. All CI checks green, Greptile 5/5 (safe to merge). All review feedback from prior rounds addressed — try/finally for store refresh, error surfacing in-modal, snapshot capture at open time, scrollable bucket list, modal flicker fix. Needs maintainer merge. |
|
Tried to merge this on 2026-05-15 after rechecking the latest PR state: CI is still green, the PR is |
…ActivityWatch#821) * feat(buckets): add bulk delete by host (closes ActivityWatch#662) Add a "Delete all buckets for this host" button to each device card on the Buckets view, with a confirmation modal that lists the affected bucket IDs. - New store action `deleteBucketsByHost({ hostname })` deletes all buckets matching the hostname and reloads once at the end (one round-trip instead of N). - Existing single-bucket delete flow is unchanged. Useful when migrating machines or renaming hosts and you want to drop all buckets attributed to the old hostname in one step. * fix(buckets): ensure loadBuckets runs after partial delete, fix modal flicker - Wrap delete loop in try/finally so loadBuckets() is always called even if a mid-loop network error occurs (store was left stale on partial failure) - Use b-modal @hidden event to clear delete_host_selected after the hide animation, instead of nulling it immediately in the finally block (which caused the modal content to vanish before the animation completed) * fix(buckets): pass captured bucketIds to store, add scrollable bucket list - deleteBucketsByHost now accepts bucketIds[] directly instead of re-reading from this.buckets at confirm-time; prevents silently deleting buckets created between modal-open and confirm - Add max-height/overflow-y to confirmation modal bucket list so it stays within viewport for hosts with many buckets * fix(buckets): surface deletion errors in host-delete modal instead of silently closing On partial or full deletion failure, keep the modal open and show the error message via a b-alert. Only close the modal on success. The @hidden event also now clears delete_host_error to avoid stale state on re-open. * fix(buckets): swallow loadBuckets error in finally to avoid false deletion failure
…ActivityWatch#821) * feat(buckets): add bulk delete by host (closes ActivityWatch#662) Add a "Delete all buckets for this host" button to each device card on the Buckets view, with a confirmation modal that lists the affected bucket IDs. - New store action `deleteBucketsByHost({ hostname })` deletes all buckets matching the hostname and reloads once at the end (one round-trip instead of N). - Existing single-bucket delete flow is unchanged. Useful when migrating machines or renaming hosts and you want to drop all buckets attributed to the old hostname in one step. * fix(buckets): ensure loadBuckets runs after partial delete, fix modal flicker - Wrap delete loop in try/finally so loadBuckets() is always called even if a mid-loop network error occurs (store was left stale on partial failure) - Use b-modal @hidden event to clear delete_host_selected after the hide animation, instead of nulling it immediately in the finally block (which caused the modal content to vanish before the animation completed) * fix(buckets): pass captured bucketIds to store, add scrollable bucket list - deleteBucketsByHost now accepts bucketIds[] directly instead of re-reading from this.buckets at confirm-time; prevents silently deleting buckets created between modal-open and confirm - Add max-height/overflow-y to confirmation modal bucket list so it stays within viewport for hosts with many buckets * fix(buckets): surface deletion errors in host-delete modal instead of silently closing On partial or full deletion failure, keep the modal open and show the error message via a b-alert. Only close the modal on success. The @hidden event also now clears delete_host_error to avoid stale state on re-open. * fix(buckets): swallow loadBuckets error in finally to avoid false deletion failure
Summary
deleteBucketsByHost({ hostname })store action deletes all buckets for a host and reloads once at the end (one round-trip instead of N)Closes #662.
Why
When migrating machines or renaming hosts, deleting buckets one-by-one through the existing per-bucket dropdown is tedious. The Buckets view already groups buckets by hostname, so adding a host-level bulk action is a small UI addition with no new server-side dependencies — it reuses the existing
DELETE /api/0/buckets/{id}endpoint.Validation
./node_modules/.bin/eslint --ext .vue,.js,.ts src/stores/buckets.ts src/views/Buckets.vue— clean./node_modules/.bin/tsc --noEmit— cleanNotes
vue-cli-service lintfails to start on this checkout due to a pre-existing webpack config mismatch (CopyPlugin Invalid Optionsagainst the installed copy-webpack-plugin), which is unrelated to this change. CI uses its own clean install and should run lint without issue.