Skip to content

Commit 7f6def4

Browse files
authored
Merge pull request #796 from Kitware/sample-data-toggle
fix(config): Sample data toggle
2 parents 052c8ba + 2e3c015 commit 7f6def4

6 files changed

Lines changed: 10 additions & 27 deletions

File tree

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ VITE_ENABLE_REMOTE_SAVE=true
1414

1515
# VolView server remote URL
1616
VITE_REMOTE_SERVER_URL=http://localhost:4014
17+
18+
# Controls the initial visibility of the Sample Data section.
19+
VITE_SHOW_SAMPLE_DATA=true

.github/workflows/e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
env:
1313
DOWNLOAD_TIMEOUT: 220000
14+
VITE_SHOW_SAMPLE_DATA: true
1415
steps:
1516
- uses: actions/checkout@v4
1617
with:

docs/configuration_file.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ hdf5, iwi.cbor, mha, nii, nii.gz, nrrd, vtk
5757

5858
When loading files, VolView can automatically convert images to segment groups
5959
if they follow a naming convention. For example, an image with name like `foo.segmentation.bar`
60-
will be converted to a segment group for a base image named like `foo.baz`.
60+
will be converted to a segment group for a base image named like `foo.baz`.
6161
The `segmentation` extension is defined by the `io.segmentGroupExtension` key, which takes a
6262
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.
6363

@@ -87,18 +87,6 @@ To configure a key for an action, add its action name and the key(s) under the `
8787
}
8888
```
8989

90-
## Visibility of Sample Data section
91-
92-
Simplify the data browser by hiding the Sample Data expandable section.
93-
94-
```json
95-
{
96-
"dataBrowser": {
97-
"hideSampleData": false
98-
}
99-
}
100-
```
101-
10290
## Example JSON:
10391

10492
```json

netlify.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
status = 200
55
force = true
66
headers = {apikey = "DICOM_WEB_API_KEY"}
7+
8+
[build.environment]
9+
VITE_SHOW_SAMPLE_DATA= "true"
710

811
[build]
912
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"

src/io/import/configJson.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { ACTIONS } from '@/src/constants';
44

55
import { useRectangleStore } from '@/src/store/tools/rectangles';
66
import { useRulerStore } from '@/src/store/tools/rulers';
7-
import { useDataBrowserStore } from '@/src/store/data-browser';
87
import { usePolygonStore } from '@/src/store/tools/polygons';
98
import { useViewStore } from '@/src/store/views';
109
import { useWindowingStore } from '@/src/store/view-configs/windowing';
@@ -22,12 +21,6 @@ const layout = z
2221
})
2322
.optional();
2423

25-
const dataBrowser = z
26-
.object({
27-
hideSampleData: z.boolean().optional(),
28-
})
29-
.optional();
30-
3124
const shortcuts = z.record(zodEnumFromObjKeys(ACTIONS), z.string()).optional();
3225

3326
// --------------------------------------------------------------------------
@@ -81,7 +74,6 @@ const windowing = z
8174

8275
export const config = z.object({
8376
layout,
84-
dataBrowser,
8577
labels,
8678
shortcuts,
8779
io,
@@ -122,10 +114,6 @@ const applyLabels = (manifest: Config) => {
122114
applyLabelsToStore(usePolygonStore(), polygonLabels);
123115
};
124116

125-
const applySampleData = (manifest: Config) => {
126-
useDataBrowserStore().hideSampleData = !!manifest.dataBrowser?.hideSampleData;
127-
};
128-
129117
const applyLayout = (manifest: Config) => {
130118
if (manifest.layout?.gridSize) {
131119
useViewStore().setLayoutFromGrid(manifest.layout.gridSize);
@@ -157,7 +145,6 @@ const applyWindowing = (manifest: Config) => {
157145

158146
export const applyPreStateConfig = (manifest: Config) => {
159147
applyLayout(manifest);
160-
applySampleData(manifest);
161148
applyShortcuts(manifest);
162149
applyIo(manifest);
163150
applyWindowing(manifest);

src/store/data-browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { defineStore } from 'pinia';
22
import { ref } from 'vue';
33

44
export const useDataBrowserStore = defineStore('data-browser', () => {
5-
const hideSampleData = ref(false);
5+
const hideSampleData = ref(import.meta.env.VITE_SHOW_SAMPLE_DATA !== 'true');
6+
67
return {
78
hideSampleData,
89
};

0 commit comments

Comments
 (0)