Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read custom visualizations #8180

Merged
merged 32 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f116816
Initial implementation (untested)
somebody1234 Oct 24, 2023
58a04d4
wip: Subscribe to file updates
somebody1234 Oct 24, 2023
c5b1f80
Merge branch 'develop' into wip/sb/read-custom-visualizations
somebody1234 Oct 30, 2023
c887beb
Fix loading custom visualizations
somebody1234 Oct 30, 2023
51602b7
Simplify and fix listing matching visualizations based on type
somebody1234 Oct 30, 2023
08309db
Fix loading custom visualizations
somebody1234 Oct 30, 2023
33fb740
Fix visualizations never loading
somebody1234 Oct 30, 2023
a0b41db
Show error when visualization fails to load
somebody1234 Oct 30, 2023
0ac8ee2
Address review
somebody1234 Oct 31, 2023
17c5890
Split code to communicate with viz compiler into separate file
somebody1234 Oct 31, 2023
3adc681
Refactor out metadata maps to new file (untested!!!)
somebody1234 Oct 31, 2023
3337d0d
Refactor out `walkFs`
somebody1234 Oct 31, 2023
5743ab8
Deduplicate visualization modules
somebody1234 Oct 31, 2023
54a1c53
Minor refactor
somebody1234 Oct 31, 2023
8d12d5d
Add info message upon finding non-visualization in `visualizations/`
somebody1234 Oct 31, 2023
be2e3bf
(wip) Tests
somebody1234 Oct 31, 2023
f0287eb
Add test for metadata index
somebody1234 Oct 31, 2023
25a12d7
Fix reloading visualizations and styles
somebody1234 Oct 31, 2023
8245475
Address new review
somebody1234 Oct 31, 2023
5604d79
Remove script to generate viz metadata; remove builtin dynamic visual…
somebody1234 Oct 31, 2023
8247b94
Merge branch 'develop' into wip/sb/read-custom-visualizations
somebody1234 Oct 31, 2023
17be3e4
Address review
somebody1234 Nov 1, 2023
5350193
(wip) Mocks required for custom visualization (mostly data server)
somebody1234 Nov 1, 2023
cd8a777
Get mocks working for custom viz (hacky)
somebody1234 Nov 2, 2023
ad412d0
Merge branch 'develop' into wip/sb/read-custom-visualizations
somebody1234 Nov 2, 2023
aef1c22
Simplifying refactors
somebody1234 Nov 3, 2023
04640fe
Minor bug fixes
somebody1234 Nov 3, 2023
8f60ddf
Fix type error
somebody1234 Nov 3, 2023
28b885b
Fix lint error
somebody1234 Nov 3, 2023
911f55f
Fix tsconfig
somebody1234 Nov 3, 2023
e8c2c67
fix lints again
somebody1234 Nov 3, 2023
dd6a4a4
prettier -_-
somebody1234 Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/gui2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ coverage

test-results/
playwright-report/

src/util/iconList.json
src/util/iconName.ts
src/stores/visualization/metadata.json
7 changes: 0 additions & 7 deletions app/gui2/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
/// <reference types="vite/client" />

declare const PROJECT_MANAGER_URL: string
declare const HISTOIRE: boolean | undefined
declare const RUNNING_VITEST: boolean

