Skip to content

fixed: Replaced Scans alert() failures with toast feedback#626

Open
pranavv2707 wants to merge 5 commits into
utksh1:mainfrom
pranavv2707:main
Open

fixed: Replaced Scans alert() failures with toast feedback#626
pranavv2707 wants to merge 5 commits into
utksh1:mainfrom
pranavv2707:main

Conversation

@pranavv2707
Copy link
Copy Markdown

@pranavv2707 pranavv2707 commented Jun 6, 2026

Description

Replaced alert() dialogs in the Scans page destructive-action failure paths with accessible toast notifications using the existing ToastContext. Also adds test coverage for all three failure paths:

  • Delete single task — clicking "Delete_Record" on one scan and confirming
  • Bulk delete — selecting multiple scans and clicking "Prune_Selected_Records"
  • Clear all — clicking "Purge_All_Records" which wipes everything

Related Issues

Closes issue number #469

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Unit tests — 5 new tests in Scans.failures.test.tsx:

  • deleteTask failure shows error toast and keeps task in list
  • bulkDeleteTasks failure shows error toast and keeps tasks in list
  • clearAllTasks failure shows error toast

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Issues Fixed

  1. The Scans page was using browser alert() dialogs for delete and clear-history failure paths, which block the page, cannot be styled, and are inaccessible to screen readers.
    • Replaced all alert() calls in handleTaskDelete, handleClearAll, and handleBulkDelete failure paths with addToast() from the existing ToastContext.
    • Error toasts use role="alert" so screen readers announce them automatically.
    • Console logging kept for diagnostics.

Tests Added

  • frontend/testing/unit/pages/Scans.failures.test.tsx — 5 new tests covering:
    • deleteTask failure shows error toast and keeps task in list
    • bulkDeleteTasks failure shows error toast and keeps tasks in list
    • clearAllTasks failure shows error toast

How to Test

  1. Run cd frontend && npm run test — all 5 new tests should pass.
  2. Run npm run build — build should complete with no errors.
  3. Optionally, run the frontend locally, open the Scans page, and trigger a delete while the backend is stopped — an error toast should appear instead of a browser alert popup.

Comments:

The backend-lint failure (F821 undefined name db in workflows.py) might be a pre-existing issue, not because of this PR.
This change only modifies frontend/src/pages/Scans.tsx and frontend/testing/unit/pages/Scans.failures.test.tsx.
The ToolConfigTimeout max value mismatch is also pre-existing.
I apologise for the large number of commits.

Screenshots for checks

Screenshot 2026-06-06 at 11 06 34

Description: The screenshot shows the passing of all 5 tests.

Screenshot 2026-06-06 at 11 07 46

Description: The screenshot shows the successful building after the running of the tests, generating no warnings.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants