From 721a777dba571436120cf9a12930211248b63d2b Mon Sep 17 00:00:00 2001 From: fsdavid <daviti1@mail.com> Date: Tue, 25 Aug 2020 14:29:19 +0200 Subject: [PATCH] Fix switching template while connectivity is on - 639 (#644) --- src/atlasViewer/atlasViewer.template.html | 3 ++- .../atlasLayerSelector/atlasLayerSelector.component.ts | 5 ++++- src/ui/nehubaContainer/nehubaContainer.component.ts | 10 +++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/atlasViewer/atlasViewer.template.html b/src/atlasViewer/atlasViewer.template.html index 1373f74d6..a9a76fed2 100644 --- a/src/atlasViewer/atlasViewer.template.html +++ b/src/atlasViewer/atlasViewer.template.html @@ -84,7 +84,8 @@ <atlas-layer-selector #alSelector="atlasLayerSelector" class="pe-all" - (iav-outsideClick)="alSelector.selectorExpanded = false"> + (iav-outsideClick)="alSelector.selectorExpanded = false" + (closeAccordion)="uiNehubaContainer.accordionOpened = ''"> </atlas-layer-selector> <mat-chip-list class="mb-2"> <!-- additional layer --> diff --git a/src/ui/atlasLayerSelector/atlasLayerSelector.component.ts b/src/ui/atlasLayerSelector/atlasLayerSelector.component.ts index ff9f7a5bd..822ed15ed 100644 --- a/src/ui/atlasLayerSelector/atlasLayerSelector.component.ts +++ b/src/ui/atlasLayerSelector/atlasLayerSelector.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChildren, QueryList } from "@angular/core"; +import {Component, OnInit, ViewChildren, QueryList, Output, EventEmitter} from "@angular/core"; import { select, Store } from "@ngrx/store"; import { safeFilter } from "src/services/stateStore.service"; import { distinctUntilChanged, map, withLatestFrom, shareReplay, groupBy, mergeMap, toArray, switchMap, scan, tap, filter } from "rxjs/operators"; @@ -37,6 +37,8 @@ export class AtlasLayerSelector implements OnInit { public containerMaxWidth: number + @Output() public closeAccordion: EventEmitter<boolean> = new EventEmitter() + constructor(private store$: Store<any>) { this.selectedAtlas$ = this.store$.pipe( select(viewerStateGetSelectedAtlas), @@ -158,6 +160,7 @@ export class AtlasLayerSelector implements OnInit { } selectTemplateWithName(template) { + this.closeAccordion.emit() this.store$.dispatch({type: CLEAR_CONNECTIVITY_REGION}) this.store$.dispatch({type: SET_CONNECTIVITY_VISIBLE, payload: null}) this.store$.dispatch( diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts index ff3b26f6a..7a56478cd 100644 --- a/src/ui/nehubaContainer/nehubaContainer.component.ts +++ b/src/ui/nehubaContainer/nehubaContainer.component.ts @@ -741,9 +741,7 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy { this.subscriptions.push(this.selectedRegions$.subscribe(sr => { if (sr?.length >= 1) this.setConnectivityRegion(sr[0].name) else { - this.store.dispatch({type: CLEAR_CONNECTIVITY_REGION}) - this.store.dispatch({type: SET_CONNECTIVITY_VISIBLE, payload: null}) - if (this.accordionOpened === 'Connectivity') this.connectivityComponent.toggleConnectivityOnViewer(false) + this.disableConnectivity() } this.selectedRegions = sr })) @@ -816,6 +814,12 @@ export class NehubaContainer implements OnInit, OnChanges, OnDestroy { this.store.dispatch(viewerStateSetConnectivityRegion({ connectivityRegion: regionName })) } + public disableConnectivity() { + this.store.dispatch({type: CLEAR_CONNECTIVITY_REGION}) + this.store.dispatch({type: SET_CONNECTIVITY_VISIBLE, payload: null}) + if (this.accordionOpened === 'Connectivity') this.connectivityComponent.toggleConnectivityOnViewer(false) + } + sidebarAccordionOpened(title) { switch (title) { case 'Connectivity': { -- GitLab