Commit Graph

23 Commits

Author SHA1 Message Date
Robert Lin
857d5200b3
feat/dotcom: use Enterprise Portal for Cody Gateway usage (#63653)
Closes https://linear.app/sourcegraph/issue/CORE-211

See https://linear.app/sourcegraph/issue/CORE-100 for a higher-level
view - this is the first proof-of-concept for achieving our migration
strategy to extract Enterprise subscription data out of dotcom while
retaining the existing UI until a future project ships a dedicated
Enterprise Portal UI
(https://linear.app/sourcegraph/project/kr-p-enterprise-portal-user-interface-dadd5ff28bd8).

The integration uses generated ConnectRPC client code + `react-query`,
the latter of which has already been used elsewhere for SSC
integrations. This is partly supported by
https://github.com/connectrpc/connect-query-es which offers
mostly-first-class integration with `react-query`, but I had to do some
fenangling to provide the query clients directly as I can't get the
React provider thing to work. The ConnectRPC clients point to the
proxies introduced in
https://github.com/sourcegraph/sourcegraph/pull/63652 which
authenticates the requests for Enterprise Portal, until we ship
https://linear.app/sourcegraph/project/kr-p1-streamlined-role-assignment-via-sams-and-entitle-2f118b3f9d4c/overview

## Test plan

### Local

First, `sg start dotcom`

Choose a subscription you have locally. Use `psql -d sourcegraph` to
connect to local database, then:

```
sourcegraph=# delete from product_licenses where product_subscription_id = '<local subscription ID>';
DELETE 1
sourcegraph=# update product_subscriptions set id = '58b95c21-c2d0-4b4b-8b15-bf1b926d3557' where id = '<local subscription ID>';
UPDATE 1
```

Now annoyingly the UI will break because there is no license, we need:

```gql
query getGraphQLID {
  dotcom {
    productSubscription(uuid:"58b95c21-c2d0-4b4b-8b15-bf1b926d3557") {
      id # graphQL ID
    }
  }
}

mutation createLicense {
  dotcom {
    generateProductLicenseForSubscription(productSubscriptionID:"<graphQLID>", license:{
      tags:["dev"]
      userCount:100
      expiresAt:1814815397
    }) {
      id
    }
  }
}
```

This effectively lets us have a "pretend S2" subscription locally.
Visiting the subscription page now at
https://sourcegraph.test:3443/site-admin/dotcom/product/subscriptions/58b95c21-c2d0-4b4b-8b15-bf1b926d3557


![image](https://github.com/sourcegraph/sourcegraph/assets/23356519/1e77d77d-8032-436b-ab1d-393b34e8e4b5)

The data matches the "real" data currently at
https://sourcegraph.com/site-admin/dotcom/product/subscriptions/58b95c21-c2d0-4b4b-8b15-bf1b926d3557

### Against dotcom

```
sg start web-standalone
```

follow
https://www.loom.com/share/6cb3b3ca475b4b9392aa4b11938e76e6?sid=6cd1a689-d75d-4133-bcff-b0c7d25b23f1
and then check out some product subscriptions
2024-07-10 19:22:08 +00:00
Dan Adler
8275054987
v2t: add v2 telemetry to the client/shared folder (#62586) 2024-06-03 16:34:28 -07:00
Vova Kulikov
c2afde8b43
Svelte: Add basic telemetry to svelte implementation (#62190)
* Move telemetry service to the shared package

* Migrate web to the shared based telemetry

* Add svelte telemetry events

* Run svelte format

* Format:changed

* Format:changed and fix custom log view event handler

* Rebased onto main
2024-04-26 12:56:33 +02:00
Quinn Slack
c9439d9456
OpenCodeGraph prototype (#58675)
This adds support for the OpenCodeGraph prototype. Feature-flagged off by default behind the `opencodegraph` feature flag. See https://www.loom.com/share/5549d92a7c244863ac86ce56692ca030 for more information.

Also, for our CodeMirror, remove `background:transparent` so that line bg applies to block widgets
2023-12-06 21:39:33 -08:00
Quinn Slack
4002774429
reapply "switch from jest to vitest for faster, simpler tests (#57886)" (#58145)
* reapply "switch from jest to vitest for faster, simpler tests (https://github.com/sourcegraph/sourcegraph/pull/57886)"

This was reverted in https://github.com/sourcegraph/sourcegraph/pull/58116 due to an issue with the browser tests.

* include fetch-mock

* fix flakiness

* rm mock that did not work in experimentalVmThreads

* fix

* timeout

* fixup

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
2023-11-07 12:00:18 +02:00
William Bezuidenhout
7f4bebe29d
Revert: bazel+vitest - when running vitests concurrently the target //client/browser:test fails (#58116)
When running vitests concurrently the target //client/browser:test fails

Revert "switch from jest to vitest for faster, simpler tests (#57886)"

This reverts commit ae5325e432.
2023-11-06 14:02:35 +02:00
Quinn Slack
ae5325e432
switch from jest to vitest for faster, simpler tests (#57886)
Replaces our usage of jest with vitest. Also removes the babel transpiler. This simplifies our test configuration by a lot, makes tests run 10% faster, and makes further modernizations to our build/test stuff possible (such as using vite for frontend builds).

This removes some of the junit exporting for Buildkite, and the vitest bazel defs don't really cleanly implement bazel testing guidelines (like sharding). But vitest is only used for unit tests (all integration/e2e/regression tests have always run in mocha), so none of them are very slow anyway.

## Codemods for vitest imports

fastmod -e js,ts,tsx @jest/globals vitest client/ dev/release/
fastmod -e js,ts,tsx 'jest\.(\w+)\(' 'vi.$1(' client/ dev/release/
fastmod -e js,ts,tsx 'jest,' 'vi,' client/ dev/release/
fastmod -e js,ts,tsx 'jest }' 'vi }' client/ dev/release/
git diff --diff-filter=M --name-only | xargs pnpm exec prettier --write
2023-11-05 21:57:04 -10:00
Robert Lin
726a5aff95
client/web: add telemetry v2 client (#57939)
Brings something like https://github.com/sourcegraph/cody/pull/1192 to Sourcegraph's web client, injected as a new `telemetryRecorder` in `PlatformContext`. Because we want to use the only non-deprecated way to make GraphQL requests, Apollo clients, a global events recorder is not provided ([thread](https://sourcegraph.slack.com/archives/C01C3NCGD40/p1698376463350449)) - the shared one can only retrieved from `PlatformContext`.

In non-`web` platforms (`client/browser`) the recorder is currently set to a no-op recorder that errors upon use, as for this PR intended for backport, we only want to add some usages to `web` for Cody events.

To start off, this change adds some new usage of this on a rather out-of-the-way section `permissions-center`, tested manually below.

Closes https://github.com/sourcegraph/sourcegraph/issues/56920
2023-11-02 08:57:03 -07:00
Quinn Slack
90c6683218
remove gulp (task runner) (#57963)
Removed usage of gulp for running commands. Instead, we just use `package.json` scripts (that mostly invoke `ts-node -T ...`). The purpose of removing gulp is to remove a layer of duplication/indirection between the tasks we need to run and where they are defined.

The code generation tasks (GraphQL operations, CSS modules types, and schema/ JSON Schema types) no longer run in watch mode in local dev. If you make changes that require regeneration of this code, run `pnpm run generate` from the root. This is for simplicity and speed (they would run on many unrelated changes and slow down local dev).
2023-10-29 12:09:50 -07:00
Valery Bugakov
ce38bbc724
web: fix pnpm-lock issue (#47478)
Fixes the issue caused by the presence of the `sourcegraph: ''` entry in the `pnpm-lock.yaml`. If we install any new dependency, the `pnpm install` command fails on CI. [Failure example](https://github.com/sourcegraph/sourcegraph/actions/runs/4121774771/jobs/7117792725).
2023-02-09 22:04:31 -08:00
Valery Bugakov
3512fb9aa2
web: sync TS project refenreces (#46407) 2023-01-16 18:55:10 -08:00
Valery Bugakov
304acdb5da
web: migrate from yarn to pnpm (#46143)
Bazel's rules_js rely on the pnpm package manager. To simplify the integration, we're migrating to pnpm from our current package manager — yarn. Another reason to migrate is that pnpm is cool and fast. 😉
2023-01-11 19:50:09 -08:00
Valery Bugakov
79917a7e98
web: drop legacy GraphQL schema generator (#45945) 2022-12-25 18:10:20 -08:00
GitStart-SourceGraph
b283d24198
[SG-39284] Upgrade yarn to the latest version (#39728) 2022-08-31 20:39:53 -07:00
Valery Bugakov
868472f43e
ci: run client linters on changed files (#33701) 2022-04-14 00:37:25 -07:00
Chris Wendt
0db4e13aa1
tests: Remove download-puppeteer-browser script (#29104) 2021-12-16 05:33:25 -07:00
Valery Bugakov
96994c8cd8
web: make web integration tests great again! (#25027)
* test-integration

* test-integration

* web: update naming convention for constants

Co-authored-by: Jean Hadrien Chabran <jh@chabran.fr>

* web: update naming convention for constants

* Update enterprise/dev/ci/internal/ci/pipeline-steps.go

Co-authored-by: Tom Ross <tom@umpox.com>

* web: dont skip git clone step in test agents

* web: update web integration splitting logic

* web: update percy executable

* web: update executable path for storyshots

* web: download browser in async pipeline

* web: timebox localStorage reset

* web: update min func

Co-authored-by: Jean Hadrien Chabran <jh@chabran.fr>
Co-authored-by: Tom Ross <tom@umpox.com>
2021-09-23 16:32:25 +02:00
Valery Bugakov
5de41b698b
web: add Storybook workspace level commands (#22311) 2021-06-23 22:23:19 +08:00
Tomás Senart
9e18b82d97
search: Resolve repositories in star ranked order (#21877)
* search: Resolve repositories in star ranked order

This change set makes our `type:repo` search results and `repo:`
suggestions be sorted by descending star order.

Part of #21642

* search: limit file path and symbol suggestions

* Please the lint gods!

* fixup! get rid of unnecessary WaitGroup

* fixup! Revert limit for filepath and symbol suggestions

* search: order filter suggestions by rank too
2021-06-09 11:12:59 +00:00
Valery Bugakov
179498b257
web: flatten frontend packages inside of the client folder (#19378)
* web: flattened frontend packages inside of the client folder

* web: please prettier 🙏

* web: reverted redundant changes

* web: reverted redundant whitespace changes

* Update client/README.md

Co-authored-by: Patrick Dubroy <patrick@sourcegraph.com>

* Update client/README.md

Co-authored-by: Patrick Dubroy <patrick@sourcegraph.com>

* Update client/README.md

Co-authored-by: Patrick Dubroy <patrick@sourcegraph.com>

* web: updated client/README

* Update client/README.md

Co-authored-by: Tom Ross <tom@umpox.com>

* web: changed licenses to Apache-2.0 for frontend packages

* web: reverted redudant change

* web: updated client/README

* web: added issue #

* web: added issue #

Co-authored-by: Patrick Dubroy <patrick@sourcegraph.com>
Co-authored-by: Tom Ross <tom@umpox.com>
2021-03-26 15:35:26 +08:00
Marek
2b8547874f
Use browser fetcher to download Puppeteer browser (#19105) 2021-03-24 21:00:52 -04:00
Felix Becker
85f198b04c
Move shared branded code to branded/ (#14515) 2020-10-08 15:14:34 +02:00
Felix Becker
45f9839011
Move all client code into client/ folder (#14480) 2020-10-07 22:23:53 +02:00