Improve the toggle behaviour for runners 'Allow runner registration token' at group level
Release notes
Problem to solve
Introduced in !148557 (comment 1852407137), when the toggle is enabled or disabled, it refreshes the page. This accounts for a bad experience.
Proposal
Don't reload the page when the toggle is switched on or off.
Implementation guide
This toggle is shown in CI/CD Settings for root groups when the application setting Gitlab::CurrentSettings.allow_runner_registration_token
is enabled.
Currently, the toggle in this form gets a change
event bound to it here that submits the form. Submitting the form makes a POST
request to the current path with a _method
, an authenticity_token
, and group[allow_runner_registration_token]
set to the new value of the toggle (true or false) and then loads a fresh version of the page (including an alert at the top to tell you that the operation succeeded).
We need to submit the same data to the same place, but do it asynchronously: we could update the javascript file to make an axios
call instead of submitting the form directly, then trigger the Group CI/CD settings were successfully updated.
alert if it succeeds or an error alert if it fails, then set toggle.isLoading = false;
.
We could initialize a Vue app here, but that seems like overkill.
Here's the MR that introduced the toggle for reference: !148557 (merged)
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.