Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

(feat) add repo metadata key filter query link#51258

Merged
erzhtor merged 5 commits into
mainfrom
erzhtor/add-repo-metadata-filter-query-link
May 10, 2023
Merged

(feat) add repo metadata key filter query link#51258
erzhtor merged 5 commits into
mainfrom
erzhtor/add-repo-metadata-filter-query-link

Conversation

@erzhtor

@erzhtor erzhtor commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Part of https://github.com/sourcegraph/pr-faqs/issues/96.

Test plan

  • sg start
  • Enable the repository-metadata feature flag
  • Search repos (select:repo) with metadata. If not, add some via repo root page UI

Screenshot

Screen.Recording.2023-04-28.at.18.24.13.mov

@erzhtor erzhtor requested review from a team and toolmantim April 28, 2023 12:30
@erzhtor erzhtor self-assigned this Apr 28, 2023
@cla-bot cla-bot Bot added the cla-signed label Apr 28, 2023
@sourcegraph-bot

sourcegraph-bot commented Apr 28, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff a82352a...071825e.

Notify File(s)
@fkling client/branded/src/search-ui/components/RepoMetadata.module.scss
client/branded/src/search-ui/components/RepoMetadata.story.tsx
client/branded/src/search-ui/components/RepoMetadata.tsx
client/branded/src/search-ui/components/RepoSearchResult.tsx
@limitedmage client/branded/src/search-ui/components/RepoMetadata.module.scss
client/branded/src/search-ui/components/RepoMetadata.story.tsx
client/branded/src/search-ui/components/RepoMetadata.tsx
client/branded/src/search-ui/components/RepoSearchResult.tsx

@sourcegraph-buildkite

sourcegraph-buildkite commented Apr 28, 2023

Copy link
Copy Markdown
Collaborator

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.01% (+1.11 kb) 0.01% (+1.11 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 071825e and 1004a84 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@toolmantim

Copy link
Copy Markdown
Contributor

👏🏼

The original intention was that each whole badge was clickable (say, with a darker background color change) — but only linking the text might work when we want to link the value too, and not just the key. Which leads to my next question…

Any reason we haven't linked the "value" part of the badge yet? Or is that coming in a follow-up? Feels odd without that. e.g. for "license: mit" we'd link "license" to repo:has.meta(license) and "mit" to repo:has.meta(license:mit) (or whatever the final search names we chose were)

@erzhtor

erzhtor commented May 2, 2023

Copy link
Copy Markdown
Contributor Author

Thanks @toolmantim, for the reviews.

Any reason we haven't linked the "value" part of the badge yet? Or is that coming in a follow-up? Feels odd without that. e.g. for "license: mit" we'd link "license" to repo:has.meta(license) and "mit" to repo:has.meta(license:mit) (or whatever the final search names we chose were)

  1. That is easily doable, however, I'm just worried about the UX, will it be straight forward that two parts of the same badge be different links?

The original intention was that each whole badge was clickable (say, with a darker background color change) — but only linking the text might work when we want to link the value too, and not just the key. Which leads to my next question…

  1. My bad, I thought that we agreed on this approach. We can make the badge to make a link which will lead to repo:has.key() or repo:has(key:value depending on whether the metadata consists of key-value pair or just key.

I think 2nd makes more sense (with making the whole badge clickable), I will update to follow this logic. But let me know if you think, we should consider 1st point/option too.

@erzhtor

erzhtor commented May 2, 2023

Copy link
Copy Markdown
Contributor Author

@toolmantim, updated to make whole badge clickable and make link filter different based on metadata value presence 042149b5e11faf7fac418252661b494180fca69b.

@toolmantim

Copy link
Copy Markdown
Contributor

I'll trust your gut feeling on the two links in the one badge being confusing!

And sorry about not being clear on the style! I assumed we would be going with the standard <Badge as={Link}> that I spotted in the following, but I should have been clear about that earlier:

https://github.com/sourcegraph/sourcegraph/blob/df2d87dda19f9be93b59d9ba48a3dc07d293d676/client/wildcard/src/components/Badge/Badge.story.tsx#L57

Screen.Recording.2023-05-03.at.4.33.13.pm.mov

Could we make the whole thing clickable, similar to how it works in the Storybook example? I tried to the change myself, but I think it's too much component rejigging with where the link is defined, so might need to get your help.

Also… giving it a go locally… I realised that if you're on a repo root page, I think we should to strip the repo off the URL from the badge links, so you can easily navigate to other repositories (which was the intention). wdyt?

Screen.Recording.2023-05-03.at.4.41.00.pm.mov

@erzhtor erzhtor force-pushed the erzhtor/add-repo-metadata-filter-query-link branch from 3f08105 to 071825e Compare May 10, 2023 10:10
@erzhtor

erzhtor commented May 10, 2023

Copy link
Copy Markdown
Contributor Author

Thanks @toolmantim for the review. Addressed both feedback items.

Screen.Recording.2023-05-10.at.16.12.02.mov

@sourcegraph-bot

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@erzhtor erzhtor merged commit 63a5247 into main May 10, 2023
@erzhtor erzhtor deleted the erzhtor/add-repo-metadata-filter-query-link branch May 10, 2023 10:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants