From e3bce7eee2f77601bc6a8d56ab358de2ee0d13f5 Mon Sep 17 00:00:00 2001 From: Andrew Howe Date: Tue, 19 Aug 2025 12:28:36 -0400 Subject: [PATCH 1/3] fix(config): Add sample data visibility env flag Configures the initial visibility state at build time. Can prevent a benign race condition between the default (true) and runtime-fetched (false) settings where delayed state update looks ugly. --- .env.example | 3 +++ src/store/data-browser.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 3223c6c48..4d4dc59bf 100644 --- a/.env.example +++ b/.env.example @@ -14,3 +14,6 @@ VITE_ENABLE_REMOTE_SAVE=true # VolView server remote URL VITE_REMOTE_SERVER_URL=http://localhost:4014 + +# Controls the initial visibility of the Sample Data section. +VITE_SHOW_SAMPLE_DATA=true diff --git a/src/store/data-browser.ts b/src/store/data-browser.ts index 05d06b057..a7c5fd925 100644 --- a/src/store/data-browser.ts +++ b/src/store/data-browser.ts @@ -2,7 +2,8 @@ import { defineStore } from 'pinia'; import { ref } from 'vue'; export const useDataBrowserStore = defineStore('data-browser', () => { - const hideSampleData = ref(false); + const hideSampleData = ref(import.meta.env.VITE_SHOW_SAMPLE_DATA !== 'true'); + return { hideSampleData, }; From 056f190d418fa56ff434480976532fad74511c45 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Tue, 7 Oct 2025 08:09:27 -0400 Subject: [PATCH 2/3] refactor: remove ability to configure sample data visibility at runtime --- .github/workflows/e2e.yml | 1 + docs/configuration_file.md | 14 +------------- src/io/import/configJson.ts | 13 ------------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d756725aa..a580e1895 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -11,6 +11,7 @@ jobs: runs-on: ${{ matrix.os }} env: DOWNLOAD_TIMEOUT: 60000 + VITE_SHOW_SAMPLE_DATA: true steps: - uses: actions/checkout@v4 with: diff --git a/docs/configuration_file.md b/docs/configuration_file.md index 09d139e3c..dc048da14 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -57,7 +57,7 @@ hdf5, iwi.cbor, mha, nii, nii.gz, nrrd, vtk When loading files, VolView can automatically convert images to segment groups if they follow a naming convention. For example, an image with name like `foo.segmentation.bar` -will be converted to a segment group for a base image named like `foo.baz`. +will be converted to a segment group for a base image named like `foo.baz`. The `segmentation` extension is defined by the `io.segmentGroupExtension` key, which takes a string. Files `foo.[segmentGroupExtension].bar` will be automatilly converted to segment groups for a base image named `foo.baz`. The default is `''` and will disable the feature. @@ -87,18 +87,6 @@ To configure a key for an action, add its action name and the key(s) under the ` } ``` -## Visibility of Sample Data section - -Simplify the data browser by hiding the Sample Data expandable section. - -```json -{ - "dataBrowser": { - "hideSampleData": false - } -} -``` - ## Example JSON: ```json diff --git a/src/io/import/configJson.ts b/src/io/import/configJson.ts index c23681a40..48a6bae9d 100644 --- a/src/io/import/configJson.ts +++ b/src/io/import/configJson.ts @@ -6,7 +6,6 @@ import { Layouts } from '@/src/config'; // for applyConfig import { useRectangleStore } from '@/src/store/tools/rectangles'; import { useRulerStore } from '@/src/store/tools/rulers'; -import { useDataBrowserStore } from '@/src/store/data-browser'; import { usePolygonStore } from '@/src/store/tools/polygons'; import { useViewStore } from '@/src/store/views'; import { useWindowingStore } from '@/src/store/view-configs/windowing'; @@ -24,12 +23,6 @@ const layout = z }) .optional(); -const dataBrowser = z - .object({ - hideSampleData: z.boolean().optional(), - }) - .optional(); - const shortcuts = z.record(zodEnumFromObjKeys(ACTIONS), z.string()).optional(); // -------------------------------------------------------------------------- @@ -83,7 +76,6 @@ const windowing = z export const config = z.object({ layout, - dataBrowser, labels, shortcuts, io, @@ -124,10 +116,6 @@ const applyLabels = (manifest: Config) => { applyLabelsToStore(usePolygonStore(), polygonLabels); }; -const applySampleData = (manifest: Config) => { - useDataBrowserStore().hideSampleData = !!manifest.dataBrowser?.hideSampleData; -}; - const applyLayout = (manifest: Config) => { if (manifest.layout?.activeLayout) { const startingLayout = Layouts[manifest.layout.activeLayout]; @@ -161,7 +149,6 @@ const applyWindowing = (manifest: Config) => { export const applyConfig = (manifest: Config) => { applyLayout(manifest); applyLabels(manifest); - applySampleData(manifest); applyShortcuts(manifest); applyIo(manifest); applyWindowing(manifest); From 2e3c0155c2a95ee16bbdbd56af5fb5bdbd5a19a9 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 7 Oct 2025 09:38:48 -0400 Subject: [PATCH 3/3] chore: update netlify config for sample data toggle --- netlify.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netlify.toml b/netlify.toml index ea5f4124f..6d7d2fdcb 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,6 +4,9 @@ status = 200 force = true headers = {apikey = "DICOM_WEB_API_KEY"} + +[build.environment] + VITE_SHOW_SAMPLE_DATA= "true" [build] command = "sed -i \"s|DICOM_WEB_API_KEY|${DICOM_WEB_API_KEY}|g; s|DICOM_WEB_ADDRESS|${DICOM_WEB_ADDRESS}|g\" netlify.toml && npm run build"