diff --git a/docs/releases/v2.3.3.md b/docs/releases/v2.3.3.md index ad662197a8d1e091372f5a9bcd8ca48fab717f0e..daf21d1b8a1090df33fa4ff89351285bf271ea1e 100644 --- a/docs/releases/v2.3.3.md +++ b/docs/releases/v2.3.3.md @@ -1,4 +1,4 @@ -# v2.3.2 +# v2.3.3 ## Bugfixes diff --git a/docs/releases/v2.3.4.md b/docs/releases/v2.3.4.md new file mode 100644 index 0000000000000000000000000000000000000000..7874ad49313a9e874ae5b80787a9e25c10ef0a35 --- /dev/null +++ b/docs/releases/v2.3.4.md @@ -0,0 +1,5 @@ +# v2.3.4 + +## Bugfixes + +- fix connectivity dataset external link diff --git a/mkdocs.yml b/mkdocs.yml index 7afc5fcad58f0eb98bcaf8114adbc1a9979135ba..f510448ed99da52e0253813054cfcb4f61c0c4e7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -40,6 +40,7 @@ pages: - Fetching datasets: 'advanced/datasets.md' - Display non-atlas volumes: 'advanced/otherVolumes.md' - Release notes: + - v2.3.4: 'releases/v2.3.4.md' - v2.3.3: 'releases/v2.3.3.md' - v2.3.2: 'releases/v2.3.2.md' - v2.3.1: 'releases/v2.3.1.md' diff --git a/src/ui/connectivityBrowser/connectivityBrowser.component.spec.ts b/src/ui/connectivityBrowser/connectivityBrowser.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..72aa760cb486d4a0457df4669ea12559ec446ee3 --- /dev/null +++ b/src/ui/connectivityBrowser/connectivityBrowser.component.spec.ts @@ -0,0 +1,78 @@ +import {ConnectivityBrowserComponent} from "src/ui/connectivityBrowser/connectivityBrowser.component"; +import {async, ComponentFixture, TestBed} from "@angular/core/testing"; +import {Action} from "@ngrx/store"; +import { + defaultRootState, +} from "src/services/stateStore.service"; +import {HttpClientModule} from "@angular/common/http"; +import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core"; +import {DatabrowserModule} from "src/ui/databrowserModule"; +import {provideMockActions} from "@ngrx/effects/testing"; +import {provideMockStore} from "@ngrx/store/testing"; +import {Observable, of} from "rxjs"; + +describe('ConnectivityComponent', () => { + + let component: ConnectivityBrowserComponent; + let fixture: ComponentFixture<ConnectivityBrowserComponent>; + const actions$: Observable<Action> = of({type: 'TEST'}) + + let datasetList = [ + { + id: 'id1', + name: 'n1', + description: 'd1', + kgId: 'kgId1', + kgschema: 'kgschema1' + }, { + id: 'id2', + name: 'n2', + description: 'd2', + kgId: 'kgId2', + kgschema: 'kgschema2' + } + ] + + beforeEach(async (() => { + TestBed.configureTestingModule({ + imports: [ + HttpClientModule, + DatabrowserModule + ], + providers: [ + provideMockActions(() => actions$), + provideMockStore({ initialState: defaultRootState }) + ], + declarations: [ConnectivityBrowserComponent], + schemas: [ + CUSTOM_ELEMENTS_SCHEMA, + ], + }).compileComponents() + })); + + it('> component can be created', async () => { + fixture = TestBed.createComponent(ConnectivityBrowserComponent) + component = fixture.componentInstance + expect(component).toBeTruthy() + }) + + it('> change dataset changes description, kgId and kgschema', () => { + fixture = TestBed.createComponent(ConnectivityBrowserComponent) + component = fixture.componentInstance + + component.datasetList = datasetList + + component.changeDataset({value: 'n1'}) + + expect(component.selectedDatasetDescription).toEqual('d1') + expect(component.selectedDatasetKgId).toEqual('kgId1') + expect(component.selectedDatasetKgSchema).toEqual('kgschema1') + + component.changeDataset({value: 'n2'}) + + expect(component.selectedDatasetDescription).toEqual('d2') + expect(component.selectedDatasetKgId).toEqual('kgId2') + expect(component.selectedDatasetKgSchema).toEqual('kgschema2') + }) + +}); \ No newline at end of file diff --git a/src/ui/connectivityBrowser/connectivityBrowser.component.ts b/src/ui/connectivityBrowser/connectivityBrowser.component.ts index 32c9bac5847785fbb54f840d93e1e739760decf3..5e1996b84472dcfac7b6f78a57ec76f7b0d8960d 100644 --- a/src/ui/connectivityBrowser/connectivityBrowser.component.ts +++ b/src/ui/connectivityBrowser/connectivityBrowser.component.ts @@ -112,6 +112,8 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe public datasetList: any[] = [] public selectedDataset: any public selectedDatasetDescription: string = '' + public selectedDatasetKgId: string = '' + public selectedDatasetKgSchema: string = '' public connectedAreas = [] private selectedParcellationFlatRegions$ = this.store$.pipe( @@ -151,7 +153,8 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe this.datasetList = res.filter(dl => dl['parcellation id'] === this.parcellationId) this.selectedDataset = this.datasetList[0].name this.selectedDatasetDescription = this.datasetList[0].description - + this.selectedDatasetKgId = this.datasetList[0].kgId + this.selectedDatasetKgSchema = this.datasetList[0].kgschema this.changeDataset() }) } @@ -166,9 +169,9 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe } }) ) - - /** - * Listen to of clear view entries + + /** + * Listen to of clear view entries * can come from within the component (when connectivity is not available for the dataset) * --> do not collapse * or outside (user clicks x in chip) @@ -186,7 +189,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe } }) ) - + this.subscriptions.push(this.overwrittenColorMap$.subscribe(ocm => { if (this.accordionIsExpanded && !ocm) { @@ -209,7 +212,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe this.setColorMap$.pipe( distinctUntilChanged() ), - fromEvent(this.connectivityComponentElement.nativeElement, 'connectivityDataReceived').pipe( + fromEvent(this.connectivityComponentElement?.nativeElement, 'connectivityDataReceived').pipe( map((e: CustomEvent) => e.detail) ) ).subscribe(([flag, connectedAreas]) => { @@ -278,7 +281,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe this.restoreDefaultColormap() this.subscriptions.forEach(s => s.unsubscribe()) } - + clearViewer() { this.store$.dispatch( ngViewerActionClearView({ @@ -297,7 +300,10 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe changeDataset(event = null) { if (event) { this.selectedDataset = event.value - this.selectedDatasetDescription = this.datasetList.find(d => d.name === this.selectedDataset).description + const foundDataset = this.datasetList.find(d => d.name === this.selectedDataset) + this.selectedDatasetDescription = foundDataset?.description + this.selectedDatasetKgId = foundDataset?.kgId || null + this.selectedDatasetKgSchema = foundDataset?.kgschema || null } if (this.datasetList.length && this.selectedDataset) { const selectedDatasetId = this.datasetList.find(d => d.name === this.selectedDataset).id @@ -355,7 +361,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe const existingMap: Map<string, Map<number, { red: number, green: number, blue: number }>> = (getWindow().interactiveViewer.viewerHandle.getLayersSegmentColourMap()) const colorMap = new Map(existingMap) - + this.allRegions.forEach(r => { if (r.ngId) { colorMap.get(r.ngId).set(r.labelIndex, {red: 255, green: 255, blue: 255}) @@ -365,7 +371,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe this.connectedAreas.forEach(area => { const areaAsRegion = this.allRegions .filter(r => { - + if (this.regionHemisphere) { let regionName = area.name let regionStatus = null @@ -378,7 +384,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe } return r.name === regionName && r.status === regionStatus } - + return r.name === area.name }) .map(r => r) @@ -400,7 +406,7 @@ export class ConnectivityBrowserComponent implements OnInit, AfterViewInit, OnDe } public exportFullConnectivity() { - this.fullConnectivityGridElement.nativeElement['downloadCSV']() + this.fullConnectivityGridElement?.nativeElement['downloadCSV']() } } diff --git a/src/ui/connectivityBrowser/connectivityBrowser.template.html b/src/ui/connectivityBrowser/connectivityBrowser.template.html index 3f69aa9c292f8d61a236f30bad6f9f963938b84e..eafa8d10c31ff86138e9d45cff13cea3201aaf43 100644 --- a/src/ui/connectivityBrowser/connectivityBrowser.template.html +++ b/src/ui/connectivityBrowser/connectivityBrowser.template.html @@ -38,7 +38,10 @@ <button class="flex-grow-0 flex-shrink-0" mat-icon-button iav-dataset-show-dataset-dialog [iav-dataset-show-dataset-dialog-name]="selectedDataset" - [iav-dataset-show-dataset-dialog-description]="selectedDatasetDescription"> + [iav-dataset-show-dataset-dialog-description]="selectedDatasetDescription" + [iav-dataset-show-dataset-dialog-kgid]="selectedDatasetKgId? selectedDatasetKgId : null" + [iav-dataset-show-dataset-dialog-kgschema]="selectedDatasetKgSchema? selectedDatasetKgSchema : null" + > <i class="fas fa-info"></i> </button> <button class="flex-grow-0 flex-shrink-0"