Skip to content
Snippets Groups Projects
Commit 7886e681 authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: hasconnectivity directive

parent 1cc09fd8
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ import {of, Subscription} from "rxjs"; ...@@ -3,7 +3,6 @@ import {of, Subscription} from "rxjs";
import {switchMap} from "rxjs/operators"; import {switchMap} from "rxjs/operators";
import {BS_ENDPOINT} from "src/util/constants"; import {BS_ENDPOINT} from "src/util/constants";
import {HttpClient} from "@angular/common/http"; import {HttpClient} from "@angular/common/http";
import {getIdFromKgIdObj} from "common/util";
@Directive({ @Directive({
selector: '[has-connectivity]', selector: '[has-connectivity]',
...@@ -28,11 +27,8 @@ export class HasConnectivity implements OnInit, OnDestroy { ...@@ -28,11 +27,8 @@ export class HasConnectivity implements OnInit, OnDestroy {
checkConnectivity(region) { checkConnectivity(region) {
const {atlas, parcellation, template} = region.context const {atlas, parcellation, template} = region.context
if (region.id || region.name) { if (region.name) {
const regionId = region.id? region.id.kg? getIdFromKgIdObj(region.id.kg) const connectivityUrl = `${this.siibraApiUrl}/atlases/${encodeURIComponent(atlas['@id'])}/parcellations/${encodeURIComponent(parcellation['@id'])}/regions/${encodeURIComponent(region.name)}/features/ConnectivityProfile`
: region.id : null
const connectivityUrl = `${this.siibraApiUrl}/atlases/${encodeURIComponent(atlas['@id'])}/parcellations/${encodeURIComponent(parcellation['@id'])}/regions/${encodeURIComponent(regionId || region.name)}/features/ConnectivityProfile`
this.subscriptions.push( this.subscriptions.push(
this.httpClient.get<[]>(connectivityUrl).pipe(switchMap((res: any[]) => { this.httpClient.get<[]>(connectivityUrl).pipe(switchMap((res: any[]) => {
......
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