Skip to content

Commit e17619a

Browse files
authored
refactor: Change embed-grid and embed-chart to redirects (#1873)
Publishing an alpha with the `embed-refactor` label so we can test with a local DHC build This changes embed-grid and embed-chart to just be simple redirects to `/iframe/widget`. This should reduce our footprint in the install size as this is about half of the size we contribute currently. BREAKING CHANGE: `@deephaven/embed-grid` does not handle messages to the iframe for filtering or sorting the grid any more
1 parent 1803f31 commit e17619a

44 files changed

Lines changed: 37 additions & 996 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ We use Chrome for development with the React and Redux extensions.
4040
## Scripts
4141

4242
- `npm install` : Install all dependencies and automatically bootstrap packages. Should be run before any of the other steps.
43-
- `npm start`: Start building all packages and watching them (when possible). Use when you're developing, and your changes will be picked up automatically. Servers will open up for code-studio, embed-grid, embed-chart, and embed-widget. These will open on localhost on ports 4000, 4010, 4020, and 4030 respectively.
43+
- `npm start`: Start building all packages and watching them (when possible). Use when you're developing, and your changes will be picked up automatically. Servers will open up for code-studio and embed-widget. These will open on localhost on ports 4000 and 4010 respectively.
4444
- `npm test`: Start running tests in all packages and watching (when possible). Use when you're developing, and any breaking changes will be printed out automatically. See [Unit tests](#unit-tests) for more details.
4545
- `npm run build`: Create a production build of all packages. Mainly used by CI when packaging up a production version of the app.
46-
- `npm run preview`: Runs the Vite preview server for the built code-studio, embed-grid, embed-chart, and embed-widget. These will open on ports 4000, 4010, 4020, and 4030 respectively.
46+
- `npm run preview`: Runs the Vite preview server for the built code-studio and embed-widget. These will open on ports 4000 and 4010 respectively.
4747
- `npm run e2e`: Runs the Playwright end-to-end tests locally. See [E2E Tests](#e2e-tests) for more details.
4848

4949
If your DHC address is different from the default `http://localhost:10000`, edit `.env.local` in each package to point to your local DHC. This is needed for the session websocket and for things like notebooks to be proxied correctly by Vite.
@@ -115,7 +115,7 @@ Depending on what your package is, there are a couple of different templates tha
115115

116116
### Application package
117117

118-
A standalone application with it's own entry point. Recommend copying the [embed-grid](./packages/embed-grid/) package, removing any dependencies and files not required.
118+
A standalone application with it's own entry point. Recommend copying the [embed-widget](./packages/embed-widget/) package, removing any dependencies and files not required.
119119

120120
### Component/library package
121121

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,16 @@
2626
"build": "run-s build:necessary types build:packages build:apps",
2727
"build:apps": "lerna run --scope=@deephaven/{code-studio,embed-chart,embed-grid,embed-widget} build",
2828
"build:app": "lerna run --scope=@deephaven/code-studio build",
29-
"build:embed-chart": "lerna run --scope=@deephaven/embed-chart build",
30-
"build:embed-grid": "lerna run --scope=@deephaven/embed-grid build",
3129
"build:embed-widget": "lerna run --scope=@deephaven/embed-widget build",
3230
"build:packages": "lerna run --ignore=@deephaven/{code-studio,embed-chart,embed-grid,embed-widget} build --stream",
3331
"build:profile": "lerna run build --stream --profile",
3432
"build:necessary": "lerna run build --scope=@deephaven/icons",
3533
"analyze": "lerna run analyze",
36-
"preview": "lerna run --scope=@deephaven/{code-studio,embed-chart,embed-grid,embed-widget} preview --stream",
34+
"preview": "lerna run --scope=@deephaven/{code-studio,embed-widget} preview --stream",
3735
"preview:app": "lerna run --scope=@deephaven/code-studio preview --stream",
3836
"prestart": "npm run build:necessary",
3937
"start": "run-p watch:types start:*",
4038
"start:app": "lerna run start --scope=@deephaven/code-studio --stream",
41-
"start:embed-chart": "lerna run start --scope=@deephaven/embed-chart --stream",
42-
"start:embed-grid": "lerna run start --scope=@deephaven/embed-grid --stream",
4339
"start:embed-widget": "lerna run start --scope=@deephaven/embed-widget --stream",
4440
"pretest": "npm run build:necessary",
4541
"test": "jest --watch --changedSince origin/main",

packages/embed-chart/.env

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/embed-chart/.env.development

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/embed-chart/.prettierignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/embed-chart/README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
# Embedded Deephaven Chart
22

3-
This project uses [Vite](https://vitejs.dev/guide/). It is to provide an example React application connecting to Deephaven and displaying a chart or plot.
3+
### Deprecated
44

5-
## Running
6-
7-
To start the Embed Chart server, run `npm install` and `npm start` in the root directory of this repository. See the [Getting Started](../../README.md#getting-started) section for more details.
8-
9-
## Query Parameters
10-
11-
- `name`: Required. The name of the chart to load
12-
13-
## Advanced
14-
15-
### Application Mode
16-
17-
See the guide for how to set up core in Application Mode: https://deephaven.io/core/docs/how-to-guides/application-mode/
18-
19-
Once Deephaven is running, you can open a chart with a specific name by adding the query param `name`, e.g. http://localhost:4020/?name=world
20-
21-
### Configuring Server Address
22-
23-
By default, this project assumes you are hosting Deephaven with Python on the default port at http://localhost:10000. If Deephaven is running on a different port/server, update the `VITE_CORE_API_URL` environment variable to point to the correct server. See [.env](./.env) file for the default definition, and [vite docs](https://vitejs.dev/guide/env-and-mode.html#env-variables-and-modes) for other ways to set this environment variable.
5+
Use [@deephaven/embed-widget](https://www.npmjs.com/package/@deephaven/embed-widget) instead.

packages/embed-chart/index.html

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<base href="%BASE_URL%" />
5-
<meta name="ui-version" content="v%npm_package_version%" />
6-
<meta charset="utf-8" />
7-
<meta
8-
name="viewport"
9-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
10-
/>
11-
<meta name="theme-color" content="#2d2a2e" />
12-
<link rel="manifest" href="/manifest.json" />
13-
14-
<link rel="icon" href="%VITE_FAVICON%" />
15-
<title>Deephaven Embedded Chart</title>
4+
<base href="./" />
165
</head>
176
<body>
18-
<noscript> You need to enable JavaScript to run this app. </noscript>
19-
<div id="root"></div>
20-
<script type="module" src="/src/index.tsx"></script>
7+
<noscript>You need to enable JavaScript to run this app.</noscript>
8+
9+
<script>
10+
// Can't be an HTML meta redirect because we need to keep the search params
11+
const url = new URL('../widget/', document.baseURI);
12+
url.search = window.location.search;
13+
window.location.replace(url);
14+
</script>
2115
</body>
2216
</html>

packages/embed-chart/jest.config.cjs

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/embed-chart/package.json

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,12 @@
1111
"directory": "packages/embed-chart"
1212
},
1313
"homepage": ".",
14-
"main": "public/index.js",
14+
"scripts": {
15+
"build": "vite build --outDir build"
16+
},
1517
"files": [
1618
"build"
1719
],
18-
"dependencies": {
19-
"@deephaven/app-utils": "file:../app-utils",
20-
"@deephaven/chart": "file:../chart",
21-
"@deephaven/components": "file:../components",
22-
"@deephaven/jsapi-bootstrap": "file:../jsapi-bootstrap",
23-
"@deephaven/jsapi-components": "file:../jsapi-components",
24-
"@deephaven/jsapi-types": "1.0.0-dev0.33.1",
25-
"@deephaven/jsapi-utils": "file:../jsapi-utils",
26-
"@deephaven/log": "file:../log",
27-
"fira": "mozilla/fira#4.202",
28-
"react": "^17.0.2",
29-
"react-dom": "^17.0.2"
30-
},
31-
"scripts": {
32-
"analyze": "source-map-explorer build/assets/*.js --no-border-checks",
33-
"start": "vite",
34-
"build": "NODE_OPTIONS='--max-old-space-size=4096' vite build",
35-
"preview": "vite preview"
36-
},
37-
"devDependencies": {
38-
"@deephaven/eslint-config": "file:../eslint-config",
39-
"@deephaven/mocks": "file:../mocks",
40-
"@deephaven/prettier-config": "file:../prettier-config",
41-
"@deephaven/stylelint-config": "file:../stylelint-config"
42-
},
4320
"publishConfig": {
4421
"access": "public"
4522
}

packages/embed-chart/public/favicon-cc-app-dev.svg

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)