Add project selector to personal access token form [RUN ALL RSPEC] [RUN AS-IF-FOSS]

📖 What does this MR do?

Related to #22754 (closed). Follow-up MR to !54839 (merged)

Adds a project selector to the personal access tokens form. This project selector will be allow users to scope their personal access tokens to one or more projects.

The backend work is not complete yet so it has no effect when submitting the form. Once the backend is completed in #15666 (closed) this field will be hooked up to the controller.

📋 Summary of changes

  1. Use the GitLab UI GlTokenSelector component paired with the projects GraphQL query to list all the projects available to the user.

📈 Future iterations

  1. Add a "Project(s)" column to the table that lists all active PAT image
  2. Wire up the frontend to the backend once the controller has been updated in #15666 (closed)
  3. Add a new query to get the selected projects when the component mounts. This will prevent GlTokenSelector from being cleared if there are form validation errors. This will be needed because currently the page reloads when submitting the form as opposed to submitting via Ajax.
  4. Update documentation
  5. Add feature specs

💻 Local testing

  1. Enable the personal_access_tokens_scoped_to_projects feature flag.
    • bin/rails console
    • Feature.enable(:personal_access_tokens_scoped_to_projects)
  2. Navigate to /-/profile/personal_access_tokens

📷 Screenshots


🚦 Does this MR meet the acceptance criteria?


Availability and Testing


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
    • Will ask for a security review when the backend is done
  • [-] 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 Peter Hegman