Skip to content
Snippets Groups Projects
Commit 7be7c75d authored by Daviti Gogshelidze's avatar Daviti Gogshelidze
Browse files

fix lint and navigate

parent c75cb148
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,7 @@
</ng-template>
<sxplr-feature-entry
[template]="template"
[parcellation]="parcellation"
[region]="region">
</sxplr-feature-entry>
......
......@@ -9,8 +9,6 @@ import { ListComponent } from './list/list.component';
})
export class CategoryAccDirective implements AfterContentInit, OnDestroy {
constructor() { }
public isBusy$ = new BehaviorSubject<boolean>(false)
public total$ = new BehaviorSubject<number>(0)
......
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild, Input, ChangeDetectorRef} from "@angular/core";
import {select, Store} from "@ngrx/store";
import {fromEvent, Subscription, BehaviorSubject, Observable} from "rxjs";
import {catchError, take} from "rxjs/operators";
import {catchError, take, switchMap} from "rxjs/operators";
import { atlasAppearance } from "src/state";
import {SAPI} from "src/atlasComponents/sapi/sapi.service";
import { of } from "rxjs";
import {CustomLayer} from "src/state/atlasAppearance";
import { HttpClient } from "@angular/common/http";
import { SxplrAtlas, SxplrParcellation, SxplrRegion } from "src/atlasComponents/sapi/sxplrTypes";
import { SxplrAtlas, SxplrParcellation, SxplrRegion, SxplrTemplate } from "src/atlasComponents/sapi/sxplrTypes";
import { actions, selectors } from "src/state/atlasSelection";
import { translateV3Entities } from "src/atlasComponents/sapi/translateV3";
@Component({
selector: 'sxplr-features-connectivity-browser',
......@@ -22,6 +23,9 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
@Input('sxplr-features-connectivity-browser-atlas')
atlas: SxplrAtlas
@Input('sxplr-features-connectivity-browser-template')
template: SxplrTemplate
@Input('sxplr-features-connectivity-browser-parcellation')
parcellation: SxplrParcellation
......@@ -122,6 +126,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
private store$: Store,
private http: HttpClient,
private changeDetectionRef: ChangeDetectorRef,
protected sapi: SAPI
) {
SAPI.BsEndpoint$.pipe(take(1)).subscribe(en => this.endpoint = `${en}/feature/RegionalConnectivity`)
}
......@@ -142,17 +147,9 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
)
this.subscriptions.push(
fromEvent(this.connectivityComponentElement.nativeElement, 'customToolEvent', {capture: true})
.subscribe((e: CustomEvent) => {
if (e.detail.name === 'export csv') {
// ToDo Fix in future to use component
const a = document.querySelector('hbp-connectivity-matrix-row');
(a as any).downloadCSV()
}
}),
fromEvent(this.connectivityComponentElement.nativeElement, 'connectedRegionClicked', {capture: true})
.subscribe((e: CustomEvent) => {
this.navigateToRegion(this.getRegionWithName(e.detail.name))
this.navigateToRegion(e.detail.name)
}),
)
}
......@@ -318,18 +315,28 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
this.setCustomLayer()
}
//ToDo bestViewPoint is null for the most cases
navigateToRegion(region: SxplrRegion) {
const regionCentroid = region.centroid
if (regionCentroid)
this.store$.dispatch(
actions.navigateTo({
navigation: {
position: regionCentroid.loc.map(v => v*1e6),
},
animation: true
})
)
navigateToRegion(regionName: string) {
this.sapi.v3Get("/regions/{region_id}", {
path: {region_id: regionName},
query: {
parcellation_id: this.parcellation.id,
space_id: this.template.id
}
}).pipe(
switchMap(r => translateV3Entities.translateRegion(r))
).subscribe(region => {
const centroid = region.centroid?.loc
if (centroid) {
this.store$.dispatch(
actions.navigateTo({
navigation: {
position: centroid.map(v => v*1e6),
},
animation: true
})
)
}
})
}
getRegionWithName(region: string) {
......
......@@ -84,8 +84,8 @@
</div>
<hbp-connectivity-matrix-row #connectivityComponent
[style.visibility]="selectedCohort && (selectedSubjectIndex >= 0 || !averageDisabled)? 'visible' : 'hidden'"
*ngIf="regionName && !fetching && !noConnectivityForRegion"
[style.visibility]="regionName && !fetching && !noConnectivityForRegion && selectedCohort
&& (selectedSubjectIndex >= 0 || !averageDisabled)? 'visible' : 'hidden'"
[region]="regionName"
[connections]="connectionsString"
show-export="true" hide-export-view="true" theme="dark">
......
......@@ -65,6 +65,7 @@
<sxplr-features-connectivity-browser class="pe-all flex-shrink-1"
[region]="region"
[sxplr-features-connectivity-browser-atlas]="atlas | async"
[sxplr-features-connectivity-browser-template]="template"
[sxplr-features-connectivity-browser-parcellation]="parcellation"
[accordionExpanded]="connectivityAccordion.expanded"
[types]="connectivity[0].value">
......
......@@ -6,7 +6,7 @@ import { SxplrParcellation, SxplrRegion, SxplrTemplate } from 'src/atlasComponen
import { FeatureType, SapiRoute } from 'src/atlasComponents/sapi/typeV3';
import { Feature, CorticalFeature, VoiFeature, TabularFeature } from "src/atlasComponents/sapi/sxplrTypes"
type ObservableOf<Obs extends Observable<unknown>> = Parameters<Obs['subscribe']>[0] extends Function
type ObservableOf<Obs extends Observable<unknown>> = Parameters<Obs['subscribe']>[0] extends () => void
? Parameters<Parameters<Obs['subscribe']>[0]>[0]
: never
......
......@@ -26,9 +26,9 @@ export class LayerCtrlEffects {
* TODO implement
*/
throw new Error(`IMPLEMENT ME`)
for (const volumeFormat in volumeModel.providedVolumes) {
// for (const volumeFormat in volumeModel.providedVolumes) {
}
// }
return []
}
......
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