#vfb-229 - POC: add Neuroglass viewer component and associated state management; integrate into toolbar and layout.#214
#vfb-229 - POC: add Neuroglass viewer component and associated state management; integrate into toolbar and layout.#214jrmartin wants to merge 5 commits intodevelopmentfrom
Conversation
…management; integrate into toolbar and layout.
There was a problem hiding this comment.
Pull request overview
Adds a new dockable Neuroglass viewer panel to the VFB frontend, backed by hardcoded Neuroglancer states for a small set of supported instances.
Changes:
- Introduces
NeuroglassViewerReact component embedding Neuroglass via an iframe and switching state based on focused instance. - Adds hardcoded Neuroglancer state config + Redux/layout helper actions for showing/hiding/auto-showing the widget.
- Registers the new widget in the layout system (widget config, component map) and exposes it in the toolbar menu.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js | Adds hardcoded state objects and helpers to retrieve/check states by instance ID |
| applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js | Adds widget visibility toggles and auto-show logic based on loaded instances |
| applications/virtual-fly-brain/frontend/src/utils/neuroglancerStateMapper.js | Adds utilities to map between VFB Redux state and Neuroglancer state |
| applications/virtual-fly-brain/frontend/src/components/layout/widgets.js | Registers the Neuroglass viewer widget in layout configuration |
| applications/virtual-fly-brain/frontend/src/components/layout/componentMap.js | Maps the new widget component key to NeuroglassViewer |
| applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx | Adds a toolbar entry to show the Neuroglass viewer widget |
| applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx | Implements the iframe-based viewer and state selection logic |
💡 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/utils/neuroglassStateConfig.js
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
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
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js
Outdated
Show resolved
Hide resolved
…ement and viewer components; enhance state handling and encoding
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateMapper.js
Outdated
Show resolved
Hide resolved
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateMapper.js
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/components/NeuroglassViewer.jsx
Show resolved
Hide resolved
…onfig; improve state existence check in neuroglass state config; enhance regex for dataset matching in state mapper
…deprecated state mapper and streamline state creation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fca42a4648
ℹ️ 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".
| icon: "fa fa-brain", | ||
| action: { | ||
| handlerAction: ACTIONS.SHOW_WIDGET, | ||
| parameters: [widgets?.neuroglassViewerWidget?.id] |
There was a problem hiding this comment.
Handle missing Neuroglass widget in imported layouts
This menu item assumes state.widgets['neuroglassViewerWidget'] exists, but menuHandler builds the widget from Redux (shared/header/index.jsx, widgets[action.parameters[0]]) and imported custom layouts overwrite widgets from saved data (reducers/middleware/vfbMiddleware.js, widgets: { ...action.data.redux.widgets }). If a user loads a layout saved before this commit, that key is absent, so clicking “Neuroglass Viewer” dispatches an incomplete widget update and the viewer does not open.
Useful? React with 👍 / 👎.
| const focusedInstance = useSelector(state => state.instances?.focusedInstance); | ||
|
|
||
| const iframeSrcUrl = useMemo(() => { | ||
| if (!focusedInstance?.metadata?.Id) return ''; |
There was a problem hiding this comment.
Use template fallback when focused instance is absent
The early return on missing focus ID (return '') prevents the component from ever reaching the default-template fallback branch, so opening this widget before an instance is focused leaves iframeSrc empty and the panel stuck on the loading placeholder. That breaks the intended “focused instance or default template” behavior in startup/empty-focus states.
Useful? React with 👍 / 👎.
Introduce a new Neuroglass viewer widget to the Virtual Fly Brain (VFB) frontend. Embeds Neuroglass in an iframe, and then render inside a Flex Widget. Limited to visualize instances whose ID match the ones we have in gs: VFB_0010101b, VFB_001012vj, VFB_00101567
Tested on VFB Dev with Neuroglass Dev Iframe:
Screencast.2026-02-15.13.27.03.mp4
Key changes:
1. Neuroglass Viewer Component and Widget Integration
NeuroglassViewerReact component that loads the Neuroglass viewer in an iframe, dynamically generating its state based on the focused instance or a default template. (NeuroglassViewer.jsx)widgets.js,componentMap.js) [1] [2] [3] [4]2. Toolbar and UI Enhancements
vfbtoolbarMenuConfiguration.jsx)3. State Management and Utility Functions
neuroglassActions.js)4. Neuroglass State Configuration
neuroglassStateConfig.js)