Commit Graph

8738 Commits

Author SHA1 Message Date
Felix Kling
975b14f244
fix(svelte): Don't animate menu icon (#64358)
Fixes srch-858

Currently the menu icon rotates when hovering over it. The animation
should only target the Sourcegraph logo.

Additional changes:

- Move icon color style prop into CSS declaration (avoids inserting an
additional element)
- Let the animation target the link instead of the icon. There doesn't
seem to be reason why we actually need to target the `svg` element via
`:global`.


## Test plan

Manual testing.
2024-08-08 11:35:39 +00:00
Felix Kling
1c729823d5
refactor(svelte): Improve integration with sg (#64333)
There currently isn't a 'one step' way to start a local Sourcegraph
instance with the SvelteKit app.

This commit adds `sg start enterprise-sveltekit` to fix that.

The changes in https://github.com/sourcegraph/sourcegraph/pull/64272
allow us to run the vite dev server in front of the Sourcegraph
instance, instead of building the assets and having them served by
frontend.
This gives us the benefit of hot module reloading and in general seems
to be a less fragile approach.

It's basically the same what we do with the React app in development
mode.

## Test plan

`sg start enterprise-sveltekit` starts the vite dev server as well as
the sourcegraph instance. Navigating to
`https://sourcegraph.test:3443/search` opens the Svelte app (when
enabled and logged in). Making a change in a source file updates the web
page immediately.

`sg start web-sveltekit-standalone` still works
2024-08-08 11:39:26 +02:00
Felix Kling
cf5467150b
fix(svelte): Improve hovercard UI for search based info (#64350)
I don't know why but having `overflow-x` causes the content of the
hovercard to not fully expand to the edges. It has something to do with
the sizing of the `hr` element.


## Test plan

Manual testing.
2024-08-08 09:36:49 +00:00
Felix Kling
bcc816ac52
feat(svelte): Support 'got to defintion' for multiple definitions and 'find implementations' (#64349)
This commit adds the necessary logic to open the explorer tab for
multiple references and for implementations. I basically copied what
@camdencheek did for the references tab.


## Test plan

Hover over `adapt` in
http://localhost:5173/github.com/sveltejs/kit@65931f276ac2102032e3032c864a472eee19b7bb/-/blob/packages/kit/src/exports/vite/index.js?L890
and click 'got to definition'. The explore panel with should open with
the definitions tab selected.

I wasn't able to test the find implementations logic because I don't
know for which language we have this implemented.
2024-08-07 21:18:59 +00:00
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
Felix Kling
e4e1f55026
fix(svelte): Properly redirect to cody marketing page (#64331)
Fixes srch-851

A consequence of https://github.com/sourcegraph/sourcegraph/pull/64272
is that redirecting to the cody marketing page on dotcom didn't work.
That's because `/cody` is not provided by the server as a known page.

A simple fix would be to mark the link as external, but we'd have to
keep in mind to do this in all places (present and future).

A more "central" fix is to add this page to a hardcoded list of known
pages that are not provided by the server.


## Test plan

Manual testing
2024-08-07 15:24:02 +02:00
Felix Kling
2e0a3ee92e
fix(svelte): Better preloading in file tree (#64327)
Currently the link element doesn't extend to the full width of the
sidebar. You can click outside of the actual text to navigate to the
file, but it won't be preloaded.

Now the link occupies the full width.

## Test plan

Manual testing.
2024-08-07 15:23:35 +02: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
Felix Kling
ebaab129ee
feat(svelte): Add support for creating search jobs from search results (#64308)
Closes srch-838

This commit extends the search progress popover and adds the search jobs
section.

In the React version the UI for the popover differs slightly when search
jobs are enabled vs not enabled.

I decided to ignore the differences and only impolemented the style used
for the 'search jobs enabled' version, which makes the popover a bit
more compact.

The logic for validating and creating a search job is encapsulated in a
class which makes it easy to conditionally show the search jobs UI.

Additional changes:

- Skipped items is now a list and uses `<details>` elements which is
semantically more correct. We loose the styling of the chevron but I
think that's OK.
- LoadingSpinner was updated to work inline.
- Logging was fixed (?) in the React version to send the correct
meta-data.
- Added integration tests for the search job popover behavior

## Test plan

Integration tests and manual testing.
2024-08-07 14:25:35 +02: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
6ee444656c
Fix Cody Web Svelte Sidebar (#64320)
Cody's Web Sidebar in Svelte is not following the theme when tested
locally.

This PR fixes that. I have tested this with multiple builds both with &
without the diff.

## Test plan

Before:

![image](https://github.com/user-attachments/assets/b2c669fa-a0a7-4dc7-9440-8fca7aa69fd5)

After:
![CleanShot 2024-08-07 at 12 20
19@2x](https://github.com/user-attachments/assets/66bda613-d811-47d0-b0c5-23707e60f875)


## Changelog

<!-- OPTIONAL; info at
https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c
-->
2024-08-07 07:27:23 +00: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
02fb199189
chore(svelte): Add manual entries for repo sub pages to development proxy (#64313)
I noticed that non-svelte repo subpages haven't been redirected to the
React app in local development (it works as expected in production).

That's because the proxy doesn't know about them since they are not part
of `knownRoutes`.
We could update the server code to include those routes as well but that
seems heavey handed just to make local development work.

I think in this case it's fine to have manual entries for the handful of
repo subpages that have not been migrated to Svelte yet.

## Test plan

Manual testing.
2024-08-06 15:46:33 -06:00
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
Felix Kling
c414477bee
fix(svelte): Center file tree loading indicator (#64309)
We should probably redesign the whole loading state but this simple
change is still better than the current behavior.

| Before | After |
|--------|--------|
|
![2024-08-06_21-00_1](https://github.com/user-attachments/assets/015d47d3-9542-4d72-b422-56975723576c)
|
![2024-08-06_21-00](https://github.com/user-attachments/assets/0e667bc2-496e-4169-806d-b49757681673)
|

## Test plan

Manual testing.
2024-08-06 21:20:49 +02:00
Felix Kling
e4a8ce52da
fix(svelte): Update top-level route list (#64272)
tl;dr: Everything is derived from `window.context.svelteKit.knownRoutes`

*buckle up*

### Context

After the new web app was enabled by default on dotcom I looked at
dotcom data in Sentry to see if there was anything out of the ordinary.
I noticed a high number of errors related to resolving repository
information. The most common non-existing repository that was reported
was `-/sign-out`.

Of course this shouldn't happen. `/-/sign-out` is the sign out URL and
shouldn't be interpreted as a repository.

Currently we prevent SvelteKit from interpreting specific paths as
repositories by using the `reporev` parameter validator:

```ts
// src/params/reporev.ts
const topLevelPaths = [
    'insights',
    'search-jobs',
    'saved-searches',
    // ... many more here
]

const topLevelPathRegex = new RegExp(`^(${topLevelPaths.join('|')})($|/)`)

// This ensures that we never consider paths containing /-/ and pointing
// to non-existing pages as repo name
export const match: ParamMatcher = param => {
    // Note: param doesn't have a leading slash
    return !topLevelPathRegex.test(param) && !param.includes('/-/')
}
```

`-/sign-out` was not in that list, including others which have been
added since this file was originally created.

Adding it would have been the simple solution but having to maintain
this list manually has always irked me. Now we have a better way...

### Production changes

#### Client side

It turns out we are already sending a list of known routes to the client
in `window.context.svelteKit.knownRoutes` to basically do the same
thing: test whether a given path is a page or a repository.

```ts
// src/lib/navigation.ts
let knownRoutesRegex: RegExp | undefined

function getKnownRoutesRegex(): RegExp {
    if (!knownRoutesRegex) {
        knownRoutesRegex = new RegExp(`(${window.context?.svelteKit?.knownRoutes?.join(')|(')})`)
    }
    return knownRoutesRegex
}

// ...

export function isRouteEnabled(pathname: string): boolean {
    let foundRoute: SvelteKitRoute | undefined
 
    // [...]

    if (foundRoute) {
        if (foundRoute.isRepoRoot) {
            // Check known routes to see if there is a more specific route than the repo root.
            // If yes then we should load the React app (if the more specific route was enabled
            // it would have been found above).
            return !getKnownRoutesRegex().test(pathname)
        }
        return true
    }

    return false
}
```

Why do we have the `reporev` validator and `isRouteEnabled`? They
basically do the same thing (check whether a path is a known page or a
repository) the first (`reporev`) is used by SvelteKit to determine
which route a path corresponds to (i.e. to navigate to the repository
page or whether the page doesn't exist) and the second one
(`isRouteEnabled`) is used after the route resolution but before route
loading. It's used to trigger a full page refresh to fetch the React
version if necessary.

Anyways, since we already have a list of known pages from the server,
the parameter validator should just use it too. Except it didn't work,
which made the following server side changes necessary.

#### Server

We register routes in multiple places. Right now `knownRoutes` is
populated from the router created in
`cmd/frontend/internal/app/ui/router.go`, but this does not include
`/-/sign-out`. This route (and others) are defined in
`cmd/frontend/internal/app/router/router.go` (I don't know what the
difference is). I extended the sveltekit route registration code so
that's possible to register routes from multiple routers.

I couldn't test it yet however because I currently can't get Sourcegraph
to run locally (Camden tested it; it works).

### Development mode changes

After the above changes, navigating to a React only page in development,
e.g. `/insights` would show a 'repo not found error' because
`window.context.svelteKit.knownRoutes` was empty in development. So
every non-existing page would be interpreted as missing repository.

Hardcoding a list of known pages *again* just for development seemed to
be a step backwards. So I spent quite a bit of time to find a way to
extract the JS context object from the HTML page returned by the origin
server and inject it into the HTML page generated by SvelteKit, similar
to how we do it for the React app.

Additionally the value of `window.context.svelteKit.knownRoutes` is now
used to setup the proxy to non-supported pages from the server, so we
don't have to maintain this regex anymore either:

```ts
 // Proxy requests to specific endpoints to a real Sourcegraph
 // instance.
 '^(/sign-(in|out)|/.assets|/-|/.api|/.auth|/search/stream|/users|/notebooks|/insights|/batch-changes|/contexts)|/-/(raw|own|code-graph|batch-changes|settings)(/|$)': { ... }
```

This means that requesting non-svelte pages will also return the
corresponding React version in development.


## Test plan

Manual testing.
2024-08-06 09:53:50 +00: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
Camden Cheek
b9823cc90b
Svelte: remove site admin gate on code intel preview (#64277)
When I added this, for some reason I thought it was site admin only. As
it turns out, it shouldn't be gated to site admins only, and it makes it
particularly annoying on dotcom.
2024-08-05 23:59:15 +00: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
Felix Kling
4e5ea2a082
refactor(svelte): Reduce logo complexity (#64274)
There is no need to have a separate image file for dark mode. The SVG
file can handle color switching itself.


## Test plan

Switched theme in the user menu and in the browser dev tools.
2024-08-05 18:19:32 +02:00
Camden Cheek
44d8512779
Svelte: make closing the welcome overlay more obvious (#64256)
In response to [this
request](https://sourcegraph.slack.com/archives/C05MW2TMYAV/p1722633022111559),
I modified the welcome banner to:
- Add a close button in the top right
- Close on click outside the banner
- Make the button primary rather than secondary
2024-08-05 08:51:40 -06: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
c643c224ab
Chore: remove non-null assertions (#64249)
Followup from #64236
2024-08-02 15:01:48 -06: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
Camden Cheek
b4566aae8a
Svelte: fix welcome banner flashing on reload (#64251)
Fixes SRCH-831
2024-08-02 17:16:57 +00:00
Taiyab Raja
e652c7e59e
Styling updates throughout (#64221)
Resurrection of https://github.com/sourcegraph/sourcegraph/pull/64080 --
full details are there
2024-08-02 15:15:06 +00: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
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