Make sec training provider mutation optimistic
requested to merge 348985-refactor-security-training-configuration-to-use-optimistic-response into master
What does this MR do and why?
On the configuration page for the upcoming "Security Training" feature, we currently show a loading spinner whenever a training provider gets enabled or disabled.
This MR leverages apollo's optimistic-response option to move away from the loading indicator and assume that the mutation was successful instead.
If an error occurs the user still gets a message about it.
Screenshots or screen recordings
success | before | after |
---|---|---|
yes | success_before | success_after |
no | error_before | error_after |
How to set up and validate locally
Enable the feature flag:
echo "Feature.enable(:secure_vulnerability_training)" | rails c
Create training providers:
echo "Security::TrainingProvider.create!(name: 'Foo', description: 'Foo provider', url: 'http://foo.com', logo_url: 'http://foo.com/logo')" | rails c
echo "Security::TrainingProvider.create!(name: 'Bar', description: 'Bar provider', url: 'http://bar.com', logo_url: 'http://bar.com/logo')" | rails c
- Go to a project's "Security & Compliance" -> "Configuration"
- Click on "Vulnerability Management"
- Enable / Disable either provider and make sure that it persists after a page reload
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #348985 (closed)
Edited by David Pisek