Implement "Permalink" to overflow menu in the Repository view
Summary
Add the permalink item to the repository overflow menu.
Expected Behaviour
- Click the button should copy a stable, permanent URL (e.g. https://gitlab.com/gitlab-org/gitlab/-/tree/f5eeb7ed3ed927044df05521b088f92765c029ea/rubocop)
- Upon copying, a successful toast shows
- Shortcut
y
works as well
Technical Details
- Reuse the component (
app/assets/javascripts/repository/components/header_area/permalink_dropdown_item.vue)
added in !181901 (merged) - With the new field exposed from backend in #524081 (closed)
Old Summary
Update March 10, 2025
After the discussion on the copied url for repository permalink dropdown item in #452305 (comment 2388170096), we've added #524081 (closed) as dependency. #524081 (closed) will expose the directory path to frontend. The remaining scope left for this issue is to consume that new field by leveraging the new component added in !183897 (closed).
Proposal
✅ On blob page (completed)
Move "Permalink" to the overflow menu and change the behaviour to copy the permalink to the clipboard instead of changing the URL of the page.
Use a patch from #465489 (closed) to drop the double implementation and default to Vue-only solution.
When copied to the clipboard, we should display a toast that says "Permalink copied"
On repository page
Implement "Permalink" to the overflow menu base on the blob's implementation.
Current | Proposal |
---|---|
![]() |
![]() |
Technical breakdown
Spike: Repository Usability Improvements: Propose a Vue app structure for Repository and Blob
Current structure
"Permalink" control exists only on the blob page.
Blob Vue
- BlobControls app in app/assets/javascripts/repository/index.js?ref_type=heads#L131
- Rendered with
GlButton
in BlobControls: app/assets/javascripts/repository/components/blob_controls.vue?ref_type=heads#L183
Blob HAML
- Static button in app/views/projects/blob/_breadcrumb.html.haml#L34
Proposed structure
"Permalink" will become an item in more actions dropdown together with "Lock", "Replace" and "Delete" controls that are now inside the BlobButtonGroup
component.
Given that we will need only Vue version of "Permalink", despite the blob page version.Remember that this button is bound to a keyboard shortcut. Moving it to Vue completely, should allow us to fix those two issues at the same time:
-
✅ (fixed) Rewrite ShortcutsBlob functionality to use Vue component's lifecycle - there is a patch with a refactor ready to use -
✅ (fixed) Follow-up from "Fix creating permalink with shortcut key "y"" - after implementing this issue, check the user flow described in this follow-up and leave a not if it's still possible to reproduce