diff --git a/src/atlasComponents/sapi/core/sapiParcellation.ts b/src/atlasComponents/sapi/core/sapiParcellation.ts index 4870493b3fca07ae091d68a797d760a8aa2159c9..4767cc2897ab0ed6c6567f3ee727ad2f73fece04 100644 --- a/src/atlasComponents/sapi/core/sapiParcellation.ts +++ b/src/atlasComponents/sapi/core/sapiParcellation.ts @@ -1,7 +1,7 @@ import { Observable } from "rxjs" import { SapiVolumeModel } from ".." import { SAPI } from "../sapi.service" -import { SapiParcellationFeatureModel, SapiParcellationModel, SapiQueryParam, SapiRegionModel } from "../type" +import {SapiParcellationFeatureModel, SapiParcellationModel, SapiQueryPriorityArg, SapiRegionModel} from "../type" type PaginationQuery = { size: number @@ -10,6 +10,8 @@ type PaginationQuery = { type ParcellationPaginationQuery = { type?: string + size?: number + page: number } export class SAPIParcellation{ @@ -17,7 +19,7 @@ export class SAPIParcellation{ } - getDetail(queryParam?: SapiQueryParam): Observable<SapiParcellationModel>{ + getDetail(queryParam?: SapiQueryPriorityArg): Observable<SapiParcellationModel>{ return this.sapi.httpGet<SapiParcellationModel>( `${this.sapi.bsEndpoint}/atlases/${encodeURIComponent(this.atlasId)}/parcellations/${encodeURIComponent(this.id)}`, null, @@ -25,7 +27,7 @@ export class SAPIParcellation{ ) } - getRegions(spaceId: string, queryParam?: SapiQueryParam): Observable<SapiRegionModel[]> { + getRegions(spaceId: string, queryParam?: SapiQueryPriorityArg): Observable<SapiRegionModel[]> { return this.sapi.httpGet<SapiRegionModel[]>( `${this.sapi.bsEndpoint}/atlases/${encodeURIComponent(this.atlasId)}/parcellations/${encodeURIComponent(this.id)}/regions`, { @@ -40,13 +42,13 @@ export class SAPIParcellation{ ) } - getFeatures(param?: PaginationQuery, parcPagination?: ParcellationPaginationQuery, queryParam?: SapiQueryParam): Observable<SapiParcellationFeatureModel[]> { + getFeatures(parcPagination?: ParcellationPaginationQuery, queryParam?: SapiQueryPriorityArg): Observable<SapiParcellationFeatureModel[]> { return this.sapi.httpGet<SapiParcellationFeatureModel[]>( `${this.sapi.bsEndpoint}/atlases/${encodeURIComponent(this.atlasId)}/parcellations/${encodeURIComponent(this.id)}/features`, { type: parcPagination?.type, - size: param?.size?.toString() || '5', - page: param?.page?.toString() || '0', + size: parcPagination?.size?.toString() || '5', + page: parcPagination?.page.toString() || '0', }, queryParam ) diff --git a/src/atlasComponents/sapi/core/sapiSpace.ts b/src/atlasComponents/sapi/core/sapiSpace.ts index 3ed79e8a7c06be812fc56de29d83cd4d543f8fa4..3effd6f16345aa82eebd3cf94b9f83118fb9546e 100644 --- a/src/atlasComponents/sapi/core/sapiSpace.ts +++ b/src/atlasComponents/sapi/core/sapiSpace.ts @@ -1,7 +1,7 @@ import { Observable } from "rxjs" import { SAPI } from '../sapi.service' import { camelToSnake } from 'common/util' -import { SapiQueryParam, SapiSpaceModel, SapiSpatialFeatureModel, SapiVolumeModel } from "../type" +import {SapiQueryPriorityArg, SapiSpaceModel, SapiSpatialFeatureModel, SapiVolumeModel} from "../type" type FeatureResponse = { features: { @@ -24,7 +24,7 @@ export class SAPISpace{ constructor(private sapi: SAPI, public atlasId: string, public id: string){} - getModalities(param?: SapiQueryParam): Observable<FeatureResponse> { + getModalities(param?: SapiQueryPriorityArg): Observable<FeatureResponse> { return this.sapi.httpGet<FeatureResponse>( `${this.sapi.bsEndpoint}/atlases/${encodeURIComponent(this.atlasId)}/spaces/${encodeURIComponent(this.id)}/features`, null, @@ -54,7 +54,7 @@ export class SAPISpace{ ) } - getDetail(param?: SapiQueryParam): Observable<SapiSpaceModel>{ + getDetail(param?: SapiQueryPriorityArg): Observable<SapiSpaceModel>{ return this.sapi.httpGet<SapiSpaceModel>( `${this.sapi.bsEndpoint}/atlases/${encodeURIComponent(this.atlasId)}/spaces/${encodeURIComponent(this.id)}`, null, diff --git a/src/atlasComponents/sapi/sapi.service.ts b/src/atlasComponents/sapi/sapi.service.ts index 465c43bbf620793220ef1589a160dff3087bcc37..3ce34e05f408b2862bfc07b19a67a1dbfe346f20 100644 --- a/src/atlasComponents/sapi/sapi.service.ts +++ b/src/atlasComponents/sapi/sapi.service.ts @@ -2,7 +2,16 @@ import { Injectable } from "@angular/core"; import { HttpClient } from '@angular/common/http'; import { map, shareReplay, tap } from "rxjs/operators"; import { SAPIAtlas, SAPISpace } from './core' -import { SapiAtlasModel, SapiParcellationModel, SapiQueryParam, SapiRegionalFeatureModel, SapiRegionModel, SapiSpaceModel, SpyNpArrayDataModel, SxplrCleanedFeatureModel } from "./type"; +import { + SapiAtlasModel, + SapiParcellationModel, + SapiQueryPriorityArg, + SapiRegionalFeatureModel, + SapiRegionModel, + SapiSpaceModel, + SpyNpArrayDataModel, + SxplrCleanedFeatureModel +} from "./type"; import { getExportNehuba } from "src/util/fn"; import { SAPIParcellation } from "./core/sapiParcellation"; import { SAPIRegion } from "./core/sapiRegion" @@ -58,15 +67,15 @@ export class SAPI{ return new SAPIRegion(this, atlasId, parcId, regionId) } - getSpaceDetail(atlasId: string, spaceId: string, param?: SapiQueryParam): Observable<SapiSpaceModel> { + getSpaceDetail(atlasId: string, spaceId: string, param?: SapiQueryPriorityArg): Observable<SapiSpaceModel> { return this.getSpace(atlasId, spaceId).getDetail(param) } - getParcDetail(atlasId: string, parcId: string, param?: SapiQueryParam): Observable<SapiParcellationModel> { + getParcDetail(atlasId: string, parcId: string, param?: SapiQueryPriorityArg): Observable<SapiParcellationModel> { return this.getParcellation(atlasId, parcId).getDetail(param) } - getParcRegions(atlasId: string, parcId: string, spaceId: string, queryParam?: SapiQueryParam): Observable<SapiRegionModel[]> { + getParcRegions(atlasId: string, parcId: string, spaceId: string, queryParam?: SapiQueryPriorityArg): Observable<SapiRegionModel[]> { const parc = this.getParcellation(atlasId, parcId) return parc.getRegions(spaceId, queryParam) } @@ -85,7 +94,7 @@ export class SAPI{ return this.http.get(`${SAPI.bsEndpoint}/modalities`) } - httpGet<T>(url: string, params?: Record<string, string>, sapiParam?: SapiQueryParam){ + httpGet<T>(url: string, params?: Record<string, string>, sapiParam?: SapiQueryPriorityArg){ const headers: Record<string, string> = {} if (sapiParam?.priority) { headers[PRIORITY_HEADER] = sapiParam.priority.toString() diff --git a/src/atlasComponents/sapi/type.ts b/src/atlasComponents/sapi/type.ts index 574975a9549a9d2b4d7f27247be581a8f997d401..687a916f5f4c9af9a69c65790b52209f369e674c 100644 --- a/src/atlasComponents/sapi/type.ts +++ b/src/atlasComponents/sapi/type.ts @@ -110,7 +110,6 @@ export function guardPipe< ) } -export type SapiQueryParam = { - priority?: number - type?: string +export type SapiQueryPriorityArg = { + priority: number } diff --git a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts index a3cf0cb8c1b181b72c1fe90cc3735cf376c5958f..df1f746683f182714cf70d842409455896ca2bac 100644 --- a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts +++ b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.component.ts @@ -197,7 +197,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy { this.fetching = true const type = this.types.find(t => t.name === this.selectedType).types[0] return this.sapi.getParcellation(this.atlas["@id"], this.parcellation["@id"]) - .getFeatures({page: this.pageNumber, size: 1}, {type}) + .getFeatures({type, page: this.pageNumber, size: 1},) .pipe( take(1), catchError(() => { diff --git a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.stories.ts b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.stories.ts index 34e44e557187979d1654ebad943fa9e7ef924b59..870492b96ef2ef98bc6657c01e3b78652a23c945 100644 --- a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.stories.ts +++ b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.stories.ts @@ -77,7 +77,7 @@ class ExampleConnectivityBrowserWrapper { loadDataset() { return this.sapi.getParcellation(this.atlas["@id"], this.parcellation["@id"]) - .getFeatures({page: this.pageNumber, size: 1}, {type: this.type}) + .getFeatures({type: this.type, page: this.pageNumber, size: 1}) .pipe( take(1), catchError(() => { diff --git a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.template.html b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.template.html index 5811549059108a97f83ff40528a82279ecd7749b..ee291d06c0cb7ddec2dcd7b8419a448db7b6bd66 100644 --- a/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.template.html +++ b/src/atlasComponents/sapiViews/features/connectivity/connectivityBrowser/connectivityBrowser.template.html @@ -33,16 +33,6 @@ class="w-100"> </mat-slider> </div> - - <ng-container *ngIf="selectedDataset.description || (selectedDataset.data && selectedDataset.data.description)" > - <!-- TODO please reimplmenent button to explore KG dataset--> - <button class="flex-grow-0 flex-shrink-0" - mat-icon-button - (click)="exportFullConnectivity()" - matTooltip="Export full connectivity profile"> - <i class="fas fa-download"></i> - </button> - </ng-container> </div> </div> diff --git a/src/atlasComponents/sapiViews/features/connectivity/hasConnectivity.directive.ts b/src/atlasComponents/sapiViews/features/connectivity/hasConnectivity.directive.ts index 9f4577128c941c4eee0a2769d77be88dbf89d854..75b5edaad1de525d756b0a2b4572f8838637bb5e 100644 --- a/src/atlasComponents/sapiViews/features/connectivity/hasConnectivity.directive.ts +++ b/src/atlasComponents/sapiViews/features/connectivity/hasConnectivity.directive.ts @@ -69,7 +69,7 @@ export class HasConnectivity implements OnDestroy { const type = m.types[0] this.sapi.getParcellation(this.atlas["@id"], this.parcellation["@id"]) - .getFeatures({page: 1, size: 1}, {type}) + .getFeatures({type, page: 1, size: 1}) .pipe( take(1), switchMap((res: any) => {