Improve error handling in DAST site profile form
- Related issue: #233027 (closed)
What does this MR do?
This improves the error handling in the DAST site profile form. Previously, if GraphQL returned errors-as-data, they would be completely ignored by the frontend and the user would be redirected to the site profiles library, as if the request had succeeded.
This MR addresses this by aborting the redirection when errors are returned as data, and by presenting those errors to the user so they can recover from them by changing the form.
Screenshots
Here's the error that appears if the user tries to create a new profile with a name that is already used in another profile:
How to test this?
- Enable the feature flag.
echo "Feature.enable(:security_on_demand_scans_feature_flag)" | spring rails c
- Sign-in as the
root
user. - Navigate to a project's DAST Site Profile form (
/:group/:project/-/on_demand_scans/profiles/dast_site_profiles/new
) - Create a profile.
- Repeat steps 3 and 4, make sure to reuse the same profile name.
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry (behind a feature flag)
- [-] Documentation (if required)
-
Code review guidelines - [-] Merge request performance guidelines
-
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Paul Gascou-Vaillancourt