Code AI platform with Code Search & Cody
Go to file
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
.apko Build images end-to-end using Bazel v2 (#61845) 2024-04-12 16:18:43 +01:00
.aspect chore(bazel): re-enable remote caching of Copy{File,Directory,ToDirectory} actions (#64153) 2024-07-30 16:02:11 +00:00
.buildkite chore(ci): remove Percy visual tests (#63515) 2024-06-27 16:20:06 +02:00
.github Add verbiage to direct Cody feedback to VSC/JB repos (#64454) 2024-08-13 19:18:46 +00:00
.vscode feat(search): Make search aware of perforce changelist id mapping (#63563) 2024-07-09 14:01:05 -04:00
client Svelte: Perforce UI elements refactor (#64279) 2024-08-14 19:18:24 +00:00
cmd Svelte: Perforce UI elements refactor (#64279) 2024-08-14 19:18:24 +00:00
dev chore(ci): lower concurrent jobs when pushing to dockerhub (#64469) 2024-08-14 16:23:39 +00:00
doc migrations: remove support for NoTransaction (#64432) 2024-08-13 16:08:36 +00:00
docker-images Revert "Revert "refactor: upgrade to rules_oci 2.0 (2nd attempt)"" (#64354) 2024-08-08 09:00:08 +00:00
internal chore: Bump autoindexing image SHAs (#64472) 2024-08-14 16:39:08 +00:00
lib feat/dotcom: use Enterprise Portal for all subscriptions UI (#64115) 2024-08-14 15:32:22 +00:00
migrations migrations: avoid duplicate foreign key constraints when tenant_id re-run (#64465) 2024-08-14 16:57:32 +02:00
monitoring feat(search): remove smart search logic (#64215) 2024-08-01 18:02:35 +03:00
schema Add support for Bitbucket Server OAuth2 (#64179) 2024-08-14 12:24:32 +02:00
testing feat/bazel: //cmd/{frontend,server} targets that don't include client bundle for backend integration tests (#62877) 2024-05-28 14:32:48 +01:00
third_party enterprise-portal: implement basic MSP IAM and RPCs (#63173) 2024-06-19 21:46:48 -04:00
third-party-licenses finish removing chromatic (#63966) 2024-07-21 18:37:02 -07:00
tools Integrate security release approval into release pipeline (#63990) 2024-07-24 09:19:49 +01:00
ui/assets feat(frontend): do not embed frontend assets anymore (#63946) 2024-07-31 15:17:52 +02:00
wolfi-images chore: Frontend does not need disk (#64273) 2024-08-06 13:22:00 +02:00
wolfi-packages Update p4-fusion-sg wolfi-package (#64266) 2024-08-05 15:00:09 +02:00
.bazel_fix_commands.json SG Start Bazel Improvements Take 2 (#60687) 2024-03-05 01:44:21 -08:00
.bazelignore feat/API: implement /models and /models/{modelId} using TypeSpec (#64421) 2024-08-14 10:47:00 +00:00
.bazeliskrc chore: upgrade to Aspect CLI 5.8.19 (#59203) 2024-01-02 15:13:24 +01:00
.bazelrc feat(ci): Adds playwright tests for sveltekit to bazel (#62560) 2024-06-06 12:45:05 -06:00
.bazelversion chore(bazel): bump to 7.2.0 (#63226) 2024-06-12 13:25:18 +00:00
.dockerignore use esbuild for client/web builds (#57365) 2023-10-23 10:59:06 -07:00
.editorconfig proto: Add editorconfig to ident using two spaces (#57281) 2023-10-03 00:39:42 +00:00
.eslintrc.js finish removing chromatic (#63966) 2024-07-21 18:37:02 -07:00
.gitattributes dev/linearhooks: add POC (#62367) 2024-05-07 00:14:05 -07:00
.gitignore chore(ci): emit compact executon log in CI (#63420) 2024-06-21 19:50:35 +01:00
.graphqlrc.yml Support multiple GraphQL schema files (#20077) 2021-04-19 14:35:49 +02:00
.hadolint.yaml bump comby version to 1.7.1 (#35830) 2022-05-20 20:12:01 -07:00
.mailmap mailmap: add entries for Eric and Renovate (#50966) 2023-04-25 09:42:22 +02:00
.mocharc.js reapply "switch from jest to vitest for faster, simpler tests (#57886)" (#58145) 2023-11-07 12:00:18 +02:00
.npmrc pnpm: remove update notifier message (#51630) 2023-05-10 08:53:39 +02:00
.pre-commit-config.yaml chore(local): add FORBIDCOMMIT pragma to prevent accidental commits (#63581) 2024-07-01 18:27:26 +00:00
.prettierignore feat/dotcom: use Enterprise Portal for Cody Gateway usage (#63653) 2024-07-10 19:22:08 +00:00
.stylelintignore rework plugin structure and implement frontside blogpost (#46883) 2023-02-15 11:49:51 +02:00
.stylelintrc.json web: drop bootstrap depenedency (#41401) 2022-09-07 03:11:26 -07:00
.swcrc use swc instead of babel for faster bazel typescript transpilation (#57912) 2023-11-02 22:49:03 -07:00
.tool-versions chore(tooling): bump Go version to 1.22.4 (#63124) 2024-06-06 15:19:03 +00:00
.trivyignore ci: ignore benign CVE-2021-43816 in prometheus (#31069) 2022-02-11 16:49:10 +00:00
BUILD.bazel feat(frontend): do not embed frontend assets anymore (#63946) 2024-07-31 15:17:52 +02:00
CHANGELOG.md feat(code insights): language stats speed improvements by using archive loading (#62946) 2024-07-18 08:40:48 +02:00
CODENOTIFY nix: update pnpm hash (#51512) 2023-05-05 12:51:59 +00:00
CONTRIBUTING.md fix: update links for dev docs (#62758) 2024-05-17 13:47:34 +02:00
deps.bzl feat/enterpriseportal: all subscriptions APIs use enterprise portal DB (#63959) 2024-08-09 17:26:18 -07:00
doc.go
eslint-relative-formatter.js bazel: implement custom ESLint Bazel rule (#52062) 2023-05-22 04:05:45 -07:00
flake.lock nix: bump to bazel 7.1 (#61326) 2024-03-22 16:57:50 +00:00
flake.nix nix: use go1.22.4 (#63372) 2024-06-20 11:12:17 +02:00
gen.go chore: fixup go-mockgen run statement (#61028) 2024-03-12 13:06:36 +00:00
go.mod tenant: set pprof label for tenant (#64338) 2024-08-12 19:40:26 +00:00
go.sum feat/enterpriseportal: all subscriptions APIs use enterprise portal DB (#63959) 2024-08-09 17:26:18 -07:00
graphql-schema-linter.config.js Support multiple GraphQL schema files (#20077) 2021-04-19 14:35:49 +02:00
LICENSE relicense all paths other than MIT licensed code, client/cody*, jetbrains, VS code, and browser extension to enterprise (#53345) (#53345) 2023-06-13 10:28:11 -07:00
LICENSE.enterprise Update Enterprise license copyright notice (#62467) 2024-05-06 17:35:32 +00:00
linter_deps.bzl linters: update go-critic to latest (#64419) 2024-08-12 21:30:49 +02:00
mockgen.temp.yaml chore: Move cmd/frontend/backend to internal (#64261) 2024-08-08 11:02:51 +02:00
mockgen.test.yaml Revert "chore(ci): rework build-tracker to use redis instead of in-memory store of build results" (#64436) 2024-08-13 13:22:41 +02:00
mockgen.yaml bazel: native go-mockgen in Bazel (#60386) 2024-02-16 13:26:48 +00:00
nogo_config.json chore: Remove redundant loop captures (#62264) 2024-04-30 07:57:21 -06:00
package.json upgrade Cody Web, always create a new chat (#64334) 2024-08-07 13:23:25 +00:00
pnpm-lock.yaml feat/API: implement /models and /models/{modelId} using TypeSpec (#64421) 2024-08-14 10:47:00 +00:00
pnpm-workspace.yaml feat/API: implement /models and /models/{modelId} using TypeSpec (#64421) 2024-08-14 10:47:00 +00:00
postcss.config.js
prettier.config.js clean up Cody CSS to increase shareability and improve display in web app (#50279) 2023-04-03 12:29:05 -07:00
README.md chore: remove broken link in README (#63256) 2024-06-13 22:22:56 +00:00
release.yaml fix(release): add minor step to internal release create command (#64377) 2024-08-12 19:48:18 -04:00
renovate.json chore(ci): disable renovate (#63313) 2024-06-19 13:17:15 +02:00
SECURITY.md consolidate security policy (#7906) 2020-01-21 10:03:11 -08:00
service-catalog.yaml lib/servicecatalog: init to distribute catalog (#46999) 2023-01-26 17:22:27 -08:00
sg.config.yaml feat/enterpriseportal: add license creation webhook (#64422) 2024-08-13 12:11:03 -07:00
shell.nix bazel: use pgutil binaries from GCS instead of from the host (#61741) 2024-04-11 18:00:21 +01:00
stamp_tags.bzl Switch to OCI/Wolfi based image (#52693) 2023-06-02 12:12:52 +02:00
tsconfig.base.json web: fix pnpm-lock issue (#47478) 2023-02-09 22:04:31 -08:00
tsconfig.json release: drop legacy release tooling (#61220) 2024-04-09 14:29:35 -05:00
vitest.shared.ts make pagination hooks store filter & query params in URL, not just pagination params (#63744) 2024-07-15 19:17:59 +00:00
vitest.workspace.ts vitest: Fix workspace config wrt client/web/ (#58397) 2023-11-17 08:22:46 +00:00
WORKSPACE build(bazel): upgrade to rules_oci 2.0.0-beta2 (#64364) 2024-08-09 13:32:12 +01:00

DocsContributingTwitterDiscord

Build status Scorecard Latest release Discord Contributors


Sourcegraph makes it easy to read, write, and fix code—even in big, complex codebases.

  • Code search: Search all of your repositories across all branches and all code hosts.
  • Code intelligence: Navigate code, find references, see code owners, trace history, and more.
  • Fix and refactor: Roll out large-scale changes to many repositories at once and track big migrations.

Getting started



Development

Refer to the Developing Sourcegraph guide to get started.

Documentation

The doc directory has additional documentation for developing and understanding Sourcegraph:

License

This repository contains primarily non-OSS-licensed files. See LICENSE.

Copyright (c) 2018-present Sourcegraph Inc.