Skip to content

Blob controls refactor

What does this MR do and why?

1. Add test coverage for failed queries

Refactor test file to be more flexible in how we provide resolvers for queries. This allows to test behaviour when queries fail. Additional function for overwriting the blob controls query make it easier to test the component in different context.

2. Use correct gitpodEnabled data for web ide

Differentiate between application and user level data. We had some confusion in the MR that introduced this. I looked into how this data was provided in the previous application in ~/blob/components/blob_header.vue. And did the smart think I should have done - I copied that solution. Injecting the gitpodEnabled doesn't make sense, since this is provided by backend on the tree helper and we need that information consistent on the blob as well. While the gitpod link was rendering when going from tree to a blob, entering a blob page straight away (for example, for a link or after page refresh) will have gitpodEnabled evaluated to false

I've also improved the story for web ide link, so we get to see that gitpod item in the Storybook.

References

Screenshots or screen recordings

Context Before After
when going straight to blob page Screenshot_2025-03-14_at_18.36.12 Screenshot_2025-03-14_at_18.35.36
when going from the tree to blob Screenshot_2025-03-14_at_18.38.26 Screenshot_2025-03-14_at_18.35.36

How to set up and validate locally

  1. In rails console enable the feature flag
    Feature.enable(:blob_overflow_menu)
  2. Enable Gitpod in admin following these instructions: https://docs.gitlab.com/integration/gitpod/#configure-a-gitlab-self-managed-instance
  3. Enable Gitpod on user level following these instructions: https://docs.gitlab.com/integration/gitpod/#enable-gitpod-in-your-user-preferences
  4. Go to Project / Repository and select a file.
  5. Click Edit and verify that Open with gitpod is visible in the edit dropdown, even after refreshing the page.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #498253 (closed)

Edited by Paulina Sedlak-Jakubowska

Merge request reports

Loading