Clear the tool coverage status for a new scanner

What does this MR do and why?

Clear the tool coverage status for a new scanner

Emit a null status from the tool coverage card's scanner dropdown in
tool_coverage_card.vue, so picking a different scanner drops the status
with it. Picking SAST while DAST was set to enabled used to produce SAST
enabled, a filter nobody chose. The card contributes no query variables
for a null status. Return early for the scanner already selected, so
reopening the dropdown and picking the same entry does nothing rather
than clearing the status.

Changelog: fixed
EE: true

References

Screenshots or screen recordings

Case Before After
switching between scanners in the card dropdown keeps the status selected
deselects the status
how this interacts with filters in the bar

How to set up and validate locally

  1. git checkout mfluharty-clear-tool-coverage-status-on-scanner-change
    echo "Feature.enable(:security_inventory_tool_coverage_card)" | gdk rails c
  2. have a GitLab Ultimate licence
  3. go to a group => Secure => Security inventory, and find the Tool coverage card

picking a different scanner clears the status

  1. on the Tool coverage card, click one of the status rows: Enabled, Failed, Stale or Not enabled
  2. open the scanner dropdown and pick a different scanner, for example Dynamic application security testing (DAST) or Static application security testing (SAST)
  3. check that:
    • the status row is no longer drawn as selected
    • the card stops contributing a filter, so the project list widens back to whatever the search bar alone selects
    • the donut re-renders for the new scanner's counts

reselecting the same scanner doesn't clear the status

  1. with a status row selected, open the scanner dropdown and click the scanner that is already selected
  2. check that:
    • the status row stays selected
    • the project list does not change

to run tests

yarn jest ee/spec/frontend/security_inventory/components/tool_coverage_card_spec.js

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Miranda Fluharty

Merge request reports

Loading
Loading