Skip to content

metrics filters: improve handling when nothing matches the filters#12687

Merged
valentijnscholten merged 4 commits intoDefectDojo:bugfixfrom
valentijnscholten:all-objects-filtered-message
Jun 26, 2025
Merged

metrics filters: improve handling when nothing matches the filters#12687
valentijnscholten merged 4 commits intoDefectDojo:bugfixfrom
valentijnscholten:all-objects-filtered-message

Conversation

@valentijnscholten
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten commented Jun 24, 2025

One the Product Type and Product metrics there was an error message when no findings or endpoints matched the selected filters. The metrics would fallback to show "all findings/endpoints",

This PR:

  • Removes the fallback and just shows empty metrics
  • Changes the message to inform the user

[sc-11515]

Funny thing is the existing test case to test the endpoints metrics was using a filter based on current month. This results in no endpoints matching the filter because the testdata is 5 years old. But the old DD code did a fallback to return all endpoints, making the test pass. This PR now mocks now and fixes the test properly.

Testing: I don't think all metrics cases have test coverage, so a "click through" test by someone knowledgable about metrics should be done.

Question: Should we just remove the message? Most other metrics/filtering pages don't show this message.

@dryrunsecurity
Copy link
Copy Markdown

DryRun Security

No security concerns detected in this pull request.


All finding details can be found in the DryRun Security Dashboard.

Copy link
Copy Markdown
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

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

Question: Should we just remove the message? Most other metrics/filtering pages don't show this message.

I think we should keep it. It is a weird user experience to click the metrics button, and then see zero findings reported if all of them are older than 30 days. The message provides a good hint of where to look for next steps

@Maffooch Maffooch requested review from dogboat and hblankenship June 25, 2025 17:55
Copy link
Copy Markdown
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

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

Approved

@valentijnscholten valentijnscholten merged commit 2297812 into DefectDojo:bugfix Jun 26, 2025
78 checks passed
@valentijnscholten valentijnscholten added this to the 2.47.4 milestone Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants