Skip to content

Commit ffe76e3

Browse files
authored
Merge pull request #156 from galaxyproject/update-openlayers
update openlayers and add a Makefile+tests
2 parents f131ed9 + 61a9fa4 commit ffe76e3

17 files changed

Lines changed: 1578 additions & 2178 deletions

packages/openlayers/Makefile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
SHELL := /bin/bash
2+
3+
.DEFAULT_GOAL := help
4+
5+
HOST ?= 127.0.0.1
6+
PORT ?= 4173
7+
GALAXY_ROOT ?= http://127.0.0.1:8080
8+
GALAXY_DATASET_ID ?=
9+
GALAXY_KEY ?=
10+
11+
.PHONY: help deps deps-update test test-unit test-e2e test-e2e-update build check dev
12+
13+
help:
14+
@printf "%s\n" \
15+
"OpenLayers package targets" \
16+
"" \
17+
"Targets:" \
18+
" make deps Install package dependencies with npm" \
19+
" make deps-update Bump package dependencies to latest releases" \
20+
" make test Run unit tests followed by Playwright e2e tests" \
21+
" make test-unit Run only the Vitest unit tests" \
22+
" make test-e2e Run only the Playwright e2e tests" \
23+
" make test-e2e-update Regenerate Playwright snapshot baselines" \
24+
" make build Build the production bundle" \
25+
" make check Run tests and then build" \
26+
" make dev Start the Vite dev server" \
27+
"" \
28+
"Variables:" \
29+
" HOST Dev server host (default: $(HOST))" \
30+
" PORT Dev server port (default: $(PORT))" \
31+
" GALAXY_ROOT Galaxy root URL (default: $(GALAXY_ROOT))" \
32+
" GALAXY_DATASET_ID Optional Galaxy dataset ID; falls back to a sample GeoJSON if unset" \
33+
" GALAXY_KEY Optional Galaxy API key"
34+
35+
deps:
36+
npm install
37+
38+
deps-update:
39+
npm update
40+
41+
test:
42+
npm test
43+
44+
test-unit:
45+
npm run test:unit
46+
47+
test-e2e:
48+
npm run test:e2e
49+
50+
test-e2e-update:
51+
npm run test:e2e -- --update-snapshots
52+
53+
build:
54+
npm run build
55+
56+
check:
57+
$(MAKE) test
58+
$(MAKE) build
59+
60+
dev:
61+
GALAXY_ROOT="$(GALAXY_ROOT)" GALAXY_DATASET_ID="$(GALAXY_DATASET_ID)" GALAXY_KEY="$(GALAXY_KEY)" npm run dev -- --host "$(HOST)" --port "$(PORT)"

packages/openlayers/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
11
# Galaxy OpenLayers
22

