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

chore: remove ref to NEWVIEWER

parent a1b9e600
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,8 @@ import { select, Store } from "@ngrx/store";
import { fromEvent, Observable, Subject, Subscription, combineLatest } from "rxjs";
import { bufferTime, filter, map, switchMap, take, withLatestFrom, shareReplay, startWith } from 'rxjs/operators'
import { AtlasViewerConstantsServices } from "src/atlasViewer/atlasViewer.constantService.service";
import { NEWVIEWER, IavRootStoreInterface } from "src/services/stateStore.service";
import { viewerStateHelperStoreName, viewerStateSelectAtlas } from "src/services/state/viewerState.store.helper";
import { IavRootStoreInterface } from "src/services/stateStore.service";
import { viewerStateHelperStoreName, viewerStateNewViewer, viewerStateSelectAtlas } from "src/services/state/viewerState.store.helper";
import { PureContantService } from "src/util";
@Component({
......@@ -75,19 +75,21 @@ export class SplashScreen implements AfterViewInit {
}
public selectTemplateParcellation(template, parcellation) {
this.store.dispatch({
type : NEWVIEWER,
selectTemplate : template,
selectParcellation : parcellation,
})
this.store.dispatch(
viewerStateNewViewer({
selectParcellation: parcellation,
selectTemplate: template
})
)
}
public selectTemplate(template: any) {
this.store.dispatch({
type : NEWVIEWER,
selectTemplate : template,
selectParcellation : template.parcellations[0],
})
this.store.dispatch(
viewerStateNewViewer({
selectTemplate: template,
selectParcellation: template.parcellations[0]
})
)
}
get totalTemplates() {
......
......@@ -2,11 +2,12 @@ import {} from 'jasmine'
import { UseEffects } from './effect'
import { TestBed } from '@angular/core/testing'
import { Observable } from 'rxjs'
import { SELECT_PARCELLATION, NEWVIEWER, SELECT_REGIONS } from '../state/viewerState.store'
import { SELECT_PARCELLATION, SELECT_REGIONS } from '../state/viewerState.store'
import { provideMockActions } from '@ngrx/effects/testing'
import { hot } from 'jasmine-marbles'
import { provideMockStore } from '@ngrx/store/testing'
import { defaultRootState } from '../stateStore.service'
import { viewerStateNewViewer } from '../state/viewerState/actions'
describe('effect.ts', () => {
......@@ -23,13 +24,13 @@ describe('effect.ts', () => {
})
})
it('both SELECT_PARCELLATION and NEWVIEWER actions should trigger onParcellationSelected$', () => {
it('both SELECT_PARCELLATION and viewerStateNewViewer.type actions should trigger onParcellationSelected$', () => {
const useEffectsInstance: UseEffects = TestBed.inject(UseEffects)
actions$ = hot(
'ab',
{
a: { type: SELECT_PARCELLATION },
b: { type: NEWVIEWER }
b: { type: viewerStateNewViewer.type }
}
)
expect(
......
......@@ -4,9 +4,9 @@ import { select, Store } from "@ngrx/store";
import { merge, Observable, Subscription, combineLatest } from "rxjs";
import { filter, map, shareReplay, switchMap, take, withLatestFrom, mapTo, distinctUntilChanged } from "rxjs/operators";
import { LoggingService } from "src/logging";
import { ADD_TO_REGIONS_SELECTION_WITH_IDS, DESELECT_REGIONS, NEWVIEWER, SELECT_PARCELLATION, SELECT_REGIONS, SELECT_REGIONS_WITH_ID, SELECT_LANDMARKS } from "../state/viewerState.store";
import { ADD_TO_REGIONS_SELECTION_WITH_IDS, DESELECT_REGIONS, SELECT_PARCELLATION, SELECT_REGIONS, SELECT_REGIONS_WITH_ID, SELECT_LANDMARKS } from "../state/viewerState.store";
import { IavRootStoreInterface, recursiveFindRegionWithLabelIndexId } from '../stateStore.service';
import { viewerStateSelectAtlas, viewerStateSetSelectedRegionsWithIds, viewerStateToggleLayer } from "../state/viewerState.store.helper";
import { viewerStateNewViewer, viewerStateSelectAtlas, viewerStateSetSelectedRegionsWithIds, viewerStateToggleLayer } from "../state/viewerState.store.helper";
import { deserialiseParcRegionId, serialiseParcellationRegion } from "common/util"
import { getGetRegionFromLabelIndexId } from 'src/util/fn'
......@@ -221,10 +221,10 @@ export class UseEffects implements OnDestroy {
),
this.parcellationSelected$,
this.actions$.pipe(
ofType(NEWVIEWER)
ofType(viewerStateNewViewer.type)
),
this.actions$.pipe(
ofType(viewerStateSelectAtlas)
ofType(viewerStateSelectAtlas.type)
)
).pipe(
mapTo({
......@@ -240,7 +240,7 @@ export class UseEffects implements OnDestroy {
@Effect()
public onNewViewerResetLandmarkSelected$ = this.actions$.pipe(
ofType(NEWVIEWER),
ofType(viewerStateNewViewer.type),
mapTo({
type: SELECT_LANDMARKS,
landmarks: []
......
import { Injectable } from "@angular/core";
import { Actions, Effect, ofType } from "@ngrx/effects";
import { Observable } from "rxjs";
import { NEWVIEWER } from "../state/viewerState.store";
import { mapTo, tap } from "rxjs/operators";
import { mapTo } from "rxjs/operators";
import { DATASETS_ACTIONS_TYPES } from "../state/dataStore.store";
import { viewerStateNewViewer } from "../state/viewerState/actions";
@Injectable({
providedIn: 'root'
......@@ -18,7 +18,7 @@ export class NewTemplateUseEffect{
private actions$: Actions
){
this.onNewTemplateShouldClearPreviewDataset$ = this.actions$.pipe(
ofType(NEWVIEWER),
ofType(viewerStateNewViewer.type),
mapTo({
type: DATASETS_ACTIONS_TYPES.CLEAR_PREVIEW_DATASETS
})
......
......@@ -246,7 +246,7 @@ export class UserConfigStateUseEffect implements OnDestroy {
switchMap(({ savedRegionsSelection, parcellationSelected, templateSelected, regionsSelected }) => {
if (templateSelected.name !== savedRegionsSelection.templateSelected.name ) {
/**
* template different, dispatch NEWVIEWER
* template different, dispatch viewerStateNewViewer.type
*/
this.store$.dispatch(
viewerStateNewViewer({
......
......@@ -111,7 +111,7 @@ export const getStateStore = ({ state = defaultState } = {}) => (prevState: Part
...prevState,
standaloneVolumes: []
}
case NEWVIEWER: {
case viewerStateNewViewer.type: {
const {
selectParcellation: parcellation,
......@@ -245,8 +245,6 @@ export function stateStore(state, action) {
export const LOAD_DEDICATED_LAYER = 'LOAD_DEDICATED_LAYER'
export const UNLOAD_DEDICATED_LAYER = 'UNLOAD_DEDICATED_LAYER'
export const NEWVIEWER = viewerStateNewViewer.type
export const FETCHED_TEMPLATE = 'FETCHED_TEMPLATE'
export const CHANGE_NAVIGATION = viewerStateChangeNavigation.type
......
......@@ -53,7 +53,7 @@ export { ViewerStateInterface, ViewerActionInterface, viewerState }
export { IUiState, UIActionInterface, uiState }
export { userConfigState, USER_CONFIG_ACTION_TYPES}
export { CHANGE_NAVIGATION, DESELECT_LANDMARKS, FETCHED_TEMPLATE, NEWVIEWER, SELECT_LANDMARKS, SELECT_PARCELLATION, SELECT_REGIONS, USER_LANDMARKS } from './state/viewerState.store'
export { CHANGE_NAVIGATION, DESELECT_LANDMARKS, FETCHED_TEMPLATE, SELECT_LANDMARKS, SELECT_PARCELLATION, SELECT_REGIONS, USER_LANDMARKS } from './state/viewerState.store'
export { IDataEntry, IParcellationRegion, FETCHED_DATAENTRIES, FETCHED_SPATIAL_DATA, ILandmark, IOtherLandmarkGeometry, IPlaneLandmarkGeometry, IPointLandmarkGeometry, IProperty, IPublication, IReferenceSpace, IFile, IFileSupplementData } from './state/dataStore.store'
export { CLOSE_SIDE_PANEL, MOUSE_OVER_SEGMENT, OPEN_SIDE_PANEL, COLLAPSE_SIDE_PANEL_CURRENT_VIEW, EXPAND_SIDE_PANEL_CURRENT_VIEW } from './state/uiState.store'
export { UserConfigStateUseEffect } from './state/userConfigState.store'
......
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