Backend for new deploy tokens via ajax
What does this MR do?
Resolves the backend half of #22794 (closed) by changing the POST to an ajax request. This means that a reload of the page will no longer trigger the creation of a new deploy token.
These changes are behind a feature flag named :ajax_new_deploy_token
.
The flag exists at the group and project level.
When enabled:
- Makes create_deploy_token actions of ci_cd controllers ajax
- The JSON response matches the existing API schema
API Schema: https://docs.gitlab.com/ee/api/deploy_tokens.html
Frontend Followup Work
First, we have to initially hide new deploy token info-well.
Then, when we get JSON response:
- if data is good:
- populate that data in the info-well
- populate the data-clipboard-text fields too
- un-hide the info-well
- otherwise, hide the info-well
- show the payload's message in either notice or alert
- re-enable the submit button
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] 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
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Amy Troschinetz