diff --git a/docs/releases/v2.5.5.md b/docs/releases/v2.5.5.md new file mode 100644 index 0000000000000000000000000000000000000000..07b2304906612518206a5867da7c8c6997592756 --- /dev/null +++ b/docs/releases/v2.5.5.md @@ -0,0 +1,9 @@ +# v2.5.4 + +## Feature + +- Added pre-release warning + +## Under the hood + +- Temporarily use up-to-date endpoint for MEBRAINS diff --git a/mkdocs.yml b/mkdocs.yml index 476dfab49e8293f4cb00942adf79868386926570..f518f97c0be45a63b2ca5579a32b335108810fd3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,6 +40,7 @@ pages: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.5.5: 'releases/v2.5.5.md' - v2.5.4: 'releases/v2.5.4.md' - v2.5.3: 'releases/v2.5.3.md' - v2.5.2: 'releases/v2.5.2.md' diff --git a/package.json b/package.json index 0f3aae01c1446f0e95a11d8265e25f925317d8d3..f84133d130a8f7ee46363b06b3036ebfcf72393b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.5.4", + "version": "2.5.5", "description": "HBP interactive atlas viewer. Integrating KG query, dataset previews & more. Based on humanbrainproject/nehuba & google/neuroglancer. Built with angular", "scripts": { "build-aot": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'` ng build && node ./third_party/matomo/processMatomo.js", diff --git a/src/components/confirmDialog/confirmDialog.component.ts b/src/components/confirmDialog/confirmDialog.component.ts index ec2e20c9fb6469c9ec26f88c77b73f50a77c57d3..8361ee409762ebccccfb6ae9c85d064207587dfc 100644 --- a/src/components/confirmDialog/confirmDialog.component.ts +++ b/src/components/confirmDialog/confirmDialog.component.ts @@ -25,15 +25,19 @@ export class ConfirmDialogComponent { @Input() public markdown: string + @Input() + public confirmOnly: boolean = false + public hideActionBar = false constructor(@Inject(MAT_DIALOG_DATA) data: any) { - const { title = null, message = null, markdown, okBtnText, cancelBtnText, hideActionBar} = data || {} + const { title = null, message = null, markdown, okBtnText, cancelBtnText, hideActionBar, confirmOnly} = data || {} if (title) this.title = title if (message) this.message = message if (markdown) this.markdown = markdown if (okBtnText) this.okBtnText = okBtnText if (cancelBtnText) this.cancelBtnText = cancelBtnText if (hideActionBar) this.hideActionBar = hideActionBar + if (confirmOnly) this.confirmOnly = confirmOnly } } diff --git a/src/components/confirmDialog/confirmDialog.template.html b/src/components/confirmDialog/confirmDialog.template.html index f5f0549460e034215176f4393e3ea2507c83533d..8b8a0224a96105f7b475cfc587d2a25d11932b23 100644 --- a/src/components/confirmDialog/confirmDialog.template.html +++ b/src/components/confirmDialog/confirmDialog.template.html @@ -18,6 +18,6 @@ <mat-divider></mat-divider> <mat-dialog-actions *ngIf="!hideActionBar" class="justify-content-start flex-row-reverse"> - <button [mat-dialog-close]="true" mat-raised-button color="primary">{{ okBtnText }}</button> - <button [mat-dialog-close]="false" mat-button>{{ cancelBtnText }}</button> + <button [mat-dialog-close]="true" mat-raised-button color="primary">{{ okBtnText }}</button> + <button *ngIf="!confirmOnly" [mat-dialog-close]="false" mat-button>{{ cancelBtnText }}</button> </mat-dialog-actions> diff --git a/src/services/dialogService.service.ts b/src/services/dialogService.service.ts index eb0844dd7f3102b921fbe30de7a21a86280fe577..933b862275ca6838deb4ebabec3768ff604e4769 100644 --- a/src/services/dialogService.service.ts +++ b/src/services/dialogService.service.ts @@ -82,4 +82,5 @@ export interface DialogConfig { message: string markdown?: string iconClass: string + confirmOnly: boolean } diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts index 609ebb9c43dcc51142a12a55783077a1cf65c392..d2bfeae7e4c0ff88e748acf2af2d751a8f8c23b9 100644 --- a/src/util/pureConstant.service.ts +++ b/src/util/pureConstant.service.ts @@ -754,9 +754,12 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" let templateImages: TTemplateImage[] = [] for (const precomputedItem of precomputedArr) { const ngIdKey = MultiDimMap.GetKey(precomputedItem["@id"]) + const precomputedUrl = 'https://neuroglancer.humanbrainproject.eu/precomputed/data-repo-ng-bot/20211001-mebrain/precomputed/images/MEBRAINS_T1.masked' === precomputedItem.url + ? 'https://neuroglancer.humanbrainproject.eu/precomputed/data-repo-ng-bot/20211018-mebrains-masked-templates/precomputed/images/MEBRAINS_T1_masked' + : precomputedItem.url initialLayers[ngIdKey] = { type: "image", - source: `precomputed://${precomputedItem.url}`, + source: `precomputed://${precomputedUrl}`, transform: precomputedItem.detail['neuroglancer/precomputed'].transform, visible } diff --git a/src/viewerModule/viewerCmp/viewerCmp.component.ts b/src/viewerModule/viewerCmp/viewerCmp.component.ts index bb0c20a548bf82504019a4fe307c180d6d498d4b..2ecb19f5f4e07649d61039fc88bcbd84b9a9045d 100644 --- a/src/viewerModule/viewerCmp/viewerCmp.component.ts +++ b/src/viewerModule/viewerCmp/viewerCmp.component.ts @@ -1,10 +1,11 @@ import { Component, ComponentFactory, ComponentFactoryResolver, ElementRef, Inject, Injector, Input, OnDestroy, Optional, TemplateRef, ViewChild, ViewContainerRef } from "@angular/core"; import { select, Store } from "@ngrx/store"; import {combineLatest, merge, NEVER, Observable, of, Subject, Subscription} from "rxjs"; -import {catchError, distinctUntilChanged, filter, map, shareReplay, startWith, switchMap } from "rxjs/operators"; +import {catchError, debounceTime, distinctUntilChanged, filter, map, shareReplay, startWith, switchMap } from "rxjs/operators"; import { viewerStateSetSelectedRegions } from "src/services/state/viewerState/actions"; import { viewerStateContextedSelectedRegionsSelector, + viewerStateGetSelectedAtlas, viewerStateSelectedParcellationSelector, viewerStateSelectedTemplateSelector, viewerStateStandAloneVolumes, @@ -25,6 +26,7 @@ import { MAT_DIALOG_DATA } from "@angular/material/dialog"; import { GenericInfoCmp } from "src/atlasComponents/regionalFeatures/bsFeatures/genericInfo"; import { _PLI_VOLUME_INJ_TOKEN, _TPLIVal } from "src/glue"; import { uiActionSetPreviewingDatasetFiles } from "src/services/state/uiState.store.helper"; +import { DialogService } from "src/services/dialogService.service"; type TCStoreViewerCmp = { overlaySideNav: any @@ -112,7 +114,8 @@ export function ROIFactory(store: Store<any>, svc: PureContantService){ }, deps: [ ComponentStore ] }, - ComponentStore + ComponentStore, + DialogService ] }) @@ -234,6 +237,7 @@ export class ViewerCmp implements OnDestroy { private viewerModuleSvc: ContextMenuService<TContextArg<'threeSurfer' | 'nehuba'>>, private cStore: ComponentStore<TCStoreViewerCmp>, cfr: ComponentFactoryResolver, + private dialogSvc: DialogService, @Optional() @Inject(_PLI_VOLUME_INJ_TOKEN) private _pliVol$: Observable<_TPLIVal[]>, @Optional() @Inject(REGION_OF_INTEREST) public regionOfInterest$: Observable<any> ){ @@ -271,7 +275,44 @@ export class ViewerCmp implements OnDestroy { ? getGetRegionFromLabelIndexId({ parcellation: p }) : null } - ) + ), + combineLatest([ + this.templateSelected$, + this.parcellationSelected$, + this.store$.pipe( + select(viewerStateGetSelectedAtlas) + ) + ]).pipe( + debounceTime(160) + ).subscribe(async ([tmpl, parc, atlas]) => { + const regex = /pre.?release/i + const checkPrerelease = (obj: any) => { + if (obj?.name) return regex.test(obj.name) + return false + } + const message: string[] = [] + if (checkPrerelease(atlas)) { + message.push(`- _${atlas.name}_`) + } + if (checkPrerelease(tmpl)) { + message.push(`- _${tmpl.name}_`) + } + if (checkPrerelease(parc)) { + message.push(`- _${parc.name}_`) + } + if (message.length > 0) { + message.unshift(`The following have been tagged pre-release, and may be updated frequently:`) + try { + await this.dialogSvc.getUserConfirm({ + title: `Pre-release warning`, + markdown: message.join('\n\n'), + confirmOnly: true + }) + } catch (e) { + + } + } + }) ) }