From bcfbdd9094126015cbed943cb612b768e9fd4c6e Mon Sep 17 00:00:00 2001
From: fsdavid <daviti1@mail.com>
Date: Fri, 20 Dec 2019 14:44:14 +0100
Subject: [PATCH] make connectivity region public

---
 src/atlasViewer/atlasViewer.component.ts        |  3 ---
 .../connectivityBrowser.component.ts            | 17 ++++++++---------
 .../connectivityBrowser.template.html           |  2 +-
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/atlasViewer/atlasViewer.component.ts b/src/atlasViewer/atlasViewer.component.ts
index cc502dab8..8932257fb 100644
--- a/src/atlasViewer/atlasViewer.component.ts
+++ b/src/atlasViewer/atlasViewer.component.ts
@@ -35,7 +35,6 @@ import { AGREE_COOKIE, AGREE_KG_TOS, SHOW_KG_TOS, SHOW_BOTTOM_SHEET } from "src/
 import { TabsetComponent } from "ngx-bootstrap/tabs";
 import { LocalFileService } from "src/services/localFile.service";
 import { MatDialog, MatDialogRef, MatSnackBar, MatSnackBarRef, MatBottomSheet, MatBottomSheetRef } from "@angular/material";
-import {SearchSideNav} from "src/ui/searchSideNav/searchSideNav.component";
 import {
   CLOSE_SIDE_PANEL,
   OPEN_SIDE_PANEL
@@ -75,8 +74,6 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
 
   @ViewChild('mobileMenuTabs') mobileMenuTabs: TabsetComponent
 
-  @ViewChild('searchSideNav') searchSideNav: SearchSideNav
-
   /**
    * required for styling of all child components
    */
diff --git a/src/ui/connectivityBrowser/connectivityBrowser.component.ts b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
index d75f4c6ba..761a9fc01 100644
--- a/src/ui/connectivityBrowser/connectivityBrowser.component.ts
+++ b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
@@ -18,7 +18,7 @@ import {CLEAR_CONNECTIVITY_REGION, SET_CONNECTIVITY_REGION} from "src/services/s
 })
 export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
 
-    private region: string
+    public region: string
     private connectedAreas = []
 
 
@@ -28,7 +28,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
     public expandMenuIndex = -1
     public allRegions = []
     public defaultColorMap: Map<string, Map<number, {red: number, green: number, blue: number}>>
-    public noConnectivityForParcellation = false
+    public parcellationHasConnectivityData = true
     private areaHemisphere: string
 
     math = Math
@@ -56,7 +56,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
         this.subscriptions.push(
             this.selectedParcellation$.subscribe(parcellation => {
                 if (parcellation && parcellation.hasAdditionalViewMode && parcellation.hasAdditionalViewMode.includes('connectivity')) {
-                    this.noConnectivityForParcellation = false
+                    this.parcellationHasConnectivityData = true
                     if (parcellation.regions && parcellation.regions.length) {
                         this.allRegions = []
                         this.getAllRegionsFromParcellation(parcellation.regions)
@@ -65,7 +65,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
                         }
                     }
                 } else {
-                    this.noConnectivityForParcellation = true
+                    this.parcellationHasConnectivityData = false
                 }
             }),
             this.connectivityRegion$.subscribe(cr => {
@@ -75,15 +75,14 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy {
             })
         )
 
-        const connectivityData$ = fromEvent(this.connectivityComponentElement.nativeElement, 'connectivityDataReceived', { capture: true })
-        const collapsedMenuIndex$ = fromEvent(this.connectivityComponentElement.nativeElement, 'collapsedMenuChanged', { capture: true })
-
         this.subscriptions.push(
-            connectivityData$.subscribe((e: CustomEvent) => {
+            fromEvent(this.connectivityComponentElement.nativeElement, 'connectivityDataReceived', { capture: true })
+                .subscribe((e: CustomEvent) => {
                 this.connectedAreas = e.detail
                 if (this.connectedAreas.length > 0) this.addNewColorMap()
             }),
-            collapsedMenuIndex$.subscribe((e: CustomEvent) => {
+            fromEvent(this.connectivityComponentElement.nativeElement, 'collapsedMenuChanged', { capture: true })
+                .subscribe((e: CustomEvent) => {
                 this.expandMenuIndex = e.detail
             }),
 
diff --git a/src/ui/connectivityBrowser/connectivityBrowser.template.html b/src/ui/connectivityBrowser/connectivityBrowser.template.html
index 8f05020c7..cbde664d5 100644
--- a/src/ui/connectivityBrowser/connectivityBrowser.template.html
+++ b/src/ui/connectivityBrowser/connectivityBrowser.template.html
@@ -1,4 +1,4 @@
-<div class="w-100 h-100 overflow-auto d-block d-flex flex-column pb-2" #connectivityComponent *ngIf="!noConnectivityForParcellation; else noConnectivity">
+<div class="w-100 h-100 overflow-auto d-block d-flex flex-column pb-2" #connectivityComponent *ngIf="parcellationHasConnectivityData; else noConnectivity">
     <!--ToDo set show-description="true" when data will available-->
     <hbp-connectivity-matrix-row
             [region]="region"
-- 
GitLab