Commit Graph

8709 Commits

Author SHA1 Message Date
Camden Cheek
ee3a710b7c
Chore: remove enablePreciseOccurrences feature flag (#64229)
Just removes a redundant feature flag.
2024-08-02 00:02:53 +00: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
Vova Kulikov
50dbc74fba
Bump @sourcegraph/cody-web to 0.3.2 (#64195)
This PR brings the most recent version of @sourcegraph/cody-web package
- Improvements in how we fetch providers and debounce logic for their
query
- Fix with switching-chat actions and providers list 

## Test plan
- Manual checks over cody web (React and Svelte version)
2024-08-01 12:01:35 -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
Jason Hawk Harris
6f5de6ded7
Nit: adds space between tools menu item and dropdown icon (#64154)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
Before: 
<img width="98" alt="Screenshot 2024-07-30 at 11 24 29 AM"
src="https://github.com/user-attachments/assets/b62700ab-6cf9-499c-a2dd-8241587abd35">

After: 
<img width="104" alt="Screenshot 2024-07-30 at 11 24 09 AM"
src="https://github.com/user-attachments/assets/16bc4153-5607-4818-8504-4b4ec54128a0">


## Test plan
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Manual/Visual testing
2024-07-30 16:35:58 +00:00
Vova Kulikov
eabc522ff0
Svelte: Bump cody web to most recent package @sourcegraph/cody-web (#64152)
The same changes that we did in
https://github.com/sourcegraph/sourcegraph/pull/64149
but for the Svelte version of the app. 

- Update cody web to the `@sourcegraph/cody-web:0.3.0`
- Fix the telemetry name 
- Rendering improvements in cody chat UI
- Change status from experimental to beta

## Test plan
- Manual checks over cody web in the svelte version
2024-07-30 09:11:37 -07: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
Jason Hawk Harris
e0fa2bd66e
SvelteKit: fix issue where clicking link with no href refreshed the page (#64136)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
When clicking a menu item with no href, page refreshed every time. Now,
menu items with no href cause no action when clicked.


https://github.com/user-attachments/assets/abcc5164-64fa-4b37-8f8c-7df110bca23e

This is a follow up to this PR:
https://github.com/sourcegraph/sourcegraph/pull/64134

## Test plan
Manual/Visual testing
<!-- 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-07-29 19:57:49 +00:00
Jason Hawk Harris
288a7b6b83
SvelteKit: Add 'Tools' Menu item back to global navigation (#64134)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
This PR adds the `Tools` Menu Item back to the Global Navigation Bar of
the svelte-kit web app, and removes the sub menus for both `Code Search`
and `Cody` menu items.

Before:
![Screenshot 2024-07-29 at 11 45 12
AM](https://github.com/user-attachments/assets/b7d5a42c-b297-4db0-9ddc-21231f9b2529)

After: 
![Screenshot 2024-07-29 at 11 44 37
AM](https://github.com/user-attachments/assets/3abcfa1a-7922-4f25-8dbb-efa84698c24c)
 

## Test plan
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Visual/manual testing
Passing CI

## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-29 19:33:44 +00:00
Camden Cheek
0a0bb77b3b
Svelte: do not show path section if empty (#64135)
Fixes SRCH-788
2024-07-29 19:06:29 +00:00
Michael Bahr
ace1d8872e
chore: remove flaky flag from svelte e2e_test (#64123)
Test have been stable since
https://github.com/sourcegraph/sourcegraph/pull/63910. See
https://buildkite.com/organizations/sourcegraph/analytics/suites/sourcegraph-bazel/tests/e143a9fc-8857-83f0-8cfb-03e1c6f48f7b?branch=main

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-29 08:54:53 -06: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
Jason Hawk Harris
b212aff5dd
Svelte Navigation: hide teams when own is not enabled (#64110)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
Teams option in the user menu will be hidden when own is not enabled. 

Own Enabled: 
![Screenshot 2024-07-26 at 11 54 50
AM](https://github.com/user-attachments/assets/1f095fa4-bbb7-416c-89aa-6e79bbc02756)

Own Not Enabled: 
![Screenshot 2024-07-26 at 11 54 25
AM](https://github.com/user-attachments/assets/e87c7dd8-fdeb-4a11-9688-7d39df972f8a)

## Test plan
<!-- REQUIRED; info at
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles
-->
Visual/Manual testing

## Changelog
<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-26 10:25:41 -07:00
Jason Hawk Harris
a8b3e8e7f5
Blob search: Fix incorrect icons in the blob search bar (#64108)
<!-- PR description tips:
https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e
-->
Switch from Lucide icons to MDI which look better in this case. 

Before:
![Screenshot 2024-07-26 at 10 58 55
AM](https://github.com/user-attachments/assets/a0ee0f72-9c32-41c4-be7b-88eb050eaa1a)

After: 
![Screenshot 2024-07-26 at 10 58 41
AM](https://github.com/user-attachments/assets/6834c1a2-bd8e-4b6d-8229-f2f3dc1daa62)


## Test plan
Manual/Visual testing
<!-- 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-07-26 11:19:03 -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
Michael Bahr
cc1f52f259
feat: order search filters alphabetically (#63976)
Closes SRCH-771

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-22 16:33:44 -07: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
Vova Kulikov
492ddef497
Svelte: Fix Safari 17.3 groupBy usage (#63964)
Currently, svelte build of Sourcegraph is broken on s2 and dotcom for
users who use Safari 17.3 and lower
The problem is that we use the `Object.groupBy` method, which isn't
supported in "old" Safari versions like 17.3 and lower. See caniuse
documentation about this here https://caniuse.com/?search=groupBy (in
the old Safari version this method is actually named `groupToMap`

## Test plan
- Check basic functionality Search flow in Safari (especially in Safari
17.3)

<!-- 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-07-19 18:43:29 -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
Camden Cheek
033cb9d901
Search: add regex support to repo:has.meta() (#63891)
This adds support to searching for repo metadata with a regex pattern.

Background: repo metadata is a useful feature for shoehorning
business-specific information into the search query language. It allows
tagging repos with arbitrary metadata (think ownership info, quality
info, 3rd-party system IDs, etc.). This ends up being a useful escape
hatch to shim in functionality that is not natively supported in
Sourcegraph.

However it's currently limited to searching with an exact key/value
pair. We've had a few requests to extend this to allow searching by
pattern because it enables ingesting semi-structured data and making it
searchable.

This adds the ability to use a `/.../`-delimited regex pattern to match
against both keys and values. For example,
`repo:has.meta(team:/^my\/org/)`
2024-07-19 11:53:24 -06:00
Michael Bahr
36eb1b991e
chore(svelte): fix test by removing duplicate aria-label (#63942)
The test that I enable in this PR has been skipped for a while, and has
broken again with https://github.com/sourcegraph/sourcegraph/pull/63463,
where we added another aria-label. This additional label lead to
playwright rejecting the test, because it found two elements for one
query.

This PR removes that label, since we already have a similar one at the
button one level up. See screenshot below.

<img width="1001" alt="Screenshot 2024-07-19 at 11 22 24"
src="https://github.com/user-attachments/assets/9b36e157-7c53-42f2-b309-e18c45e631a3">

## Test plan

CI

## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-07-19 08:35:26 -06: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
238831741e
use the viewerSettings GraphQL API instead of the 5y+-deprecated viewerConfiguration API (#63949)
This API is deprecated (see
https://github.com/sourcegraph/sourcegraph/pull/63935). The browser
extension is still using it, and we need this PR to remove its usage,
and then we need to publish it. Then we can pick up
https://github.com/sourcegraph/sourcegraph/pull/63935 again.

## Test plan

Confirm that the browser extension uses the new GraphQL query (in the
background page network devtools tab).
2024-07-19 11:42:25 +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
Felix Kling
0bf40cd83b
fix(svelte): Fix and cleanup compare page (#63928)
I just noticed that the revision pickers on the compare page don't work.
That's because I made a last minute change to rename the parameter but
forgot to acutally update the parameter when constructing the URL.

This also makes two additional changes:
- Remove `{@debug ...}` expression that was accidentally left in (I feel
like Svelte should remove this in prod builds).
- Adds a `display` prop to button group, and the rev picker, which works
the same as in `Button`. Setting `width: 100%` as done previously causes
wrapping on the compare page. I don't think inline elements should be
set to 100% width. But without it the button doesn't stretch in the
sidebar. This new prop allows the caller to influence this behavior.

| Before | After |
|--------|--------|
|
![2024-07-19_00-59](https://github.com/user-attachments/assets/53b9942d-ebf9-4677-8c65-21cd38e78e44)
|
![2024-07-19_01-05](https://github.com/user-attachments/assets/c38ee133-7ee7-4923-ae22-caad9e2472f1)
|

## Test plan

Tested the compare page and verified that the revision picker stretches
in the sidebar.
2024-07-19 05:43:48 +00:00
Quinn Slack
b4e03f45b0
Prompt Library (#63872)
The Prompt Library lets you create, share, and browse chat prompts for
use with Cody. Prompts are owned by users or organizations, and site
admins can make prompts public so that all users on the instance can see
and use them.

A prompt is just plain text for now, and you can see a list of prompts
in your Prompt Library from within Cody chat
(https://github.com/sourcegraph/cody/pull/4903).

See https://www.loom.com/share/f3124269300c481ebfcbd0a1e300be1b.

Depends on https://github.com/sourcegraph/cody/pull/4903.


![image](https://github.com/user-attachments/assets/d1098809-f7ff-4233-8ecb-9bc53ad4dbb2)


## Test plan

Add a prompt on the web. Ensure you can access it from Cody.

## Changelog

- The Prompt Library lets you create, share, and browse chat prompts for
use with Cody. Prompts are owned by users or organizations, and site
admins can make prompts public so that all users on the instance can see
and use them. To use a prompt from your Prompt Library in Cody, select
it in the **Prompts** dropdown in the Cody chat message field.
2024-07-18 16:04:55 -07:00
Quinn Slack
fcdcfef706
add saved search visibility, draft, and timestamps (#63909)
**Public saved searches will let us make global saved searches for
dotcom and for customers to help them discover and share awesome search
queries!**

Saved searches now have:

- Visibility (public vs. secret). Only site admins may make a saved
search public. Secret saved searches are visible only to their owners
(either a user, or all members of the owning org). A public saved search
can be viewed by everyone on the instance.
- Draft status: If a saved search's "draft" checkbox is checked, that
means that other people shouldn't use that saved search yet. You're
still working on it.
- Timestamps: The last user to update a saved search and the creator of
the saved search are now recorded.

Also adds a lot more tests for saved search UI and backend code.


![image](https://github.com/user-attachments/assets/a6fdfa54-61c5-4a0f-9f04-1bdf34ae3ad4)

![image](https://github.com/user-attachments/assets/a29567a0-9cfa-4535-99b6-7ffb4aea4102)

![image](https://github.com/user-attachments/assets/e287e18c-0b88-451d-b1c8-a26987e7ec47)


## Test plan

Create a saved search. Ensure it's in secret visibility to begin with.
As a site admin, make it public. Ensure other users can view it, and no
edit buttons are shown. Try changing visibility back and forth.

## Changelog

- Saved searches can now be made public (by site admins), which means
all users can view them. This is a great way to share useful search
queries with all users of a Sourcegraph instance.
- Saved searches can be marked as a "draft", which is a gentle indicator
that other people shouldn't use it yet.
2024-07-18 13:37:41 -07:00
Felix Kling
f983676e65
feat(svelte): Improve commit page layout on mobile (#63920)
I noticed that the commit page doesn't render well on mobile when the
commit has a commit message.

This commit refactors how the `Commit` component is rendered, including
on mobile, which affects both the commit**s** and the commit page.

The two most important changes:

- The component now uses CSS grid to be more flexible about how
individual elements are arranged.
- On mobile we don't show expand the message inline anymore but instead
show it full screen. I think that works well for the commits list too
because now you can open and read a longer commit message without having
to scroll the commits list itself.

## Test plan

Manually inspecting the commits and commit pages. Opened a long commit
message to test that the message is properly scrollable.
2024-07-18 22:02:16 +02:00
Felix Kling
462ff95169
feat(svelte): Change branch and tags page design, including mobile (#63914)
The branches page didn't work well on mobile and neither did the tags
page if long tag names were present.

This commit changes how the information is displayed and rendered,
especially on mobile.

I also added additional links to each row to make navigating to relevant
places easier.

## Test plan
 
Manual inspection of pages in various screen sizes.
2024-07-18 21:33:51 +02:00