Skip to content
Snippets Groups Projects
Commit 3369956a authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: changing template now also update url nav

parent e0ec948d
No related branches found
No related tags found
No related merge requests found
...@@ -258,7 +258,6 @@ export const GET_STATE_SNAPSHOT_TOKEN = new InjectionToken('GET_STATE_SNAPSHOT_T ...@@ -258,7 +258,6 @@ export const GET_STATE_SNAPSHOT_TOKEN = new InjectionToken('GET_STATE_SNAPSHOT_T
* TODO * TODO
* once nehubacontainer is separated into viewer + overlay, migrate to nehubaContainer module * once nehubacontainer is separated into viewer + overlay, migrate to nehubaContainer module
*/ */
DatabrowserService,
{ {
provide: API_SERVICE_SET_VIEWER_HANDLE_TOKEN, provide: API_SERVICE_SET_VIEWER_HANDLE_TOKEN,
useFactory: setViewerHandleFactory, useFactory: setViewerHandleFactory,
......
...@@ -24,6 +24,7 @@ import { ...@@ -24,6 +24,7 @@ import {
viewerStateMouseOverCustomLandmarkInPerspectiveView, viewerStateMouseOverCustomLandmarkInPerspectiveView,
viewerStateNewViewer viewerStateNewViewer
} from './viewerState.store.helper'; } from './viewerState.store.helper';
import { cvtNehubaConfigToNavigationObj } from 'src/ui/viewerStateController/viewerState.useEffect';
export interface StateInterface { export interface StateInterface {
fetchedTemplates: any[] fetchedTemplates: any[]
...@@ -136,17 +137,22 @@ export const getStateStore = ({ state = defaultState } = {}) => (prevState: Part ...@@ -136,17 +137,22 @@ export const getStateStore = ({ state = defaultState } = {}) => (prevState: Part
} }
case NEWVIEWER: { case NEWVIEWER: {
const { selectParcellation: parcellation } = action const {
selectParcellation: parcellation,
navigation,
selectTemplate,
} = action
const navigationFromTemplateSelected = cvtNehubaConfigToNavigationObj(selectTemplate?.nehubaConfig?.dataset?.initialNgState)
return { return {
...prevState, ...prevState,
templateSelected : action.selectTemplate, templateSelected : selectTemplate,
parcellationSelected : parcellation, parcellationSelected : parcellation,
// taken care of by effect.ts // taken care of by effect.ts
// regionsSelected : [], // regionsSelected : [],
// taken care of by effect.ts // taken care of by effect.ts
// landmarksSelected : [], // landmarksSelected : [],
navigation : action.navigation, navigation : navigation || navigationFromTemplateSelected,
dedicatedView : null, dedicatedView : null,
} }
} }
......
...@@ -6,7 +6,7 @@ export const viewerStateNewViewer = createAction( ...@@ -6,7 +6,7 @@ export const viewerStateNewViewer = createAction(
props<{ props<{
selectTemplate: any selectTemplate: any
selectParcellation: any selectParcellation: any
navigation: any navigation?: any
}>() }>()
) )
......
...@@ -104,7 +104,6 @@ describe('> viewerState.useEffect.ts', () => { ...@@ -104,7 +104,6 @@ describe('> viewerState.useEffect.ts', () => {
a: viewerStateNewViewer({ a: viewerStateNewViewer({
selectTemplate: reconstitutedColin, selectTemplate: reconstitutedColin,
selectParcellation: reconstitutedColin.parcellations[0], selectParcellation: reconstitutedColin.parcellations[0],
navigation: {}
}) })
} }
) )
...@@ -133,7 +132,6 @@ describe('> viewerState.useEffect.ts', () => { ...@@ -133,7 +132,6 @@ describe('> viewerState.useEffect.ts', () => {
a: viewerStateNewViewer({ a: viewerStateNewViewer({
selectTemplate: reconstitutedColin, selectTemplate: reconstitutedColin,
selectParcellation: reconstitutedColin.parcellations[0], selectParcellation: reconstitutedColin.parcellations[0],
navigation: {}
}) })
} }
) )
...@@ -162,7 +160,6 @@ describe('> viewerState.useEffect.ts', () => { ...@@ -162,7 +160,6 @@ describe('> viewerState.useEffect.ts', () => {
a: viewerStateNewViewer({ a: viewerStateNewViewer({
selectTemplate: reconstitutedColin, selectTemplate: reconstitutedColin,
selectParcellation: reconstitutedColin.parcellations[0], selectParcellation: reconstitutedColin.parcellations[0],
navigation: {}
}) })
} }
) )
...@@ -190,7 +187,6 @@ describe('> viewerState.useEffect.ts', () => { ...@@ -190,7 +187,6 @@ describe('> viewerState.useEffect.ts', () => {
a: viewerStateNewViewer({ a: viewerStateNewViewer({
selectTemplate: reconstitutedColin, selectTemplate: reconstitutedColin,
selectParcellation: reconstitutedColin.parcellations[0], selectParcellation: reconstitutedColin.parcellations[0],
navigation: {}
}) })
} }
) )
...@@ -224,7 +220,6 @@ describe('> viewerState.useEffect.ts', () => { ...@@ -224,7 +220,6 @@ describe('> viewerState.useEffect.ts', () => {
a: viewerStateNewViewer({ a: viewerStateNewViewer({
selectTemplate: updatedColin, selectTemplate: updatedColin,
selectParcellation: updatedColin.parcellations[0], selectParcellation: updatedColin.parcellations[0],
navigation: {}
}) })
} }
) )
......
...@@ -210,9 +210,8 @@ export class ViewerStateControllerUseEffect implements OnDestroy { ...@@ -210,9 +210,8 @@ export class ViewerStateControllerUseEffect implements OnDestroy {
*/ */
if (!lastSelectedTemplate) { if (!lastSelectedTemplate) {
return of(viewerStateNewViewer({ return of(viewerStateNewViewer({
navigation: {},
selectParcellation, selectParcellation,
selectTemplate selectTemplate,
})) }))
} }
...@@ -228,9 +227,8 @@ export class ViewerStateControllerUseEffect implements OnDestroy { ...@@ -228,9 +227,8 @@ export class ViewerStateControllerUseEffect implements OnDestroy {
*/ */
if (status === 'error') { if (status === 'error') {
return viewerStateNewViewer({ return viewerStateNewViewer({
navigation: {},
selectParcellation, selectParcellation,
selectTemplate selectTemplate,
}) })
} }
...@@ -258,7 +256,6 @@ export class ViewerStateControllerUseEffect implements OnDestroy { ...@@ -258,7 +256,6 @@ export class ViewerStateControllerUseEffect implements OnDestroy {
return viewerStateNewViewer({ return viewerStateNewViewer({
selectTemplate: deepCopiedState, selectTemplate: deepCopiedState,
selectParcellation, selectParcellation,
navigation: {}
}) })
}) })
) )
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment