Hide empty-state message when a security scan errored
What does this MR do and why?
The MR security report widget showed "No new vulnerabilities were found." whenever a scan reported zero new findings, including when the scan failed to load. A failed scan has no data, so the message was misleading while the header already showed the error.
This guards the empty state on each tab with the scan's error flag so the success message only appears when the scan actually succeeded.
Changelog: fixed EE: true Closes #589068
Before / After
Before, a failed scan still showed "No new vulnerabilities were found." The tab
badge also read 0, because an errored report carries numberOfNewFindings: 0.
That put "Full scan 0" directly under the header "SAST: Loading resulted in an
error".
After, the success message is gone and the badge reads -, which is what the
widget already shows when there is no data.
Both images show the Full scan tab of a SAST report. The full scan errored and the diff-based scan has 4 findings.
Before: the header reads "SAST: Loading resulted in an error", the tabs read "Diff-based 4" and "Full scan 0", and the body says "No new vulnerabilities were found."
After: the same header, the tabs read "Diff-based 4" and "Full scan -", and there is no body message.
These images are not from a running GitLab instance, since no GDK was available.
The real mr_widget_security_report_details.vue component was mounted in the
project's own Jest spec, the rendered HTML was dumped, and that HTML was then
rendered in Chromium with GitLab UI's own stylesheets (@gitlab/ui index.css
and tailwind.css). The DOM is the component's real output, so the markup and
classes are genuine, but this is a reproduction rather than a capture of a live
instance. A hover popover that the static render left visible was hidden with
CSS.
How to set up and validate locally
- Run the updated spec:
yarn jest ee/spec/frontend/vue_merge_request_widget/widgets/security_reports/mr_widget_security_report_details_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.
Related to #589068

