Skip to content

[scanner] fix: add user feedback for silent actions#21291

Merged
clubanderson merged 3 commits into
mainfrom
scanner/fix-21288
Jul 19, 2026
Merged

[scanner] fix: add user feedback for silent actions#21291
clubanderson merged 3 commits into
mainfrom
scanner/fix-21288

Conversation

@clubanderson

Copy link
Copy Markdown
Collaborator

Fixes #21288

Add toast notifications to delete operations that previously gave no user feedback:

  • TeamManagement: show success/error toast after team deletion
  • LocalClustersSection: show success/error toast after local cluster deletion
  • CardFactoryModal: show success toast after custom card deletion
  • Add i18n keys for all new toast messages in en/common.json

All messages use t() from react-i18next with new keys in the en/common.json locale file. The existing useToast / showToast utility already present in the codebase is used — no new libraries introduced.

Locations not changed (already have feedback or are not user-facing):

  • GPUReservationsTab props (parent GPUReservations.tsx already calls showToast)
  • ChunkErrorBoundary (sessionStorage.removeItem — internal, not a user action)
  • handleDeleteVCluster (covered by existing VClusterActionBanner inline feedback)
  • Test file TeamDetail.test.tsx (test-only, no production change needed)

Add toast notifications after delete operations that previously gave no
user feedback:
- TeamManagement: show success/error toast after team deletion
- LocalClustersSection: show success/error toast after local cluster deletion
- CardFactoryModal: show success toast after custom card deletion
- Add i18n keys for all new toast messages in en/common.json

Fixes #21288

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: GitHub Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 19, 2026 17:12
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jul 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 619cd8d
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a5d39a1c7978200081a227f
😎 Deploy Preview https://deploy-preview-21291.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🐝 Hi @clubanderson! I'm kubestellar-hive[bot], an automation bot for this repo.

Trusted users — org members and contributors with write access — can mention @kubestellar-hive in a comment to trigger repo automation.
On issues, that mention queues an automated fix attempt. On pull requests, it records extra context for existing automation.
This is not an interactive Q&A bot, so mentions should be treated as requests for automation rather than a conversation.

Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Check

All new source files in this PR have corresponding test files.

Checked web/src/hooks/ and web/src/components/ against origin/main.

@github-actions

Copy link
Copy Markdown
Contributor

♿ Accessibility Audit (WCAG 2.1 AA)

✅ No WCAG 2.1 AA violations detected in audited routes.


Powered by axe-core. Target: WCAG 2.1 AA compliance.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds user-visible toast notifications for destructive delete actions that previously completed silently, aligning UI feedback with the existing useToast utility and i18n conventions.

Changes:

  • Team deletion now shows success/error toast based on deleteTeam() outcome.
  • Local cluster deletion now shows success/error toast based on deleteCluster() outcome (including unexpected-throw fallback).
  • Custom card deletion now shows a toast after deletion, with new i18n keys added to en/common.json.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
web/src/pages/TeamManagement.tsx Adds useToast + t() usage to provide success/error feedback after team deletion.
web/src/components/settings/sections/LocalClustersSection.tsx Adds useToast + translated success/error toasts for local cluster deletion results.
web/src/components/dashboard/CardFactoryModal.tsx Shows a toast after custom card deletion (but currently doesn’t validate deletion success).
web/src/locales/en/common.json Adds new i18n strings for the delete-operation toasts.

Comment on lines 63 to 67
const handleDelete = (id: string) => {
deleteDynamicCard(id)
setExistingCards(getAllDynamicCards())
showToast(t('dashboard.cardFactory.deleteSuccess'), 'success')
}
Comment on lines +1609 to +1610
"invalidJsonData": "Invalid JSON data.",
"deleteSuccess": "Card deleted"

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[quality] Review — return-type contracts verified; three real concerns (comment mode; self-approve blocked)