declare module 'builtins' {
export const VisualizationContainer: typeof import('@/components/VisualizationContainer.vue').default
export const useVisualizationConfig: typeof import('@/providers/visualizationConfig').useVisualizationConfig
export const defineKeybinds: typeof import('@/util/shortcuts').defineKeybinds
}
1 change: 1 addition & 0 deletions app/gui2/histoire.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const order = [
'All SVG Icons',
// Visualizations
'Selector',
'User Defined',
'JSON',
'Table',
'Scatterplot',
Expand Down
6 changes: 4 additions & 2 deletions app/gui2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"build-rust-ffi": "wasm-pack build ./rust-ffi --release --target web",
"generate-ast-schema": "cargo run -p enso-parser-schema > src/generated/ast-schema.json",
"generate-ast-types": "tsx ./parser-codegen/index.ts src/generated/ast-schema.json src/generated/ast.ts",
"preinstall": "npm run build-rust-ffi && npm run generate-ast-schema && npm run generate-ast-types",
"generate-icon-metadata": "node scripts/generateIcons.js"
"preinstall": "npm run build-rust-ffi && npm run generate-ast-schema && npm run generate-ast-types && npm run generate-metadata",
"generate-metadata": "node scripts/generateIconMetadata.js"
},
"dependencies": {
"@ag-grid-community/client-side-row-model": "^30.2.0",
Expand Down Expand Up @@ -79,6 +79,7 @@
"@types/mapbox-gl": "^2.7.13",
"@types/node": "^18.17.5",
"@types/shuffle-seed": "^1.1.0",
"@types/wicg-file-system-access": "^2023.10.2",
"@types/ws": "^8.5.5",
"@vitejs/plugin-react": "^4.0.4",
"@vitejs/plugin-vue": "^4.3.1",
Expand All @@ -93,6 +94,7 @@
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.16.1",
"floating-vue": "^2.0.0-beta.24",
"hash-wasm": "^4.10.0",
"histoire": "^0.17.2",
"jsdom": "^22.1.0",
"postcss-nesting": "^12.0.1",
Expand Down
31 changes: 0 additions & 31 deletions app/gui2/public/visualizations/builtins.ts

This file was deleted.

87 changes: 0 additions & 87 deletions app/gui2/public/visualizations/events.ts

This file was deleted.

7 changes: 0 additions & 7 deletions app/gui2/public/visualizations/icons/find.svg

This file was deleted.

7 changes: 0 additions & 7 deletions app/gui2/public/visualizations/icons/geo_map_distance.svg

This file was deleted.

5 changes: 0 additions & 5 deletions app/gui2/public/visualizations/icons/geo_map_pin.svg

This file was deleted.

5 changes: 0 additions & 5 deletions app/gui2/public/visualizations/icons/path2.svg

This file was deleted.

5 changes: 0 additions & 5 deletions app/gui2/public/visualizations/icons/show_all.svg

This file was deleted.

25 changes: 0 additions & 25 deletions app/gui2/public/visualizations/measurement.ts

This file was deleted.

38 changes: 38 additions & 0 deletions app/gui2/scripts/generateBuiltinVisualizationMetadata.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as fs from 'node:fs/promises'

/** @type {{ name: string | undefined, inputType: string | undefined }[]} */
const visualizationMetadata = []

const order = [
'JSON',
'Table',
'Scatter Plot',
'Histogram',
'Heatmap',
'SQL Query',
'Geo Map',
'Image',
'Warnings',
]

console.info('Listing and reading visualization files...')
for (const path of [
...(await fs.readdir('./public/visualizations')).map((path) => './public/visualizations/' + path),
...(await fs.readdir('./src/components/visualizations')).map(
(path) => './src/components/visualizations/' + path,
),
]) {
if (!path.endsWith('Visualization.vue')) continue
const file = await fs.readFile(path, 'utf-8')
const name = file.match(/(?<=export\s+const\s+name\s+=\s+['"])[^'"]*/)?.[0]
const inputType = file.match(/(?<=export\s+const\s+inputType\s+=\s+['"])[^'"]*/)?.[0]
visualizationMetadata.push({ name, inputType })
}
visualizationMetadata.sort((a, b) => order.indexOf(a.name ?? '') - order.indexOf(b.name ?? ''))

console.info('Writing visualization metadata to "./src/stores/visualization/metadata.json"...')
await fs.writeFile(
'./src/stores/visualization/metadata.json',
JSON.stringify(visualizationMetadata, undefined, 2) + '\n',
)
console.info('Done.')
somebody1234 marked this conversation as resolved.
Show resolved Hide resolved