Skip to content
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

fix(bulk_delete_vulnerabilities): pass delete API endpoint Url #262

Merged
merged 3 commits into from
Feb 9, 2025

Conversation

0b3ud
Copy link
Contributor

@0b3ud 0b3ud commented Feb 9, 2025

Fix #260

Bug :

  • When a user clicks on 'Bulk delete vulnerabilities' swal shows a loading alert and nothing happens (even after refreching the page)

Fix details :

  • I added the API endpoint Url to 'bulk delete vulnerabilities' button in vulnerability_tab_content.html and it fixed the issue.
  • It didn't have it before and it was sending the datat to /undefined which doesn't exist (as shown in screenshot down below)
    image

Summary by Sourcery

Bug Fixes:

  • Fixed an issue where clicking "Bulk delete vulnerabilities" did nothing.

…parameter function in the bulk delete button
@0b3ud 0b3ud added the bug Something isn't working label Feb 9, 2025
@0b3ud 0b3ud requested a review from psyray February 9, 2025 00:50
@0b3ud 0b3ud self-assigned this Feb 9, 2025
Copy link
Contributor

sourcery-ai bot commented Feb 9, 2025

Reviewer's Guide by Sourcery

This pull request fixes the bulk delete vulnerabilities feature by adding a missing 'data-url' attribute to the bulk delete button, ensuring the button points to the correct API endpoint. The fix addresses the bug where requests were sent to /undefined, preventing the proper deletion of vulnerabilities.

Sequence diagram for Bulk Delete Vulnerabilities API Call

sequenceDiagram
    actor User
    participant Button as Bulk Delete Button
    participant API as Vulnerability API Endpoint

    User->>Button: Click 'Bulk Delete Vulnerabilities'
    Button->>API: Send POST to /api/action/vulnerability/delete/
    API-->>Button: Return deletion result
    Button-->>User: Display success/failure feedback
Loading

File-Level Changes

Change Details Files
Added the correct API endpoint to the bulk delete vulnerabilities button.
  • Inserted a 'data-url' attribute with the API endpoint '/api/action/vulnerability/delete/' to the button.
  • Updated the HTML in the vulnerability_tab_content template to include the new attribute.
web/templates/base/_items/vulnerability_tab_content.html

Assessment against linked issues

Issue Objective Addressed Explanation
#260 Fix the bulk delete vulnerabilities functionality that was returning a 404 error
#260 Ensure the delete API endpoint URL is correctly specified for bulk delete operation

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@0b3ud 0b3ud linked an issue Feb 9, 2025 that may be closed by this pull request
3 tasks
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @0b3ud - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Fix the typo in the button label from 'Bulk Delete Vulneraties' to 'Bulk Delete Vulnerabilities'.
  • If applicable, consider externalizing the API endpoint URL into a config or constant for easier future updates.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@psyray psyray left a comment

Choose a reason for hiding this comment

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

Use the template function url to refer to the route, not the value hard coded in the template.
And update the typo in the button name, it says vulneraties instead of vulnerabilities

@0b3ud
Copy link
Contributor Author

0b3ud commented Feb 9, 2025

Fixed the typo and used the template function url to refer to the route as required :)
If you see any further issues just let me know

@AnonymousWP AnonymousWP changed the title fix(bulk_delete_vulnerabilities) : pass delete API endpoint Url as a … fix(bulk_delete_vulnerabilities): pass delete API endpoint Url Feb 9, 2025
@AnonymousWP AnonymousWP merged commit 08ce0b2 into release/2.1.1 Feb 9, 2025
5 checks passed
@AnonymousWP AnonymousWP deleted the fix_bulk_del branch February 9, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(ui): bulk delete vulnerabilities no longer work
3 participants