diff --git a/docs/releases/v2.5.3.md b/docs/releases/v2.5.3.md new file mode 100644 index 0000000000000000000000000000000000000000..ed2430edd04bb40e8661f254d9692a5f30100c74 --- /dev/null +++ b/docs/releases/v2.5.3.md @@ -0,0 +1,5 @@ +# v2.5.3 + +## Bugfixes + +- revert v2.5.2 diff --git a/docs/releases/v2.5.4.md b/docs/releases/v2.5.4.md new file mode 100644 index 0000000000000000000000000000000000000000..dcd355d798c930d12a3977f8ac4368d4a8078cce --- /dev/null +++ b/docs/releases/v2.5.4.md @@ -0,0 +1,5 @@ +# v2.5.4 + +## Under the hood + +- Added version check for siibra-api diff --git a/mkdocs.yml b/mkdocs.yml index b7e247316f838021293df1ef5f887cc486abef56..476dfab49e8293f4cb00942adf79868386926570 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,6 +40,8 @@ pages: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.5.4: 'releases/v2.5.4.md' + - v2.5.3: 'releases/v2.5.3.md' - v2.5.2: 'releases/v2.5.2.md' - v2.5.1: 'releases/v2.5.1.md' - v2.5.0: 'releases/v2.5.0.md' diff --git a/package.json b/package.json index d74087fd8ff6104452c3a3185e269101a7eb5cde..0f3aae01c1446f0e95a11d8265e25f925317d8d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interactive-viewer", - "version": "2.5.2", + "version": "2.5.4", "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/util/pureConstant.service.spec.ts b/src/util/pureConstant.service.spec.ts index 2ca6fb127878caace8d1fdf0d5049a65bd2cc2af..28c60d696e3648daafefe1e70a48fd85aa0f853f 100644 --- a/src/util/pureConstant.service.spec.ts +++ b/src/util/pureConstant.service.spec.ts @@ -1,11 +1,11 @@ import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing" import { TestBed } from "@angular/core/testing" +import { MatSnackBarModule } from "@angular/material/snack-bar" import { MockStore, provideMockStore } from "@ngrx/store/testing" -import { hot } from "jasmine-marbles" import { BS_ENDPOINT } from "src/atlasComponents/regionalFeatures/bsFeatures" import { AtlasWorkerService } from "src/atlasViewer/atlasViewer.workerService.service" import { viewerStateFetchedAtlasesSelector, viewerStateFetchedTemplatesSelector } from "src/services/state/viewerState/selectors" -import { PureContantService } from "./pureConstant.service" +import { PureContantService, SIIBRA_API_VERSION_HEADER_KEY } from "./pureConstant.service" import { TAtlas } from "./siibraApiConstants/types" const MOCK_BS_ENDPOINT = `http://localhost:1234` @@ -17,6 +17,7 @@ describe('> pureConstant.service.ts', () => { TestBed.configureTestingModule({ imports:[ HttpClientTestingModule, + MatSnackBarModule, ], providers: [ provideMockStore(), @@ -65,7 +66,11 @@ describe('> pureConstant.service.ts', () => { it('> can be init, and configuration emits allFetchingReady$', () => { const service = TestBed.inject(PureContantService) const exp = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases`) - exp.flush([mockAtlas]) + exp.flush([mockAtlas], { + headers: { + [SIIBRA_API_VERSION_HEADER_KEY]: '0.1.5' + } + }) service.allFetchingReady$.subscribe() const expT1 = httpController.expectOne(`${MOCK_BS_ENDPOINT}/atlases/${encodeURIComponent(mockAtlas.id)}/spaces`) diff --git a/src/util/pureConstant.service.ts b/src/util/pureConstant.service.ts index c6145b3d2a7617850815eb6bf9212c81481b5efd..8c5eb519505c7e75c5a51a32fd2ba987e5f519f4 100644 --- a/src/util/pureConstant.service.ts +++ b/src/util/pureConstant.service.ts @@ -13,7 +13,10 @@ import { IVolumeTypeDetail, TAtlas, TId, TParc, TRegion, TRegionDetail, TSpaceFu import { MultiDimMap, recursiveMutate, mutateDeepMerge } from "./fn"; import { patchRegions } from './patchPureConstants' import { environment } from "src/environments/environment"; +import { MatSnackBar } from "@angular/material/snack-bar"; +export const SIIBRA_API_VERSION_HEADER_KEY='X-Siibra-Api-Version' +export const SIIBRA_API_VERSION = '0.1.5' const validVolumeType = new Set([ 'neuroglancer/precomputed', @@ -375,6 +378,7 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" private store: Store<any>, private http: HttpClient, private log: LoggingService, + private snackbar: MatSnackBar, @Inject(BS_ENDPOINT) private bsEndpoint: string, ){ this.darktheme$ = this.store.pipe( @@ -420,10 +424,21 @@ Raise/track issues at github repo: <a target = "_blank" href = "${this.repoUrl}" private getAtlases$ = this.http.get<TAtlas[]>( `${this.bsEndpoint}/atlases`, { - responseType: 'json' + observe: 'response' } ).pipe( - map(arr => { + tap(resp => { + const respVersion = resp.headers.get(SIIBRA_API_VERSION_HEADER_KEY) + if (respVersion !== SIIBRA_API_VERSION) { + this.snackbar.open(`Expecting ${SIIBRA_API_VERSION}, got ${respVersion}. Some functionalities may not work as expected.`, 'Dismiss', { + duration: 5000 + }) + } + console.log(`siibra-api::version::${respVersion}`) + console.log(`expecting::${SIIBRA_API_VERSION}`) + }), + map(resp => { + const arr = resp.body const { EXPERIMENTAL_FEATURE_FLAG } = environment if (EXPERIMENTAL_FEATURE_FLAG) return arr return arr.filter(atlas => !/pre.?release/i.test(atlas.name))