Skip to content

Make sec training provider mutation optimistic

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
  1. Go to a project's "Security & Compliance" -> "Configuration"
  2. Click on "Vulnerability Management"
  3. 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.

Related to #348985 (closed)

Edited by David Pisek

Merge request reports