Commit Graph

6206 Commits

Author SHA1 Message Date
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
Robert Lin
6e828b0a14
feat/dotcom: use Enterprise Portal for all subscriptions UI (#64115)
Overview Loom:

1.
https://www.loom.com/share/988465de1c3a4caaa08fc6b22ffb74e5?sid=860f28cd-4dfb-4758-9bd9-d2f485ceb317
2. Announcement:
https://www.loom.com/share/8560388e0a4a404caf67d908820ed0d0?sid=6482815f-ac60-4251-95cc-307f527a60dd

tl;dr


![image](https://github.com/user-attachments/assets/542c5b64-5729-4a6a-91b2-e0373abb35fa)

![image](https://github.com/user-attachments/assets/9cc41a80-2ff1-4845-a290-823df242cd2e)

![image](https://github.com/user-attachments/assets/47c9a400-d091-416f-a85c-f1dcc93d880d)

TODO:

- [x] Fix the "edit instance type" input
- [x] ~Subscription view: reload on changing the Enterprise Portal
environment selector~ ->
https://linear.app/sourcegraph/issue/CORE-245/dotcom-subscriptions-ui-enterprise-portal-instance-selector-doesnt,
use a jank reload for now
- [x] CI

Closes
https://linear.app/sourcegraph/issue/CORE-100/enterprise-portal-migrate-away-from-dotcom-db-as-source-of-truth

## Test plan

Manual testing for UI via `sg start dotcom` ->
https://sourcegraph.test:3443/site-admin/dotcom/product/subscriptions

The PRs this PR is stacked on top of implement testing of the backend
capabilities
2024-08-14 15:32:22 +00:00
Petri-Johan Last
d3a3d721d3
Add support for Bitbucket Server OAuth2 (#64179)
Docs here: https://github.com/sourcegraph/docs/pull/561

This PR adds support for using Bitbucket Server OAuth2 application links
for sign-in and permission syncing.

When used for permission syncing, the user's oauth token is used to
fetch user permissions (and now permissions are fetched via the server).

## Test plan

Tests added and updated.

## Changelog

- Sourcegraph now supports Bitbucket Server OAuth2 application links for
user sign-in and permission syncing.
2024-08-14 12:24:32 +02:00
Felix Kling
34ff925ed8
feat(svelte): Add cody chat page (#64448)
Closes #srch-906

This commit adds the cody chat page to svelte. This is simply reusing
the existing wrapper around the React component and renders it in a
standalone page.

When merged this will cause the cody chat page to be handled by new web
app on dotcom by default.

## Test plan

- Verified that chat loads and the tabs are clickable.
- Verified that the scroll behavior works as in the React app.
- Verified that the sidebar chat still works as expected (scroll
behavior, default context loading/switching)
2024-08-13 19:25:32 +00:00
Felix Kling
8296e9804f
feat(svelte): Migrate dotcom community search pages to Svelte (#64388)
What: This PR does the bare minimum to migrate the current community
search pages to Svelte. A better strategy for managing them is needed in
the medium/long term.

How: The community pages live at the root (e.g. `/kubernetes`) which
complicates things, but I'll get to that later. The page is implemented
as a single parameterized route. A parameter matcher is used to validate
the community name. Because these pages should only be accessible on
dotcom the matcher also validates whether or not we are on dotcom (if
not, the path will be matched against a different route).

The page config is stored in a separate module so that it's no included
in every page and so that it can be used in the integration test.

The loader and page implementation themselves are straightforward. I
made a couple of changes in other modules to make implementation easier:

- Extracted the parameter type of the `marked` function so that it can
be used as prop type.
- Added an `inline` option to `marked` that allows formatting markdown
as 'inline', i.e. without `p` wrapper.
- Added a `wrap` prop to `SyntaxHighlightedQuery.svelte` to configure
line wrapping of syntax highlighted search queries (instead of having to
overwrite styles with `:global`).
- Extended the route code generator to be able to handle single
parameter segments and the `communitySearchContext` matcher.

Because the community routes should only be available on dotcom I added
a new tag to the code generator that allows it include routes only for
dotcom.
Once we change how all this works and have community search pages live
under a different path we can simplify this again.

Result:

| React | Svelte |
|--------|--------|
|
![2024-08-09_16-05](https://github.com/user-attachments/assets/a64c4e0c-a9dd-4248-9466-05b348559408)
|
![2024-08-09_16-04](https://github.com/user-attachments/assets/d8ad424b-d04a-4590-b198-a6b2f4a76816)
|


## Test plan

- New integration tests.
- Verified that `/kubernetes` shows a 'repo not found error' when
running against S2.
- Verified that `/kubernetes` shows the community page when running
against dotcom.
- Verified that `window.context.svelteKit.enabledRoutes` contains the
community page route in enterprise mode but not in dotcom mode.
2024-08-09 22:52:47 +02:00
Naman Kumar
d0b88533b4
Remove old Cody Web completely (#64345)
closes:
https://linear.app/sourcegraph/issue/SRCH-622/remove-old-cody-web-entirely

Removes the old Cody Web completely.

## Test plan

- sg start
- visit /cody/chat and you should see the new unified panel Cody Web
without having to turn on any feature flags.
- check the blob view sidebar for the same.
## Changelog

- The new Cody Web is enabled by default and the older version of Cody
Web is completely removed from both standalone chat and sidebar.
2024-08-09 10:25:59 +05:30
Robert Lin
7c2d97858a
feat/dotcom: UI tracks Cody Gateway access directly in Enterprise Portal (#64090)
Upgrades the self-contained Cody Gateway modal to only depend on
Enterprise Portal to read/write Cody Gateway access.

I also made some minor tweaks to parsing empty form inputs, and also
made the "Cody Gateway access token" collapsed by default, with warnings
to discourage its use (opted not to remove entirely since it may be
useful for dev/debugging)

Depends on:

- https://github.com/sourcegraph/sourcegraph/pull/63926 
- https://github.com/sourcegraph/sourcegraph/pull/63925 
- https://github.com/sourcegraph/sourcegraph/pull/63858 

Closes https://linear.app/sourcegraph/issue/CORE-218

## Test plan

```
sg start dotcom
```

Edit the Cody Gateway access stuff, toggling it up and down.
Cross-reference with the `enterprise_portal_cody_gateway_access` table.
2024-08-08 16:37:16 -07:00
Naman Kumar
2dd38b3ffd
Fix Cody Web CSS (#64370)
closes:
https://linear.app/sourcegraph/issue/SRCH-866/improve-cody-web-theming-for-consistency-with-rest-of-product

This PR updates the Cody Web CSS based on the changes requested by
@rrhyne.

Few buttons implemented in Cody doesn't satisfy the design requirements
and do not use the css variable so we couldn't update them easily but
rather had to override the styles.

## Test plan

Before: 
![CleanShot 2024-08-08 at 22 53
48@2x](https://github.com/user-attachments/assets/95e10b42-b740-4663-a761-69449ec62296)

After:
![CleanShot 2024-08-08 at 22 54
12@2x](https://github.com/user-attachments/assets/bffbd10a-c87b-4eca-9582-b23eebccb60e)


## Changelog

- Make Cody Web styles more accessible.
2024-08-09 01:21:09 +05:30
Felix Kling
5c9b7151cb
refactor(svelte): Optimize welcome overlay screenshot assets (#64344)
The screenshot images for the welcome overlay (both in Svelte and React)
are quite large.
In Svelte specifically, because they are implemented as Svelte
components, this adds a lot of code to the root layout and makes the
bundle quite large.

This commit converts the Svelte components to image files and passes
them (and the React ones) through [svgo](https://github.com/svg/svgo).

On one hand that makes the images much smaller, on the other hand in
Svelte the images are now independent of the JS code and can be loaded
separately (the React app was already using an `img` element).

Before svgo:

```
$ ls src/lib/assets/
total 3.1M
5.1K Aug  7 18:45 sourcegraph-logo.svg
1.5M Aug  7 18:46 welcome-screenshot-dark.svg
1.6M Aug  7 18:46 welcome-screenshot-light.svg
```

After svgo:

```
$ ls src/lib/assets/
total 1.4M
5.1K Aug  7 18:45 sourcegraph-logo.svg
667K Aug  7 18:50 welcome-screenshot-dark.svg
667K Aug  7 18:50 welcome-screenshot-light.svg
```

## Test plan

I temporarily changed the code so that the welcome dialog is always
shown in the Svelte app and inspected the image. It still seems to look
the same.
2024-08-07 17:37:27 +00:00
Camden Cheek
3ff0f07646
Svelte: more welcome banner behavior updates (#64311)
This makes some requested changes to the welcome banner. 

Notably:
- We no longer show the dialog unless the user switches into the svelte
version from react
- We don't show the dialog on every switch
- The dialog is accessible in the React via the "Learn more" button in
the menu
- Copy is updated to be less verbose
- The request for feedback is only shown once when switching out of the
svelte webapp
2024-08-07 08:55:57 -06:00
Quinn Slack
f7d4517dbc
upgrade Cody Web, always create a new chat (#64334)
Incorporates https://github.com/sourcegraph/cody/pull/5129

## Test plan

Run in SvelteKit and non-SvelteKit. Ensure that the Cody standalone chat
and Cody sidebar chats work.
2024-08-07 13:23:25 +00:00
Naman Kumar
3efa77aad9
Center align Cody logo in Cody Web Sidebar (#64324)
Fixes Cody Logo alignment to center for both React & Svelte Cody Sidebar
header.

## Test plan

Before:
![CleanShot 2024-08-07 at 13 30
04@2x](https://github.com/user-attachments/assets/c1b8471d-3f25-4b75-bf54-888876578d63)

After:

![CleanShot 2024-08-07 at 13 30
19@2x](https://github.com/user-attachments/assets/483e1abd-ea6e-498b-8d98-6295a23f5cca)

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-08-07 09:21:57 +01:00
Naman Kumar
3680503eab
Update Cody Web to 0.3.7 (#64296)
closes:
https://linear.app/sourcegraph/issue/SRCH-821/context-is-not-being-fetched-on-vs-code-even-though-its-being-fetched

![CleanShot 2024-08-06 at 16 13
05@2x](https://github.com/user-attachments/assets/e338865c-5949-4b18-8e2c-41afcc4abc1b)

This PR updates Cody Web to 0.3.7. The latest version introduces the
following changes:
- Removes the Cody history panel and rather uses the tabs. (As updated
in latest version on Cody Web)
- Removes the `experimental.noodle` flag set to true. 
- Fixes the issue where the query for `getCodyContext` contained mention
chips text and was different from VS Code.

## Test plan

- visit /cody/chat

## Changelog
2024-08-07 10:27:17 +05:30
Felix Kling
b6a25c8a11
fix(own): Prevent infinite UI update loop in own pages (#64312)
I noticed that my computer fans kept on spinning when visiting
https://sourcegraph.test:3443/github.com/sourcegraph/sourcegraph/-/own
and
https://sourcegraph.test:3443/github.com/sourcegraph/sourcegraph/-/own/edit.

Long story short because we are not memoizing the breadcrumbs we are in
an infinite update loop. The offending commit is
c42c57da1d.

## Test plan

Manual testing. Fans stopped spinning.
2024-08-06 22:34:05 +02:00
Stefan Hengl
155975259a
fix(search_jobs): progress reporting (#64287)
Relates to #64186

With this PR we only show `83 out of 120 tasks` if the search job is
currently processing. In all other states, we don't show this stat. This
is a consequence of the janitor job I recently added, because after
aggregation, this data is not available anymore. User's can still
inspect the logs and download results to get a detailed view of which
revisions were searched.

I also remove an unnecessary dependency of the download links on the job
state.

## Test plan:

I ran a search job locally and confirmed that the progress message is
only visible while the job is processing and that logs and downloads are
always available.

## Changelog
- Show detailed progress only while job is in status "processing"
- Remove dependency of download links on job state
2024-08-06 11:16:04 +02:00
Jason Hawk Harris
e5178a6bc0
Revert "[Svelte]: UI Updates for Perforce Depots and Git Repos" (#64275)
Reverts sourcegraph/sourcegraph#64014

We decided that including this in the August 7th release would be rushed
after diving deeper into the project. Reverting this in order to
re-write the functionality, especially the data loading components.

## Test Plan
- this is a revert PR. Everything will work as before.
2024-08-05 16:30:41 +00:00
Jason Hawk Harris
b0702f3c3c
[Svelte]: UI Updates for Perforce Depots and Git Repos (#64014)
Introduces basic (and incomplete) UI support for perforce, including displaying changelist ids,
listing changelists, and removing references to commits and branches.
2024-08-02 20:47:20 -06:00
Vova Kulikov
4caad25380
Cody Web: Update Cody Web to 0.3.6 [React version] (#64254)
Closes
https://linear.app/sourcegraph/issue/SRCH-720/new-chat-button-in-side-panel-view
Closes
https://linear.app/sourcegraph/issue/SRCH-808/chat-history-in-side-panel-view

This PR does a few things 
- Updates Cody Web to 0.3.6 (this includes improvements around mentions
UI, web url mention support, etc)
- Adds "create new chat" button to the sidebar cody chat UI
- Adds history chats UI to the sidebar cody chat UI (note that in GA we
will rely on the new Tabs UI, this history UI is just a temporal
solution for the Sourcegraph Aug release, in sep GA release it will be
improved)

## Test plan
- General manual checks on Cody Web.
- Check that you can create a new chat from the sidebar chat UI
- Check that you can select chats from the history panel from the
sidebar chat UI

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-08-02 18:04:52 -03:00
Camden Cheek
a148d8a670
Web: fix git blame for files that have /stream/ in their path (#64230)
The URL path for streaming blame is ambiguous when the file path
contains `/stream/`. The pattern looks like
`/blame/<repo_name>@<revision>/stream/file/path.txt`. However, if the
file contains `/stream/`, the revision is matched greedily up until the
last stream, so we end up with a revision that looks like
`81af3g/stream/my/path`, which is in invalid revision that results in a
404.

This makes the URL pattern unambiguous by adding a `/-/` element after
the revision, which is not allowed in a revision name and acts as a path
separator. So now, the pattern looks like
`/blame/<repo_name>@<revision>/-/stream/file/path.txt`.

Note, this is a public-facing breaking change, but I don't think it
really matters since I don't expect any customers use our streaming
blame API
2024-08-02 14:11:32 -06:00
Michael Bahr
4a565a8819
fix(batches): show warning instead of error when the changeset status is not FAILED (#64243)
With SRCH-802 we saw error messages when batch changes may still retry
and resolve the problem. To give a better distinction between resolvable
and non-resolvable errors, I'm changing the colour variation from error
to warning if the changeset has not been marked as `FAILED` yet.

Before:

<img width="913" alt="Screenshot 2024-08-02 at 12 44 27"
src="https://github.com/user-attachments/assets/b192c5e9-d23b-460c-82a7-a039edbca3f5">

After:

<img width="1355" alt="Screenshot 2024-08-02 at 12 36 23"
src="https://github.com/user-attachments/assets/02e231a7-168a-4fe9-bd3b-014d810fd236">

## Test plan

Manual testing

## Changelog

- Batch changes that are still retrying now show a warning instead of an
error.
2024-08-02 16:22:30 +02:00
YK
83f553e1ec
Update the legacy link to sg doc (#64017)
## Test plan

Check each new link manually

---------

Co-authored-by: Bolaji Olajide <25608335+BolajiOlajide@users.noreply.github.com>
2024-08-01 16:18:30 -07:00
Anish Lakhwara
856e41eff3
fix(appliance): Make Appliance URL envvars strings (#64227)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
Changes `APPLIANCE_MANAGED` -> `APPLIANCE_UPDATE_TARGET`, and creates
`APPLIANCE_MENU_TARGET`. Both are stringly typed env vars, that when set
will create / redirect the update buttons / menu links in the site admin
and nav item pages.

Paired with @nelsonjr and @DaedalusG on this 

## Test plan

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Manually Tested

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
- **fix(appliance): make environment variables strings to be passed
around**
2024-08-01 15:45:25 -07:00
Camden Cheek
eb1a76ee7a
Svelte: welcome banner followups (#64222) 2024-08-01 15:12:06 -06:00
Vova Kulikov
e073ae59cf
Bump @sourcegraph/cody-web to 0.3.4 (#64224)
Closes
https://linear.app/sourcegraph/issue/SRCH-561/add-support-for-file-ranges-in-cody-web

## Test plan
- Check that you can mention files with ranges
- Check that as you open Cody chat on the blob UI page and you have
selected lines in blob UI then chat should have an initial context
mention with line range
- Check that as you change line selection it updates mention file chip
range (only if you don't have any other text)
2024-08-01 17:30:13 -03:00
William Bezuidenhout
29847d1ca3
chunk cleaner: remove comment (#64212)
This comment is no longer relevant

## Test plan
CI

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-08-01 13:48:41 +02:00
Camden Cheek
be17da7305
Svelte: add welcome introduction when enabling svelte for the first time (#64163)
This implements a welcome dialog and some additional messaging around
the beta rollout.
2024-08-01 11:06:37 +02:00
Camden Cheek
60d450b079
Code intel: respect provenance when getting usages (#64193)
This updates the new references panel to respect the provenance of an
occurrence.
2024-07-31 15:50:31 -03:00
Anish Lakhwara
c1ff60f082
feat(appliance): Change site-admin updates button to point to Appliance based on env var (#64167)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
This PR resolves
[REL-300](https://linear.app/sourcegraph/issue/REL-300/put-update-redirect-into-current-sourcegraph-admin-panel).
We point the Update button in the SiteAdmin sidebar to point to a
different URL (Currently appliance localhost port, needs to be changed)
based on the `APPLIANCE_MANAGED` env var.

Most of the PR is tracking types / config down to the backend. There, a
simple function checks for the existence of this env var and if it
exists returns it's value.

I may have updated extra unnecessary types (not certain) but I was
following the compiler.

Second commit is just updating the storybook type values

We'll need another PR to the Helm chart to activate the env var once we
want to switch people over to pointing to the appliance maintenance UI.

@DaedalusG brought up the good point that even when managed by
Appliance, the Upgrades page still provides valuable information to
administrators, and so we may or may not actually want to leave this the
way it is.

TODO:
- [ ] Change the URL that is pointed to when the env var is active
(listed in a comment)
## Test plan
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Tested manually

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
- **feat(appliance): change update endpoint based on env var**
- **misc: add type to storybook**

---------

Co-authored-by: Craig Furman <craig.furman@sourcegraph.com>
2024-07-31 16:51:56 +00:00
William Bezuidenhout
972ee32351
feat(frontend): do not embed frontend assets anymore (#63946)
* Frontend no longer embeds the assets intead it reads from the local
filesystem assets.
* Generally the frontend and server cmd targets will use the
`//client/web/dist:copy_bundle` target to create a tarball for the
oci_image. `copy_bundle` puts all the assets at `assets-dist`
* For integration tests, frontend and server have the `no_client_bundle`
target variants. For these oci_images, instead of the `tar_bundle` which
is just a tar'd `copy_bundle` we use the `tar_dummy_manifest` which is
just a tar that contains a dummy manifest.
* By default we expect assets to be at `/assets-dist`
* Renamed DevProvider to DirProvider

## Why
By 'breaking' the dependency of frontend requiring assets to be built we
essentially stop a common cache invalidation scenario that happens:
- someone makes a frontend change = assets need to be rebuilt

By decoupling assets from the frontend binary and moving the packing of
assets to the building of the frontend and server images we will have a
better cache hit rate (theoretically).

Thus with this change, when:
* client/web is change and nothing else ... only assets will have to
rebuilt and cached versions of the backend will be used
* if only backend code has changed ... cached assets will be used

Closes DINF-115

## Test plan
  sg start - web app opens and can search. Local dev assets get loaded
 sg test bazel-integration-test - server image gets built with **only**
dummy web manifest. Also verified by running `sg bazel run
//cmd/server:no_client_bundle.image` and then inspect container
 sg test bazel-e2e - server image gets built with bundle and all tests
pass
 [main dry
run](https://buildkite.com/sourcegraph/sourcegraph/builds/284042#0190e54c-14d9-419e-95ca-1198dc682048)

## Changelog
- frontend: assets are no longer bundled with binary through `go:embed`.
Instead assets are now added to the frontend container at `assets-dist`.
2024-07-31 15:17:52 +02:00
Vova Kulikov
c8fd001892
Bump cody web to most recent package @sourcegraph/cody-web (#64149)
A few things this PR does
- Update cody web to the most updated version and package name which is
(`@sourcegraph/cody-web`)
- Support custom telemetry name for cody web events (on dotcom it should
be `dotcom.web` and `server.web` on the enterprise instance
- The most updated release of Cody Web includes
   - fixes for remote LLM models on enterprise 
   - improvements for performance rendering Chat UI
   - telemetry fixes

## Test plan
- Manual checks over Cody Web chat UI (standalone chat page and the blob
UI side panel chat)
2024-07-30 12:34:43 -03:00
Michael Bahr
e8c1ffeef5
fix: add commit signing filter to credentialForGitHubAppExists (#64128)
This is a follow up to
https://github.com/sourcegraph/sourcegraph/pull/64120 so that it doesn't
mix up alerts between commit signing and code hosts for site admins.

## Test plan

Manual testing + CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-29 13:52:06 +00:00
Michael Bahr
67c9a09059
fix: connection pending alert and alert content alignment (#64120)
When there is already a global token, then the notice after installing a
personal app is wrong. This PR handles this issue, so that the notice
shows up as expected.

We also fix an alignment issue, where the call to refresh the page would
be in a distinct column, instead of what we'd expect.

## Test plan

Manual testing

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-29 07:46:23 -05:00
Michael Bahr
3ff0ddf1cb
fix(batches): switch github app installation handling from redirect flow to webhooks (#64036)
Closes SRCH-741
Closes SRCH-716

This PR removes the GitHub installation code from the redirect flow to a
webhook-based appraoch. We expect that the GitHub server calls the
webhook when the installation is ready, and therefore shouldn't see the
errors explained in the issues above.

To handle the potential delay until the webhook is called and the
credential is set up, I added a scrappy info notice that the user should
refresh their page:

<img width="928" alt="Screenshot 2024-07-24 at 13 48 24"
src="https://github.com/user-attachments/assets/4d298f2a-d7b8-423b-9e2f-2ae53fbce1ac">

Below is what you see after you refreshed (or if the webhook was called
faster than the user being redirected back to the settings):

<img width="929" alt="Screenshot 2024-07-24 at 13 50 14"
src="https://github.com/user-attachments/assets/b6826158-8561-476d-b20e-e36f8cfb86fd">

I'm able to create PRs for sourcegraph-testing with an app that was
created this way.

<img width="1171" alt="Screenshot 2024-07-24 at 16 16 06"
src="https://github.com/user-attachments/assets/86e20acb-136f-4a46-a33b-bdfdd0d51d71">

I'm seeing an error when getting an access token with a personal github
app to run a batch change, but that will be handled with another PR.

<img width="1053" alt="Screenshot 2024-07-24 at 16 38 38"
src="https://github.com/user-attachments/assets/5655ba91-1ae4-453a-8d5c-1bcdbe34bc17">

## Test plan

Manual testing locally, and more testing to be done on S2 where we have
a more production like environment

## Changelog

- When installing a GitHub app for batch changes, the instance now waits
for a callback from GitHub to complete the installation to avoid issues
from eventual consistency.

---------

Co-authored-by: Peter Guy <peter.guy@sourcegraph.com>
2024-07-26 11:53:34 +00:00
Petri-Johan Last
64ac259ab5
[fix] Fix being unable to add batch changes credentials when rate limited (#63984) 2024-07-26 11:07:59 +02:00
Anton Sviridov
7e5b52ea67
Syntactic indexing policy toggle: UI and supporting APIs (with backcompat) (#64075)
Fixes GRAPH-751
Fixes GRAPH-636

Reverts sourcegraph/sourcegraph#64046 which itself was a revert of
https://github.com/sourcegraph/sourcegraph/pull/63876 due to backwards
compatibility concerns.

This new PR adds two extra commits which restore the `indexingEnabled`
field, and make `syntacticIndexingEnabled` field optional.

---

Fixes GRAPH-636
Fixes GRAPH-751

This PR aims to allow admins to enable syntactic indexing on per-policy
basis using the existing UI and APIs with the following amendments:

- New UI toggle for syntactic indexing – **only visible if the
experimental feature is enabled** (see screenshots below)
- New field in GraphQL API for syntactic indexing
- New Go resolvers to handle the new field

To support this on the backend, we also update the policies handling
code and SQL queries to ensure we can retrieve and update the
`syntactic_indexing_enabled` field.

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

- Backend part covered by updated policies tests
- Manual testing of UI

With experimental feature **enabled**:

![CleanShot 2024-07-22 at 12 56
56](https://github.com/user-attachments/assets/e95aa224-be9a-40a6-9e42-6f409478e2fc)

With experimental feature **disabled**:
![CleanShot 2024-07-22 at 12 57
21](https://github.com/user-attachments/assets/0d46a65d-95bc-4695-a3df-ad9aa86dbd36)

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

- In site-admin APIs for updating code intelligence policies:
  - field `indexingEnabled` is renamed to `preciseIndexingEnabled`
- a required `syntacticIndexingEnabled` is added (only takes effect if
experimental feature is enabled)
  - field `forIndexing` is renamed to `forPreciseIndexing`

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-25 20:03:56 +01:00
Varun Gandhi
2644e24244
fix: Fix Chrome stack overflow during highlighting (#64072)
Using the spread operator with large arrays can trigger a
stack overflow in Chrome/V8. For example, see:
- https://github.com/nodejs/node/issues/16870

In a highlighting context, we can have 10k-100k occurrences
in a file, so let's avoid using the spread operator.

Fixes https://linear.app/sourcegraph/issue/GRAPH-772

## Test plan

Manually tested against sample file.

![](https://github.com/user-attachments/assets/e096c664-063e-44ed-a991-72629af36651)

## Changelog

- Fixes a Chrome-specific stack overflow when highlighting large files.
2024-07-25 11:50:03 +08:00
Michael Lin
56817a7a9e
Revert "Syntactic indexing policy toggle: UI and supporting APIs" (#64046)
Reverts sourcegraph/sourcegraph#63876
https://sourcegraph.slack.com/archives/CHXHX7XAS/p1721835847010889

### Test plan

CI
2024-07-24 15:59:48 +00:00
Anton Sviridov
c14f892e9f
Syntactic indexing policy toggle: UI and supporting APIs (#63876)
Fixes GRAPH-636
Fixes GRAPH-751

This PR aims to allow admins to enable syntactic indexing on per-policy
basis using the existing UI and APIs with the following amendments:

- New UI toggle for syntactic indexing – **only visible if the
experimental feature is enabled** (see screenshots below)
- New field in GraphQL API for syntactic indexing
- New Go resolvers to handle the new field

To support this on the backend, we also update the policies handling
code and SQL queries to ensure we can retrieve and update the
`syntactic_indexing_enabled` field.

<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->

## Test plan

- Backend part covered by updated policies tests
- Manual testing of UI

With experimental feature **enabled**:

![CleanShot 2024-07-22 at 12 56
56](https://github.com/user-attachments/assets/e95aa224-be9a-40a6-9e42-6f409478e2fc)

With experimental feature **disabled**:
![CleanShot 2024-07-22 at 12 57
21](https://github.com/user-attachments/assets/0d46a65d-95bc-4695-a3df-ad9aa86dbd36)

<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->

## Changelog

- In site-admin APIs for updating code intelligence policies:
  - field `indexingEnabled` is renamed to `preciseIndexingEnabled`
- a required `syntacticIndexingEnabled` is added (only takes effect if
experimental feature is enabled)
  - field `forIndexing` is renamed to `forPreciseIndexing`

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-24 13:57:33 +01:00
Stefan Hengl
40a436d159
fix(search_jobs): flickering placeholder component (#64009)
We have to use `debouncedSearchTerm` to give the paginated fetcher some
time to fetch the new results.

## Test plan:
visual inspection
2024-07-24 10:02:08 +02:00
Stefan Hengl
b2014e6abb
chore(search_jobs): improve description on main page (#63992)
The current description doesn't do a good job of explaining why Search
Jobs is useful and how to create a job.

## Test plan:
visual inspection

Co-authored-by: Erik Seliger <erikseliger@me.com>
2024-07-23 09:49:24 +02:00
Keegan Carruthers-Smith
48d61c44d3
cody: correct link to emacs-cody (#63974)
Test Plan: clicked link in editor to see if correct

Fixes https://github.com/sourcegraph/emacs-cody/issues/33
2024-07-23 09:40:49 +02:00
Quinn Slack
1ce261c4bf
fix incorrect URL (/new) on saved search and prompt library pages (#63995)
Also update page title.

Fixes
https://linear.app/sourcegraph/issue/CODY-3026/when-the-new-fast-ui-is-enabled-the-new-button-on-saved-searches-and

## Test plan

CI
2024-07-22 16:27:02 -06:00
Quinn Slack
1fe876e89c
finish removing chromatic (#63966)
We removed Chromatic in
https://github.com/sourcegraph/sourcegraph/pull/62228, but there were
still some remnants.

## Test plan

CI
2024-07-21 18:37:02 -07:00
Quinn Slack
30c0184f25
various OrgArea fixes (#63962)
- Make it a React function component (not class componnt)
- Remove prop drilling for isSourcegraphDotCom to remove a bunch of code
- fix issue in Back button after clicking to an org from the site admin
orgs page. Repro: 1. Go to /site-admin/organizations. 2. Click on an
org. 3. Click the browser's back button. This was already being done for
the user routes.

## Test plan

Repro described above
2024-07-20 20:45:32 -07:00
Camden Cheek
781aebb13a
Svelte rollout: add toggles for svelte-enabled pages (#63960)
This is the last bit of work before flipping the switch on dotcom.
Implemented based on the behavior @taiyab and I aligned on this morning.
Can definitely still use a little sparkle, but I'll let others follow up
on that.

It adds a toggle button to all pages that we have a svelte version of.
The toggle is off when you're in the react webapp and on when you're in
the svelte webapp. It also updates the copy of the popover to be more
appropriate for the dotcom crowd.
2024-07-19 16:56:08 -06:00
Quinn Slack
f63371392a
fix saved searches and prompts list page for anon users (#63961)
Anonymous visitors to Sourcegraph.com were unable to list all public
saved searches (at https://sourcegraph.com/saved-searches) and prompts
(at https://sourcegraph.com/prompts) for 2 reasons:

1. The namespace selector (filter) was broken for anonymous users and
returned an error. Fixed this by just handling this case.
2. The GraphQL resolvers for `savedSearches` and `prompts` prevented
anonymous users from listing items because there was no affiliated user
and thus the anonymous user was essentially trying to list all. Fixed
this by adding a new and well-tested code path for listing only public
saved searches or prompts.

## Test plan

In dotcom mode, visit those 2 pages (`/saved-searches` and `/prompts`).
2024-07-19 15:43:04 -07:00
Quinn Slack
4918fa7eef
show org name not displayName in most places (#63907)
Previously, organizations would be displayed using their `displayName`,
which was inconsistent and non-canonical. The `displayName` is also
longer, so it's not suited to display in select menus and other similar
places.

For example, when viewing the user menu or creating a batch change or
saved search, the dropdown will now show `sourcegraph` instead of
`Sourcegraph` (where the latter is the display name).


![image](https://github.com/user-attachments/assets/79bce594-49c9-4603-9757-2e6785b26be9)


## Test plan

Go to create a batch change or saved search and confirm that org names
not displayNames are shown.

## Changelog

- The user menu and other filter menus now show the names of
organizations, not their "display names", to avoid ambiguity. For
example, these menus will now show `abc-corp` not `ABC Corp` (if the
latter was the `abc-corp`'s display name).
2024-07-19 12:30:09 +00:00
Quinn Slack
2451aab9f8
saved searches & prompt library fixes (#63930)
- Add spacing at bottom of page
- Fix viewerCanAdminister check to return `false` not an error when the
user is not an administrator of a saved search or prompt
- Improve display of prompt description


## Test plan

In dotcom mode, try loading a prompt or saved search in incognito mode.
2024-07-19 08:41:47 +00:00
Quinn Slack
3c8b8e9e25
show "Copied" indicator when copying an access token (#63936)
For some reason, the indication that the text was copied was removed for
secrets. The indication does not show the secret value itself, so I
don't see why that change was made. It is helpful to the user to give
them feedback that the secret was in fact copied.


## Test plan

Click the copy button after creating an access token
2024-07-19 01:21:07 -07:00
Quinn Slack
6f0c1358e9
remove "organizations aren't supported" page on dotcom (#63932)
We want to support orgs on dotcom for grouping prompts in the Prompt
Library. Note that creating orgs was never actually disabled in the API,
so this was ineffectual anyway.


## Test plan

View the user settings area sidebar in dotcom mode and ensure the new
org button is shown.
2024-07-19 01:20:56 -07:00