Skip to content

Add a copy button inside Catalog Resource components tab

What does this MR do and why?

Add a copy-to-clipboard button in the code snippet in the component tab

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2023-10-20_at_4.17.18_PM Screenshot_2023-10-20_at_4.10.00_PM

Screen recording of the copy in action (Note that the BG hover size for the button has changed after this video was taken!)

Screen_Recording_2023-10-20_at_3.48.20_PM

How to set up and validate locally

  1. Make sure you have an premium license for your GDK
  2. Login as an admin user
  3. Create a few projects that you will be able to convert to Ci resources. Create them under the admin namespace for ease of testing.
  4. Once you have done so, get the ID of the first new project you wanted to convert. Then in Rails console, run:
projects = Project.where("id > ?", your_first_project_id)
projects.each do |project|
  project.update!(description: 'description')  
  ::Ci::Catalog::Resource.new(project_id: project.id).save   
end  
  1. Open your rails console and execute: Feature.enable(:ci_catalog_components_tab)
  2. Navigate to /$namespace/$project/-/ci/catalog/resources/. Any project under the same namespace will do (in this case, anything under the admin namespace)
  3. Click on a resource
  4. Make sure to go to the components tab (depending on other MRs, it may or may not be loaded as the default)
  5. Notice in the code block the new copy-to-clipboard button
  6. Click on it
  7. Navigate to Build -> Pipeline Editor
  8. Paste it in the code editor
  9. Notice that it works!

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 #426755 (closed)

Edited by Frédéric Caplette

Merge request reports