#VFB-233 - Refactor Neuroglass state management and viewer configuration#218
#VFB-233 - Refactor Neuroglass state management and viewer configuration#218jrmartin wants to merge 13 commits intodevelopmentfrom
Conversation
…ion; add layout handling and datasource parameters for external server configuration
There was a problem hiding this comment.
Pull request overview
Refactors the Virtual Fly Brain frontend’s Neuroglass integration to dynamically generate Neuroglancer viewer state from loaded instances, support layout selection via Redux + ?layout=..., and make the Neuroglass datasource configurable at build/deploy time.
Changes:
- Replaced static Neuroglass state mappings with a
buildNeuroglassStatebuilder + shared shader/datasource config. - Added
neuroglassViewto Redux, plus middleware to read/write thelayoutURL parameter. - Introduced Docker/CI build args intended to configure Neuroglass datasource protocol/base URL.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| deployment/codefresh-dev.yaml | Passes Neuroglass datasource build args into the image build step. |
| applications/virtual-fly-brain/Dockerfile | Adds build args and exports datasource config during the Vite build. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js | Implements dynamic viewer state builder, datasource URL builder, shader, and layout resolver. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js | Removes legacy state lookup helpers tied to static mappings. |
| applications/virtual-fly-brain/frontend/src/utils/constants.js | Defines known layouts, defaults, and URL parameter name. |
| applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js | Syncs ?layout into Redux on first load and writes it back on state change. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/types/GlobalTypes.js | Adds SET_NEUROGLASS_VIEW action type. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/globals.js | Adds setNeuroglassView action creator. |
| applications/virtual-fly-brain/frontend/src/reducers/GlobalReducer.js | Stores neuroglassView in global reducer state. |
| applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx | Switches viewer to builder-based state, responsive layout selection, and debounced iframe reload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6d19fcced
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js
Outdated
Show resolved
Hide resolved
…nt variables for datasource settings
There was a problem hiding this comment.
Pull request overview
Refactors the Neuroglass viewer integration to dynamically build Neuroglancer viewer state from loaded VFB instances, add Redux/URL-driven layout selection, and make the Neuroglass datasource configurable via build/deploy-time variables.
Changes:
- Replaced hardcoded Neuroglass state mappings with a dynamic
buildNeuroglassStatebuilder and shared datasource/shader config. - Added
neuroglassViewto global Redux state and synchronized it with the URL?layoutparameter via middleware. - Plumbed
NEUROGLASS_DATA_PROTOCOL/NEUROGLASS_DATA_BASE_URLthrough build/deploy config and Vite defines.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| deployment/codefresh-dev.yaml | Passes Neuroglass datasource variables into the build pipeline. |
| applications/virtual-fly-brain/frontend/vite.config.js | Injects Neuroglass datasource env into the frontend build (and logs build config). |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js | Implements dynamic Neuroglass state generation and layout resolution. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js | Removes legacy state lookup utilities tied to static state maps. |
| applications/virtual-fly-brain/frontend/src/utils/constants.js | Adds known layouts and layout URL param/defaults. |
| applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js | Reads/writes ?layout and syncs it with Redux state. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/types/GlobalTypes.js | Adds SET_NEUROGLASS_VIEW action type. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/globals.js | Adds setNeuroglassView action creator. |
| applications/virtual-fly-brain/frontend/src/reducers/GlobalReducer.js | Stores neuroglassView in global state. |
| applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx | Rebuilds iframe state dynamically, supports layout switching, and debounces reloads. |
| applications/virtual-fly-brain/Dockerfile | Exposes Neuroglass datasource build args and exports them for the Vite build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Outdated
Show resolved
Hide resolved
…vironment variables and improve error handling
There was a problem hiding this comment.
Pull request overview
Refactors the Neuroglass viewer integration to dynamically build Neuroglancer state from the currently loaded VFB instances and adds configurable Neuroglass datasource settings (protocol/base URL), plus URL/Redux syncing for viewer layout selection.
Changes:
- Replaced static Neuroglass state presets with dynamic state generation (
buildNeuroglassState) and layout resolution (resolveNeuroglassLayout). - Added Neuroglass datasource configuration via environment variables and propagated them through Vite build configuration and the Docker build.
- Introduced
globalInfo.neuroglassViewin Redux and middleware syncing of?layout=between URL and store.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| deployment/codefresh-dev.yaml | Passes Neuroglass datasource env vars into Codefresh build context. |
| applications/virtual-fly-brain/frontend/vite.config.js | Inlines Neuroglass config into the frontend bundle via define and logs build config. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js | Implements dynamic layer/state generation and configurable datasource URL building. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js | Removes legacy helpers tied to static Neuroglass state maps. |
| applications/virtual-fly-brain/frontend/src/utils/constants.js | Adds known Neuroglass layout constants and URL param key. |
| applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js | Syncs layout URL param into Redux and updates URL when view changes. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/types/GlobalTypes.js | Adds a new global action type for Neuroglass view updates. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/globals.js | Adds setNeuroglassView(view) action creator. |
| applications/virtual-fly-brain/frontend/src/reducers/GlobalReducer.js | Stores neuroglassView in global Redux state. |
| applications/virtual-fly-brain/frontend/src/components/queryBuilder/FullscreenSlider.jsx | Removes a file-level eslint disable comment. |
| applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarHTML.jsx | Removes a file-level eslint disable comment. |
| applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx | Refactors viewer to use dynamic state/layout and debounced iframe src updates. |
| applications/virtual-fly-brain/Dockerfile | Wires Neuroglass datasource vars into the Vite build step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Show resolved
Hide resolved
…g messages in NeuroglassViewer
There was a problem hiding this comment.
Pull request overview
This PR refactors the Neuroglass viewer integration to dynamically generate Neuroglancer state from currently loaded VFB instances, and makes the Neuroglass datasource/viewer endpoints configurable via build-time environment variables. It also introduces Redux + URL synchronization for selecting the Neuroglass layout.
Changes:
- Build Neuroglass viewer state dynamically from
allLoadedInstances(layers, colors, visibility) and resolve layout based on URL/Redux + mobile/desktop. - Add
NEUROGLASS_DATA_PROTOCOL,NEUROGLASS_DATA_BASE_URL, andNEUROGLASS_URLconfiguration plumbing through Codefresh, Docker build, and Vitedefine. - Add
globalInfo.neuroglassViewRedux state and middleware support to sync?layout=between URL and Redux.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| deployment/codefresh-dev.yaml | Pass Neuroglass-related build args into the app image build step. |
| applications/virtual-fly-brain/frontend/vite.config.js | Load + inject Neuroglass env vars into import.meta.env.* via Vite define. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js | Replace static state maps with datasource config, layout resolution, and dynamic state/layer builders. |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js | Remove legacy helpers tied to static Neuroglass state maps. |
| applications/virtual-fly-brain/frontend/src/utils/constants.js | Add known Neuroglass layouts + URL param + defaults. |
| applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js | Read/write ?layout= and sync it to/from Redux. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/types/GlobalTypes.js | Add SET_NEUROGLASS_VIEW action type. |
| applications/virtual-fly-brain/frontend/src/reducers/actions/globals.js | Add setNeuroglassView(view) action creator. |
| applications/virtual-fly-brain/frontend/src/reducers/GlobalReducer.js | Store neuroglassView in global reducer state. |
| applications/virtual-fly-brain/frontend/src/components/queryBuilder/FullscreenSlider.jsx | Remove file-level eslint disable comment. |
| applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarHTML.jsx | Remove file-level eslint disable comment. |
| applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx | Rebuild iframe URL from dynamic state, add debounced updates, and handle mobile/desktop layout selection. |
| applications/virtual-fly-brain/Dockerfile | Export Neuroglass build-time env vars into the Vite build step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/reducers/middleware/urlUpdaterMiddleware.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… validation for layout parameters
…uroglass layer configuration
…ndling in layer builder
Changes Neuroglassviewer component to match design described on VFB-232. The changes enable dynamic construction of Neuroglass viewer state based on loaded VFB instances selected from the Layers Component. The Neuroglassviewer will display in a layer each of the selected instances toggled from the Layers Component, as well as delete and show/hide instances as selected from Layers Component. Allows updating the VFB data server as a configuration instead of hardcoding location.
Variables added to the Codefresh for storing these configuration values:
