mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
This PR refactors notebooks to support the upcoming Keyword Search GA. The main goal is to make it easier to switch to a new default pattern type without breaking existing notebooks. **Before** - pattern type and version were hardcoded in several places **After** - Each notebook has a read-only pattern type as determined by the new column `notebooks.pattern_type` (defaults to "standard"). **Notes** - Notebooks call the Stream API via various helper functions. `patternType` and `version` are both required parameters, which is redundant, because version acts as a default pattern type already. I left a TODO in the code for that. I don't want to change this as part of this PR because the change would get very big and affect too much code outside of Notebooks. - We support rendering notebooks with `.snb.md` extension. Unlike notebooks stored in our db, we cannot migrate those files. **Q&A** Q: How does this help for Keyword Search GA? A: Once we default to keyword search, we can change the default of `notebooks.pattern_type` from "standard" to "keyword". Existing notebooks will still work with "standard". New Notebooks will use "keyword". Q: How can customers migrate existing notebooks to a new version? A: Use the existing "Copy to My Notebooks" function of Notebooks. The copied notebook will have the current default pattern type. Test plan: - existing tests pass - manual testing - I created a couple of notebooks with all the different block types and verified via the network tab that all requests to the Stream API have the proper pattern type. I played around with different values in `notebooks.pattern_type` to make sure that the request parameters change. |
||
|---|---|---|
| .. | ||
| dev | ||
| src | ||
| .bazelignore | ||
| .eslintignore | ||
| .stylelintrc.json | ||
| BUILD.bazel | ||
| NOTICE | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
Shared
This folder contains common TypeScript/React/SCSS client code shared between the browser extension and the web app.
Everything in this folder is code-host agnostic and cannot make assumptions about whether it is running inside the Sourcegraph web app, in the browser extension on GitHub, Gitlab, Phabricator, Bitbucket Server, etc. In particular, components cannot make use of global CSS classes but must accept CSS classes as props and/or have their own code host agnostic SCSS stylesheets. For more details, see Styling UI in the handbook.
Code that is only used in branded contexts (web app, options menu of the browser extension, ...) should go into ../branded instead.