From 37f9ce07ef8f07484eeff240ff90e3c58e653f87 Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Fri, 8 Jul 2022 17:38:16 +0200 Subject: [PATCH] v2.7.2 hot fix --- docs/releases/v2.7.2.md | 10 +++ mkdocs.yml | 3 +- package.json | 2 +- src/atlasComponents/sapi/sapi.service.ts | 2 +- .../sapiViews/core/parcellation/module.ts | 4 ++ .../core/parcellation/parcellationDoi.pipe.ts | 18 +++++ .../parcellation.smartChip.template.html | 65 +++++++++++++++++-- .../util/parcellationSupportedInSpace.pipe.ts | 3 +- src/overwrite.scss | 5 ++ src/state/atlasSelection/store.ts | 7 +- src/ui/dialogInfo/dialog.directive.ts | 2 +- .../nehuba.layoutOverlay.component.ts | 9 +-- 12 files changed, 114 insertions(+), 16 deletions(-) create mode 100644 docs/releases/v2.7.2.md create mode 100644 src/atlasComponents/sapiViews/core/parcellation/parcellationDoi.pipe.ts diff --git a/docs/releases/v2.7.2.md b/docs/releases/v2.7.2.md new file mode 100644 index 000000000..7279c7cd2 --- /dev/null +++ b/docs/releases/v2.7.2.md @@ -0,0 +1,10 @@ +# v2.7.2 + +## Feature + +- (re)introduced the parcellation info button + +## Bugfix + +- fix the position of quick tour panel of slice view panels +- fix the atlas selection logic. This should reduce 4xx/5xx calls significantly diff --git a/mkdocs.yml b/mkdocs.yml index 1ef131b83..4d705ac0a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Interactive Atlas Viewer User Documentation +site_name: Siibra Explorer User Documentation theme: name: 'material' @@ -33,6 +33,7 @@ nav: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.7.2: 'releases/v2.7.2.md' - v2.7.1: 'releases/v2.7.1.md' - v2.7.0: 'releases/v2.7.0.md' - v2.6.10: 'releases/v2.6.10.md' diff --git a/package.json b/package.json index 13acbd1cc..82db76567 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.7.1", + "version": "2.7.2", "description": "siibra-explorer - explore brain atlases. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "lint": "eslint src --ext .ts", diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 62ba0e252..0600ef297 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -24,7 +24,7 @@ import { SAPIFeature } from "./features"; import { environment } from "src/environments/environment" export const SIIBRA_API_VERSION_HEADER_KEY='x-siibra-api-version' -export const SIIBRA_API_VERSION = '0.2.0' +export const SIIBRA_API_VERSION = '0.2.1' type RegistryType = SAPIAtlas | SAPISpace | SAPIParcellation diff --git a/src/atlasComponents/sapiViews/core/parcellation/module.ts b/src/atlasComponents/sapiViews/core/parcellation/module.ts index cb7581d2d..91133d0c1 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/module.ts +++ b/src/atlasComponents/sapiViews/core/parcellation/module.ts @@ -4,11 +4,13 @@ import { Store } from "@ngrx/store"; import { ComponentsModule } from "src/components"; import { AngularMaterialModule } from "src/sharedModules"; import { atlasAppearance } from "src/state"; +import { DialogModule } from "src/ui/dialogInfo/module"; import { UtilModule } from "src/util"; import { SapiViewsUtilModule } from "../../util"; import { SapiViewsCoreParcellationParcellationChip } from "./chip/parcellation.chip.component"; import { FilterGroupedParcellationPipe } from "./filterGroupedParcellations.pipe"; import { FilterUnsupportedParcPipe } from "./filterUnsupportedParc.pipe"; +import { ParcellationDoiPipe } from "./parcellationDoi.pipe"; import { ParcellationIsBaseLayer } from "./parcellationIsBaseLayer.pipe"; import { ParcellationVisibilityService } from "./parcellationVis.service"; import { PreviewParcellationUrlPipe } from "./previewParcellationUrl.pipe"; @@ -22,6 +24,7 @@ import { SapiViewsCoreParcellationParcellationTile } from "./tile/parcellation.t AngularMaterialModule, UtilModule, SapiViewsUtilModule, + DialogModule, ], declarations: [ SapiViewsCoreParcellationParcellationTile, @@ -31,6 +34,7 @@ import { SapiViewsCoreParcellationParcellationTile } from "./tile/parcellation.t FilterGroupedParcellationPipe, FilterUnsupportedParcPipe, ParcellationIsBaseLayer, + ParcellationDoiPipe, ], exports: [ SapiViewsCoreParcellationParcellationTile, diff --git a/src/atlasComponents/sapiViews/core/parcellation/parcellationDoi.pipe.ts b/src/atlasComponents/sapiViews/core/parcellation/parcellationDoi.pipe.ts new file mode 100644 index 000000000..8652365e1 --- /dev/null +++ b/src/atlasComponents/sapiViews/core/parcellation/parcellationDoi.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from "@angular/core"; +import { SapiParcellationModel } from "src/atlasComponents/sapi/type"; + +@Pipe({ + name: 'parcellationDoiPipe', + pure: true +}) + +export class ParcellationDoiPipe implements PipeTransform { + public transform(parc: SapiParcellationModel): string[] { + const urls = (parc?.brainAtlasVersions || []).filter( + v => v.digitalIdentifier && v.digitalIdentifier['@type'] === 'https://openminds.ebrains.eu/core/DOI' + ).map( + v => v.digitalIdentifier['@id'] as string + ) + return Array.from(new Set(urls)) + } +} diff --git a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html index e56b6b69b..29c269adc 100644 --- a/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html +++ b/src/atlasComponents/sapiViews/core/parcellation/smartChip/parcellation.smartChip.template.html @@ -18,6 +18,22 @@ [sxplr-sapiviews-core-parcellation-chip-color]="(parcellation | equality : parc : trackByFn) ? 'primary' : 'default'" (sxplr-sapiviews-core-parcellation-chip-onclick)="selectParcellation(parc)"> + <div class="sxplr-scale-70" + suffix + iav-stop="mousedown click"> + + <ng-template #otherParcDesc> + <ng-template [ngTemplateOutlet]="parcDescTmpl" + [ngTemplateOutletContext]="{ parcellation: parc }"> + </ng-template> + </ng-template> + + <button mat-mini-fab color="default" + [sxplr-dialog]="otherParcDesc" + [sxplr-dialog-size]="null"> + <i class="fas fa-info"></i> + </button> + </div> </sxplr-sapiviews-core-parcellation-chip> <div class="spinner-container" *ngIf="(loadingParc$ | async) === parc"> @@ -60,12 +76,24 @@ </button> </div> - <div *ngIf="!(parcellation | parcellationIsBaseLayer)" - class="sxplr-scale-70" - suffix> + <div class="sxplr-scale-70" + suffix + iav-stop="mousedown click"> + + <ng-template #mainParcDesc> + <ng-template [ngTemplateOutlet]="parcDescTmpl" + [ngTemplateOutletContext]="{ parcellation: parcellation }"> + </ng-template> + </ng-template> + + <button mat-mini-fab color="default" + [sxplr-dialog]="mainParcDesc" + [sxplr-dialog-size]="null"> + <i class="fas fa-info"></i> + </button> <button mat-mini-fab + *ngIf="!(parcellation | parcellationIsBaseLayer)" color="primary" - iav-stop="mousedown click" (click)="dismiss()"> <spinner-cmp class="sxplr-w-100 sxplr-h-100" *ngIf="onDismissClicked$ | async; else defaultDismissIcon"></spinner-cmp> @@ -76,3 +104,32 @@ </button> </div> </sxplr-sapiviews-core-parcellation-chip> + +<!-- parcellation description template --> + +<ng-template #parcDescTmpl let-parc="parcellation"> + <h1 mat-dialog-title> + {{ parc.name }} + </h1> + <div mat-dialog-content> + <markdown-dom + *ngIf="parc.brainAtlasVersions.length > 0 && parc.brainAtlasVersions[0].versionInnovation" + [markdown]="parc.brainAtlasVersions[0].versionInnovation"> + </markdown-dom> + </div> + + <mat-dialog-actions align="start"> + <a *ngFor="let url of parc | parcellationDoiPipe" + [href]="url" + target="_blank" + mat-raised-button + color="primary"> + <div class="fas fa-external-link-alt"></div> + <span> + Explore + </span> + </a> + + <button mat-button mat-dialog-close>Close</button> + </mat-dialog-actions> +</ng-template> diff --git a/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts b/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts index f16e6a0a8..42eec193e 100644 --- a/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts +++ b/src/atlasComponents/sapiViews/util/parcellationSupportedInSpace.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from "@angular/core"; -import { Observable, of } from "rxjs"; +import { NEVER, Observable, of } from "rxjs"; import { map } from "rxjs/operators"; import { SAPIParcellation } from "src/atlasComponents/sapi/core"; import { SAPI } from "src/atlasComponents/sapi/sapi.service"; @@ -29,6 +29,7 @@ export class ParcellationSupportedInSpacePipe implements PipeTransform{ constructor(private sapi: SAPI){} public transform(parc: SapiParcellationModel|string, tmpl: SapiSpaceModel|string): Observable<boolean> { + if (!parc) return NEVER const parcId = typeof parc === "string" ? parc : parc["@id"] diff --git a/src/overwrite.scss b/src/overwrite.scss index 790e436d3..b1e3e9f6a 100644 --- a/src/overwrite.scss +++ b/src/overwrite.scss @@ -279,3 +279,8 @@ $flex-directions: row,column; opacity: 0.5; } } + +a[mat-raised-button] +{ + text-decoration: none; +} diff --git a/src/state/atlasSelection/store.ts b/src/state/atlasSelection/store.ts index 08848c1ef..ebea8a78d 100644 --- a/src/state/atlasSelection/store.ts +++ b/src/state/atlasSelection/store.ts @@ -117,9 +117,14 @@ const reducer = createReducer( on( actions.selectAtlas, (state, { atlas }) => { + if (atlas?.["@id"] === state?.selectedAtlas?.["@id"]) { + return state + } return { ...state, - selectedAtlas: atlas + selectedAtlas: atlas, + selectedTemplate: null, + selectedParcellation: null, } } ), diff --git a/src/ui/dialogInfo/dialog.directive.ts b/src/ui/dialogInfo/dialog.directive.ts index 1b30c4e59..63d886a6e 100644 --- a/src/ui/dialogInfo/dialog.directive.ts +++ b/src/ui/dialogInfo/dialog.directive.ts @@ -52,7 +52,7 @@ export class DialogDirective{ } this.matDialog.open(this.templateRef, { data: this.data, - ...sizeDict[this.size] + ...(sizeDict[this.size] || {}) }) } } \ No newline at end of file diff --git a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts index 93af83e0d..2fcf3b824 100644 --- a/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts +++ b/src/viewerModule/nehuba/layoutOverlay/nehuba.layoutOverlay/nehuba.layoutOverlay.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, ChangeDetectorRef, Component, Inject, OnDestroy } from "@angular/core"; +import { ChangeDetectorRef, Component, Inject, OnDestroy } from "@angular/core"; import { select, Store } from "@ngrx/store"; import { combineLatest, fromEvent, interval, merge, Observable, of, Subject, Subscription } from "rxjs"; import { userInterface } from "src/state"; @@ -16,7 +16,7 @@ import { debounce, debounceTime, distinctUntilChanged, filter, map, mapTo, switc ] }) -export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ +export class NehubaLayoutOverlay implements OnDestroy{ public ARIA_LABELS = ARIA_LABELS public IDS = IDS @@ -44,10 +44,6 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ while(this.nehubaUnitSubs.length > 0) this.nehubaUnitSubs.pop().unsubscribe() } - ngAfterViewInit(): void { - this.setQuickTourPos() - } - handleCycleViewEvent(): void { if (this.currentPanelMode !== "SINGLE_PANEL") return this.store$.dispatch( @@ -124,6 +120,7 @@ export class NehubaLayoutOverlay implements OnDestroy, AfterViewInit{ nehuba$.subscribe(nehuba => { this.nehubaUnit = nehuba this.onNewNehubaUnit(nehuba) + this.setQuickTourPos() }) ) } -- GitLab