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

feat: added PM for gapmaps (#624)

* feat: added PM for gapmaps

* fix unit tests
parent d9222c29
No related branches found
No related tags found
No related merge requests found
......@@ -185,9 +185,9 @@ module.exports = [
"parcellationRegion": [
{
"species": [],
"name": "Area hOc1",
"name": "Area hOc1 (V1, 17, CalcS)",
"alias": null,
"fullId": "https://nexus.humanbrainproject.org/v0/data/minds/core/parcellationregion/v1.0.0/b851eb9d-9502-45e9-8dd8-2861f0e6da3f"
"fullId": "https://nexus.humanbrainproject.org/v0/data/minds/core/parcellationregion/v1.0.0/5151ab8f-d8cb-4e67-a449-afe2a41fb007"
}
],
"species": [
......@@ -297,9 +297,9 @@ module.exports = [
"parcellationRegion": [
{
"species": [],
"name": "Area 44d",
"name": "Area 44 (IFG)",
"alias": null,
"fullId": "https://nexus.humanbrainproject.org/v0/data/minds/core/parcellationregion/v1.0.0/8aeae833-81c8-4e27-a8d6-deee339d6052"
"fullId": "https://nexus.humanbrainproject.org/v0/data/minds/core/parcellationregion/v1.0.0/8a6be82c-5947-4fff-8348-cf9bf73e4f40"
}
],
"species": [
......
......@@ -5,7 +5,6 @@ import { provideMockStore, MockStore } from "@ngrx/store/testing"
import { getRandomHex } from 'common/util'
import { EnumWidgetTypes, TypeOpenedWidget, uiActionSetPreviewingDatasetFiles } from "./services/state/uiState.store.helper"
import { hot } from "jasmine-marbles"
import * as DATABROWSER_MODULE_EXPORTS from 'src/ui/databrowserModule'
import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing"
import { glueActionToggleDatasetPreview } from './glue'
import { getIdObj } from 'common/util'
......@@ -244,7 +243,7 @@ describe('> glue.ts', () => {
// debounce at 100ms
tick(200)
const req = ctrl.expectOne(`${DS_PREVIEW_URL}/${datasetId}/${encodeURIComponent(filename)}`)
const req = ctrl.expectOne(`${DS_PREVIEW_URL}/${encodeURIComponent('minds/core/dataset/v1.0.0')}/${datasetId}/${encodeURIComponent(filename)}`)
req.flush(nifti)
}))
})
......
......@@ -145,20 +145,21 @@ export class DatasetPreviewGlue implements IDatasetPreviewGlue, OnDestroy{
}
private fetchedDatasetPreviewCache: Map<string, any> = new Map()
private getDatasetPreviewFromId({ datasetId, filename }: IDatasetPreviewData){
private getDatasetPreviewFromId({ datasetId, filename, datasetSchema = 'minds/core/dataset/v1.0.0' }: IDatasetPreviewData){
const dsPrvId = DatasetPreviewGlue.GetDatasetPreviewId({ datasetId, filename })
const cachedPrv = this.fetchedDatasetPreviewCache.get(dsPrvId)
const cachedPrv = this.fetchedDatasetPreviewCache.get(`${datasetSchema}/${dsPrvId}`)
const filteredDsId = /[a-f0-9-]+$/.exec(datasetId)
if (cachedPrv) return of(cachedPrv)
return this.http.get(`${DS_PREVIEW_URL}/${filteredDsId}/${encodeURIComponent(filename)}`, { responseType: 'json' }).pipe(
return this.http.get(`${DS_PREVIEW_URL}/${encodeURIComponent(datasetSchema)}/${filteredDsId}/${encodeURIComponent(filename)}`, { responseType: 'json' }).pipe(
map(json => {
return {
...json,
filename,
datasetId
datasetId,
datasetSchema
}
}),
tap(val => this.fetchedDatasetPreviewCache.set(dsPrvId, val))
tap(val => this.fetchedDatasetPreviewCache.set(`${datasetSchema}/${dsPrvId}`, val))
)
}
......@@ -313,6 +314,7 @@ export class DatasetPreviewGlue implements IDatasetPreviewGlue, OnDestroy{
}
private openDatasetPreviewWidget(data: IDatasetPreviewData) {
console.log({ data })
const { datasetId: kgId, filename } = data
if (!!this.actionOnWidget) {
......
......@@ -11,7 +11,7 @@
<link rel="stylesheet" href="theme.css">
<link rel="stylesheet" href="version.css">
<script src="https://unpkg.com/kg-dataset-previewer@0.0.19/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer>
<script src="https://unpkg.com/kg-dataset-previewer@1.0.6/dist/kg-dataset-previewer/kg-dataset-previewer.js" defer>
</script>
<title>Interactive Atlas Viewer</title>
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,32 +10,6 @@ import { defaultRootState } from '../stateStore.service'
const colinsJson = require('!json-loader!../../res/ext/colin.json')
const hoc1 = {
name: "Area hOc1 (V1, 17, CalcS) - left hemisphere",
rgb: [
190,
132,
147,
],
labelIndex: 8,
ngId: "jubrain colin v18 left",
children: [],
status: "publicP",
position: [
-8533787,
-84646549,
1855106,
],
originDatasets: [
{
kgSchema: "minds/core/dataset/v1.0.0",
kgId: "5c669b77-c981-424a-858d-fe9f527dbc07",
filename: "Area hOc1 (V1, 17, CalcS) [v2.4, Colin 27, left hemisphere]"
}
],
}
describe('effect.ts', () => {
describe('getGetRegionFromLabelIndexId', () => {
it('translateds hoc1 from labelIndex to region', () => {
......@@ -46,8 +20,10 @@ describe('effect.ts', () => {
updated: true,
},
})
const fetchedRegion = getRegionFromlabelIndexId({ labelIndexId: 'jubrain colin v18 left#8' })
expect(fetchedRegion).toEqual(hoc1)
const fetchedRegion = getRegionFromlabelIndexId({ labelIndexId: 'julich brain colin v22 left#116' })
expect(fetchedRegion).toBeTruthy()
expect(fetchedRegion.fullId.kg.kgId).toEqual('5151ab8f-d8cb-4e67-a449-afe2a41fb007')
})
})
......
......@@ -41,6 +41,7 @@ export enum EnumWidgetTypes{
export interface IDatasetPreviewData{
datasetId: string
filename: string
datasetSchema?: string
}
export type TypeOpenedWidget = {
......
......@@ -5,6 +5,7 @@ import { Observable, fromEvent, Subscription, of, throwError } from "rxjs";
import { switchMapTo, catchError, take, concatMap, map, retryWhen, delay } from "rxjs/operators";
import { DomSanitizer, SafeResourceUrl } from "@angular/platform-browser";
import { ARIA_LABELS } from 'common/constants'
import { DS_PREVIEW_URL } from 'src/util/constants'
const {
DOWNLOAD_PREVIEW,
......@@ -78,6 +79,8 @@ export class PreviewComponentWrapper{
this.backendUrl = backendUrl
this.datasetName = datasetName
}
this.backendUrl = this.backendUrl || DS_PREVIEW_URL
}
public downloadHref: SafeResourceUrl
......
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