Skip to content
Snippets Groups Projects
Unverified Commit 4c40a94d authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #1313 from FZJ-INM1-BDA/maint_autoSelectHuman

maint: auto select human as default atlas
parents 71959f16 e23db701
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ on:
# changes to .openshift directory... mostly devops config
- '.openshift/*'
# docs (docs are built on readthedocs any way)
- 'docs/*'
- 'docs/**/*'
jobs:
build-docker-img:
......
# v2.11.0
## Feature
- Automatically selects human multilevel atlas on startup, if no atlases are selected
......@@ -33,6 +33,7 @@ nav:
- Fetching datasets: 'advanced/datasets.md'
- Display non-atlas volumes: 'advanced/otherVolumes.md'
- Release notes:
- v2.11.0: 'releases/v2.11.0.md'
- v2.10.2: 'releases/v2.10.2.md'
- v2.10.1: 'releases/v2.10.1.md'
- v2.10.0: 'releases/v2.10.0.md'
......
{
"name": "siibra-explorer",
"version": "2.10.2",
"version": "2.11.0",
"description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular",
"scripts": {
"lint": "eslint src --ext .ts",
......
......@@ -12,6 +12,7 @@ import { PureATPSelector } from "./pureDumb/pureATPSelector.components";
import { WrapperATPSelector } from "./wrapper/wrapper.component";
import { SAPIModule } from "src/atlasComponents/sapi/module";
import { MatTooltipModule } from "@angular/material/tooltip";
import { QuickTourModule } from "src/ui/quickTour";
@NgModule({
imports: [
......@@ -26,6 +27,7 @@ import { MatTooltipModule } from "@angular/material/tooltip";
DialogModule,
SAPIModule,
SapiViewsCoreParcellationModule,
QuickTourModule,
],
declarations: [
PureATPSelector,
......
......@@ -87,7 +87,10 @@
[color]="colorPalette[0]"
(itemClicked)="selectLeaf({ atlas: $event})"
[elevation]="6"
[disabled]="isBusy">
[disabled]="isBusy"
quick-tour
[quick-tour-order]="-10"
quick-tour-description="You can change atlas here.">
<ng-template sxplrSmartChipHeader>
<span>
......
import { Injectable } from "@angular/core";
import { NavigationEnd, Router } from "@angular/router";
import { filter, map, shareReplay, switchMap, take } from "rxjs/operators";
import { createEffect } from "@ngrx/effects"
import { RouteStateTransformSvc } from "./routeStateTransform.service";
import { IDS, SAPI } from "src/atlasComponents/sapi";
import { atlasSelection, generalActions } from "src/state"
import { combineLatest, from } from "rxjs";
@Injectable()
export class RouterEffects {
#navEnd$ = this.router.events.pipe(
filter<NavigationEnd>(ev => ev instanceof NavigationEnd),
shareReplay(1)
)
onViewerLoad$ = createEffect(() => this.#navEnd$.pipe(
take(1),
switchMap(ev => {
return combineLatest([
from(
this.routeToStateTransformSvc.cvtRouteToState(
this.router.parseUrl(ev.urlAfterRedirects)
)
),
this.sapi.atlases$
])
}),
map(([state, atlases]) => {
const { "[state.atlasSelection]": atlasSelectionState } = state
/**
* condition by which a default atlas is selected
* if no atlas is selected by default
*/
if (!atlasSelectionState.selectedAtlas) {
const humanAtlas = atlases.find(atlas => atlas.id === IDS.ATLAES.HUMAN)
if (humanAtlas) {
return atlasSelection.actions.selectAtlas({
atlas: humanAtlas
})
}
}
/**
* otherwise, apply returned state
*/
return generalActions.generalApplyState({
state
})
})
))
constructor(
private router: Router,
private sapi: SAPI,
private routeToStateTransformSvc: RouteStateTransformSvc,
){
}
}
......@@ -4,13 +4,18 @@ import { RouterModule } from '@angular/router'
import { RouterService } from "./router.service";
import { RouteStateTransformSvc } from "./routeStateTransform.service";
import { routes } from "./util";
import { EffectsModule } from "@ngrx/effects";
import { RouterEffects } from "./effects";
@NgModule({
imports:[
RouterModule.forRoot(routes, {
useHash: true
})
}),
EffectsModule.forFeature([
RouterEffects
])
],
providers: [
{
......
......@@ -67,16 +67,6 @@ export class RouterService {
)
)
)
onload$.subscribe(
state => {
store$.dispatch(
generalActions.generalApplyState({
state
})
)
}
)
const ready$ = sapi.atlases$.pipe(
filter(flag => !!flag),
take(1),
......@@ -146,7 +136,11 @@ export class RouterService {
}
}),
store$.pipe(
switchMap(state =>
/**
* forkjoin means requires the observable to complete. So we take 1
*/
take(1),
switchMap(state =>
from(routeToStateTransformSvc.cvtStateToRoute(state)).pipe(
catchError(() => of(``))
)
......
......@@ -14,3 +14,7 @@ export const generalApplyState = createAction(
state: MainState
}>()
)
export const noop = createAction(
`${nameSpace} noop`
)
\ No newline at end of file
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