33
Galaxy OpenLayers is a visualization that implements features of [OL10](https://github.com/openlayers) within [Galaxy Charts](https://galaxyproject.github.io/galaxy-charts/) JavaScript-based library for the [Galaxy Project](https://github.com/galaxyproject/galaxy) platform.
4+
5+
## Make Targets
6+
7+
Run all commands from `packages/openlayers`.
8+
9+
- `make deps` installs package dependencies with npm.
10+
- `make deps-update` bumps dependencies to the latest releases tracked in `package.json` and `package-lock.json`.
11+
- `make test` runs the Vitest unit tests followed by the Playwright e2e tests.
12+
- `make test-unit` runs only the Vitest unit tests.
13+
- `make test-e2e` runs only the Playwright e2e tests (requires `make dev` running in another terminal).
14+
- `make test-e2e-update` regenerates the Playwright snapshot baselines under `test-data/`.
15+
- `make build` builds the production bundle into `static/`.
16+
- `make check` runs tests and then builds.
17+
- `make dev` starts the Vite dev server.
18+
19+
## Local Dev
20+
21+
`make dev` runs the Vite dev server. With no arguments it serves the visualization with a `__test__` dataset id, which `Plugin.vue` resolves to a sample GeoJSON file (`http://cdn.jsdelivr.net/gh/galaxyproject/galaxy-test-data/1.geojson`) so you can iterate without a running Galaxy.
22+
23+
```bash
24+
cd packages/openlayers
25+
make dev
26+
```
27+
28+
To test against a real Galaxy dataset, pass `GALAXY_DATASET_ID` (and optionally `GALAXY_ROOT` / `GALAXY_KEY`):
29+
30+
```bash
31+
make dev GALAXY_DATASET_ID=<dataset-id>
32+
make dev GALAXY_DATASET_ID=<dataset-id> GALAXY_ROOT=http://127.0.0.1:8080
33+
make dev GALAXY_DATASET_ID=<dataset-id> GALAXY_ROOT=https://usegalaxy.org GALAXY_KEY=<api-key>
34+
```

packages/openlayers/package.json

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
{
22
"name": "@galaxyproject/openlayers",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"type": "module",
55
"license": "MIT",
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
99
"preview": "vite preview",
10-
"prettier": "prettier --write 'package.json' '*.js' 'src/**/*.js' 'src/**/*.vue'"
10+
"prettier": "prettier --write 'package.json' '*.js' 'src/**/*.js' 'src/**/*.vue'",
11+
"test": "npm run test:unit && npm run test:e2e",
12+
"test:unit": "vitest --run",
13+
"test:watch": "vitest --watch",
14+
"test:e2e": "playwright test"
1115
},
12-
"files": ["static"],
16+
"files": [
17+
"static"
18+
],
1319
"devDependencies": {
1420
"@heroicons/vue": "^2.1.5",
15-
"@vitejs/plugin-vue": "^5.0.5",
16-
"autoprefixer": "^10.4.19",
17-
"axios": "^1.7.7",
21+
"@playwright/test": "^1.56.0",
22+
"@tailwindcss/vite": "^4.2.2",
23+
"@vitejs/plugin-vue": "^6.0.5",
24+
"axios": "^1.15.0",
1825
"file-saver": "^2.0.5",
19-
"galaxy-charts": "^0.0.73",
26+
"galaxy-charts": "^0.1.9",
2027
"galaxy-charts-xml-parser": "^1.0.3",
21-
"ol": "^10.2.1",
22-
"postcss": "^8.4.40",
23-
"prettier": "^3.3.3",
24-
"shpjs": "^6.1.0",
25-
"tailwindcss": "^3.4.7",
26-
"typescript": "^5.5.4",
27-
"vite": "^5.3.4",
28-
"vitest": "^3.0.9",
29-
"vue": "^3.4.31"
28+
"happy-dom": "^20.0.11",
29+
"ol": "^10.8.0",
30+
"prettier": "^3.8.1",
31+
"shpjs": "^6.2.0",
32+
"tailwindcss": "^4.2.2",
33+
"typescript": "^6.0.2",
34+
"vite": "^8.0.8",
35+
"vitest": "^4.1.4",
36+
"vue": "^3.5.32"
3037
}
3138
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from "@playwright/test";
2+
3+
export default defineConfig({
4+
snapshotPathTemplate: "{testDir}/test-data/{arg}.png",
5+
testIgnore: ["src/**"],
6+
use: {
7+
headless: !!process.env.CI,
8+
},
9+
});

packages/openlayers/postcss.config.js

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

packages/openlayers/src/App.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,26 @@ import { GalaxyCharts, type PluginIncomingType } from "galaxy-charts";
33
import Plugin from "./Plugin.vue";
44
55
defineProps<{
6+
collapse?: boolean;
7+
container?: string;
68
credentials?: RequestCredentials;
79
incoming?: PluginIncomingType;
810
}>();
911
</script>
1012

1113
<template>
12-
<GalaxyCharts :credentials="credentials" :incoming="incoming">
13-
<template #default="{ datasetId, datasetUrl, root, settings, specs, tracks }">
14+
<GalaxyCharts :collapse="collapse" :container="container" :credentials="credentials" :incoming="incoming">
15+
<template #default="{ datasetId, datasetUrl, root, save, settings, specs, tracks, transcripts, update }">
1416
<Plugin
1517
:dataset-id="datasetId"
1618
:dataset-url="datasetUrl"
1719
:root="root"
1820
:settings="settings"
1921
:specs="specs"
20-
:tracks="tracks" />
22+
:tracks="tracks"
23+
:transcripts="transcripts"
24+
@save="save"
25+
@update="update" />
2126
</template>
2227
</GalaxyCharts>
2328
</template>

packages/openlayers/src/Plugin.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { onMounted, ref, watch } from "vue";
33
import { MapViewer } from "./openlayers";
44
import { ArrowDownTrayIcon } from "@heroicons/vue/24/outline";
55
6+
const TEST_URL = "http://cdn.jsdelivr.net/gh/galaxyproject/galaxy-test-data/1.geojson";
7+
68
const props = defineProps({
79
datasetId: String,
810
datasetUrl: String,
@@ -18,8 +20,9 @@ const mv = new MapViewer({});
1820
1921
function render() {
2022
viewport.value.innerHTML = "";
23+
const datasetUrl = props.datasetId === "__test__" ? TEST_URL : props.datasetUrl;
2124
mv.loadFile(
22-
props.datasetUrl,
25+
datasetUrl,
2326
"geojson", //dataset.extension,
2427
props.settings.geometry_color,
2528
props.settings.geometry_type,

packages/openlayers/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function main() {
2020
const dataIncoming = {
2121
visualization_config: {
2222
// Placeholder for dataset ID
23-
dataset_id: process.env.dataset_id,
23+
dataset_id: process.env.dataset_id || "__test__",
2424
// Placeholder for additional visualization settings
2525
settings: {},
2626
},
@@ -40,7 +40,7 @@ async function main() {
4040
* and passing in any necessary props such as credentials.
4141
*/
4242
createApp({
43-
render: () => h(App, { credentials: process.env.credentials }),
43+
render: () => h(App, { collapse: true, credentials: process.env.credentials }),
4444
}).mount("#app");
4545
}
4646

0 commit comments

Comments
 (0)