sourcegraph/cmd/frontend/internal
Jason Hawk Harris cff1669bc1
Svelte: Perforce UI elements refactor (#64279)
## UI Updates for Perforce Depots and Git Repos

Fixes SRCH-530

**NOTE: This PR is a refactor of an earlier
[PR](https://github.com/sourcegraph/sourcegraph/pull/64014) that was
reverted. For that reason, the PR description is largely the same.**

This PR introduces changes to the UI to differentiate between Perforce
Depots and Git repositories. Below are the key changes included in this
commit:

### 1. Dynamic Top-Level Navigation

**For Perforce Depots:**

![Screenshot 2024-07-31 at 10 10 37
AM](https://github.com/user-attachments/assets/2d261b51-f8fa-4599-acae-3520d38996f3)

**For Git Repos:**

![Screenshot 2024-07-31 at 10 10 14
AM](https://github.com/user-attachments/assets/0f9ee3f7-918a-42d8-908f-04593ed52ebd)

### 2. Tabs on Revision Picker

**For Perforce Depots:**

Since we only need one tab for changelists, no tabs are shown.

![Screenshot 2024-07-31 at 10 20 24
AM](https://github.com/user-attachments/assets/f1006d56-67aa-41ab-a13b-905e157cb283)

**For Git Repos:**

We have tabs for Branches, Tags, and Commits.

![Screenshot 2024-07-31 at 10 23 02
AM](https://github.com/user-attachments/assets/38907d51-0407-4cd7-ad4c-1c5967dfddf3)

### 3. Commits/Changelists Page

**For Git Repos:**

The page displays Git commits.

![Screenshot 2024-07-31 at 10 26 23
AM](https://github.com/user-attachments/assets/85245d1d-708f-4d51-9da3-0425c3f085d0)

**For Perforce Depots:**

The page displays Perforce changelists.

![Screenshot 2024-07-31 at 10 26 39
AM](https://github.com/user-attachments/assets/2f6f16aa-d498-4763-949d-d1a13f9a26ac)

### 4. Vocabulary Adjustments

- We display either Git commit SHAs or Changelist IDs based on the
project type.
- For authorship, we use "submitted by" for Perforce and "committed by"
for Git.
- We refer to "Commits" for Git projects and "Changelists" for Perforce
projects.

**Examples:**

- **For Git Commits:**

![Screenshot 2024-07-31 at 10 37 08
AM](https://github.com/user-attachments/assets/ac15b0b3-4c85-4a4c-80c0-ec9384b72eca)

- **For Perforce Changelists:**

![Screenshot 2024-07-31 at 10 37 35
AM](https://github.com/user-attachments/assets/4230cb32-5285-4141-b374-f3ea23042e1d)

### 5. URL Mapping

URLs are now structured differently based on the project type:

- **Commits Page:**
  - Git: `/[repo-name]/-/commits`
  - Perforce: `/[repo-name]/-/changelists`
  
- **Individual Item Page:**
  - Git: `/[repo-name]/-/commit/[commit-hash]`
  - Perforce: `/[depot-name]/-/changelist/[changelist-ID]`

When viewing a specific commit or changelist:
- **Git:** `/[repo-name]@[git-commit-hash]`
- **Perforce:** `/[repo-name]@changelist/[changelist-id]`

_NOTE: The value displayed in the search field will also change
accordingly._


### What is left to be done?
**On repo search results, when searching a revision, we still show the
git commit SHA instead of the changelist ID for perforce depots:**
![Screenshot 2024-07-31 at 10 59 12
AM](https://github.com/user-attachments/assets/38bc2a3e-be8b-4585-9fe0-776149a7f230)

I plan to make a follow-up issue for this and begin work on it
immediately. It's a little trickier than the other changes because in
the RepositoryMatch type, there is no value that can help us determine
whether a project is a depot or a repo. We need to find another way to
fetch that data.

### Request for reviewers: 
1. Please try to break these new features and tell me what you find. I
stumbled on a number of little gotchas while working on this, and I'm
sure I've missed some.

## Test plan
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
- Manual/Visual testing
- Adjust e2e and integration tests to obtain a passing CI
- Test directly visiting a URL versus getting there via click
- Add unit tests for new/updated helper functions

---------

Co-authored-by: Camden Cheek <camden@ccheek.com>
2024-08-14 19:18:24 +00:00
..
app Svelte: Perforce UI elements refactor (#64279) 2024-08-14 19:18:24 +00:00
auth Add support for Bitbucket Server OAuth2 (#64179) 2024-08-14 12:24:32 +02:00
authz graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
backend chore: Move cmd/frontend/backend to internal (#64261) 2024-08-08 11:02:51 +02:00
batches graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
bg chore(worker): move llm token counter to worker (#64008) 2024-07-24 10:03:33 +02:00
cli Redis: remove some direct pool usages (#64447) 2024-08-14 13:39:10 +03:00
clientconfig pass ModelConfigInfo down to client.Get() for self-hosted-models (#63739) 2024-07-09 15:30:37 -07:00
cloneurls gerrit: Add support for repositoryPathPattern (#64102) 2024-07-26 15:08:14 +02:00
codeintel Removes the old GitTreeTranslator API (#64027) 2024-07-24 09:22:42 +00:00
codemonitors graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
cody chore: Move cmd/frontend/backend to internal (#64261) 2024-08-08 11:02:51 +02:00
codycontext chore(cody): allow setting "cody.contextFilters" in site config without feature flag (#63881) 2024-07-18 14:27:55 +03:00
completions feat/cody: Refactor completions API to use new modelconfig (support more models) (#63797) 2024-07-12 12:15:31 -07:00
compute chore(search): update search API call sites to set the version explicitly (#63782) 2024-07-12 10:01:47 +02:00
conf/validation chore: move internal/highlight to cmd/frontend (#64065) 2024-07-31 04:34:03 +02:00
contentlibrary logger: update log lib and remove use of description (#57690) 2023-10-18 17:29:08 +02:00
context Cody web: add server-side fetching for URL mentions (#64223) 2024-08-01 16:01:37 -06:00
dotcom feat/enterpriseportal: use database for reading Cody Gateway access (#63925) 2024-08-08 10:39:14 -07:00
embeddings graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
enterpriseportal feat/dotcom: add Enterprise Portal auth proxy (#63652) 2024-07-09 13:46:59 -07:00
executorqueue fix: Add Exists method to dbworker Store to avoid COUNT(*) (#64297) 2024-08-06 22:13:09 +08:00
githubapp chore: Move cmd/frontend/backend to internal (#64261) 2024-08-08 11:02:51 +02:00
guardrails graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
handlerutil feat/API: add publicly available /api/v1/chat/completions REST endpoint (#64239) 2024-08-09 09:36:27 +00:00
highlight chore: move internal/highlight to cmd/frontend (#64065) 2024-07-31 04:34:03 +02:00
httpapi dotcom: request write scopes for EP prod proxy (#64450) 2024-08-13 16:14:57 +00:00
insights graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
inventory feat(code insights): language stats speed improvements by using archive loading (#62946) 2024-07-18 08:40:48 +02:00
licensing chore: Remove unnecessary _ imports (#64158) 2024-08-06 13:28:29 +02:00
llmapi feat/API: implement /models and /models/{modelId} using TypeSpec (#64421) 2024-08-14 10:47:00 +00:00
modelconfig fix(cody): filter out deprecated models (#64381) 2024-08-09 16:37:42 +00:00
notebooks graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
oneclickexport chore: move cmd/frontend/oneclickexport to cmd/frontend/internal/oneclickexport (#64069) 2024-07-31 04:41:49 +02:00
own graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
processrestart bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
prompts graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
rbac frontend: Remove global conf server variable (#64155) 2024-08-05 16:28:39 +02:00
registry frontend: Consolidate remaining registry packages (#64156) 2024-08-05 16:29:50 +02:00
repos/webhooks graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
routevar bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
savedsearches graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
scim bazel: transcribe test ownership to bazel tags (#62664) 2024-05-16 15:51:16 +01:00
search graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
searchcontexts graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
ssc SSC: Handle team=1 input on checkout form (#62906) 2024-05-28 13:02:02 +02:00
suspiciousnames chore: move internal/suspiciousnames to cmd/frontend/internal (#64071) 2024-07-31 04:42:08 +02:00
telemetry graphqlbackend: Move utils to internal/ (#64117) 2024-08-08 14:18:37 +02:00
webhooks chore: Move cmd/frontend/webhooks to cmd/frontend/internal (#64157) 2024-08-05 16:46:38 +02:00