Good direction — the three silent delete paths get user-visible feedback. I verified the two success branches against the current hooks:

  • useTeams.deleteTeam returns Promise<boolean>true on 200 or demo mode, false on catch. if (success) is correct.
  • useLocalClusterTools.deleteCluster returns Promise<boolean>true on 200/demo, false when disconnected. if (success) is correct.

So the core wiring is sound. Concerns:

1. CardFactoryModal.handleDelete — no failure path (blocking-ish)

const handleDelete = (id: string) => {
  deleteDynamicCard(id)
  setExistingCards(getAllDynamicCards())
  showToast(t('dashboard.cardFactory.deleteSuccess'), 'success')
}

Unlike the other two, this synchronously assumes success. deleteDynamicCard presumably wraps IDB / localStorage writes, either of which can throw (QuotaExceededError, IDB AbortError, private-browsing SecurityError). If it throws, the exception propagates unhandled and the user sees no toast at all. Wrap:

const handleDelete = (id: string) => {
  try {
    deleteDynamicCard(id)
    setExistingCards(getAllDynamicCards())
    showToast(t('dashboard.cardFactory.deleteSuccess'), 'success')
  } catch (e) {
    showToast(t('dashboard.cardFactory.deleteError'), 'error')
    logger.error('[CardFactory] Failed to delete card:', e)
  }
}

Add matching deleteError i18n key (currently only deleteSuccess is added).

2. useToast requires provider — verify wiring for TeamManagementPage

The useToast() hook typically requires a <ToastProvider> ancestor in the tree. If TeamManagementPage is rendered by a route that isn't wrapped, useToast() throws at mount, breaking the entire page. LocalClustersSection (Settings) and CardFactoryModal (dashboard) probably work because those trees already have provider wiring, but TeamManagement is a page-level route.

Verify: rg -l 'ToastProvider' web/src and confirm the app root/route wrapper mounts it above <TeamManagementPage />. If not, this PR introduces a mount-time crash on the teams page.

3. i18n key placement scattered across en/common.json

The new keys land in three sections: settings.localClusters.* (line ~969), dashboard.cardFactory.* (line ~1604), and teams.* (line ~5515). All are correctly nested by feature — that's good. But the dashboard.cardFactory section only adds deleteSuccess, no deleteError (see concern #1). And there's no en-locale-only PR review of the diff: pluralization variants (_one/_other) aren't needed here since neither string has count interpolation, so that's fine.

Non-blocking observations

  • No tests added. Toast-showing is often skipped for unit testing because it's UI wiring, but a simple render(<TeamManagementPage />) + spy on useToast mock would lock the success/error branches. Follow-up.
  • LocalClustersSection try/catch is defensive. Good — the inner if (success) catches deleteCluster's handled errors (returns false), the outer catch catches unexpected throws (which the old comment said don't happen but you're defending against anyway). Belt-and-suspenders.
  • Message text: "Failed to delete team" doesn't include the team name, unlike the cluster message "Failed to delete cluster \"{{name}}\"". Minor UX inconsistency — worth passing the team name too.

Bead filed. Not merging.


Filed by quality agent (ACMM L4/L6 — full mode)

Scanner and others added 2 commits July 19, 2026 15:57
Wrap direct hook calls in renderHook() from @testing-library/react
and access results via result.current to fix 'Invalid hook call'
vitest failure in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Scanner <scanner@kubestellar.io>
@clubanderson
clubanderson merged commit be083b3 into main Jul 19, 2026
30 of 33 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-21288 branch July 19, 2026 20:55
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

⏹️ Post-Merge Verification: cancelled

Commit: be083b30e239e2ee8802e9d8fefe2d8ceb54a2bf
Specs run: ``
Report: https://github.com/kubestellar/console/actions/runs/29703412686

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit be083b30e239e2ee8802e9d8fefe2d8ceb54a2bf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tier/2-standard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Auto-QA] Missing user feedback on actions

3 participants