From cb321792c355b10ef648554d4dae7d9b301efe15 Mon Sep 17 00:00:00 2001
From: fsdavid <daviti1@mail.com>
Date: Tue, 4 Aug 2020 18:16:02 +0200
Subject: [PATCH] Export full connectivity (#622)

---
 package.json                                        |  2 +-
 .../connectivityBrowser.component.ts                |  6 +++++-
 .../connectivityBrowser.template.html               | 13 ++++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/package.json b/package.json
index 8faee773b..4d72c6409 100644
--- a/package.json
+++ b/package.json
@@ -88,7 +88,7 @@
     "@ngrx/store": "^9.1.1",
     "@types/node": "12.12.39",
     "export-nehuba": "0.0.2",
-    "hbp-connectivity-component": "^0.3.3",
+    "hbp-connectivity-component": "^0.3.5",
     "zone.js": "^0.10.2"
   }
 }
diff --git a/src/ui/connectivityBrowser/connectivityBrowser.component.ts b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
index 1b8d45857..ed930b686 100644
--- a/src/ui/connectivityBrowser/connectivityBrowser.component.ts
+++ b/src/ui/connectivityBrowser/connectivityBrowser.component.ts
@@ -44,7 +44,7 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy, A
     }
 
     @ViewChild('connectivityComponent', {read: ElementRef}) public connectivityComponentElement: ElementRef<HTMLHbpConnectivityMatrixRowElement>
-
+    @ViewChild('fullConnectivityGrid') public fullConnectivityGridElement: ElementRef<HTMLFullConnectivityGridElement>
 
     @Output() public closeConnectivity: EventEmitter<boolean> = new EventEmitter()
     @Output() public connectedAreaCount: EventEmitter<number> = new EventEmitter()
@@ -248,6 +248,10 @@ export class ConnectivityBrowserComponent implements AfterViewInit, OnDestroy, A
       }
     }
 
+    public exportFullConnectivity() {
+      this.fullConnectivityGridElement.nativeElement['downloadCSV']()
+    }
+
 }
 
 function getWindow(): any {
diff --git a/src/ui/connectivityBrowser/connectivityBrowser.template.html b/src/ui/connectivityBrowser/connectivityBrowser.template.html
index 9f626cf32..5cce4d81a 100644
--- a/src/ui/connectivityBrowser/connectivityBrowser.template.html
+++ b/src/ui/connectivityBrowser/connectivityBrowser.template.html
@@ -1,5 +1,6 @@
-<div class="w-100 h-100 d-block d-flex flex-column pb-2" #connectivityComponent>
+<div class="w-100 h-100 d-block d-flex flex-column pb-2">
     <hbp-connectivity-matrix-row
+            #connectivityComponent
             *ngIf="region"
             [region]="region"
             theme="dark"
@@ -41,6 +42,12 @@
                             [iav-dataset-show-dataset-dialog-description]="selectedDataset.description">
                         <i class="fas fa-info"></i>
                     </button>
+                    <button class="flex-grow-0 flex-shrink-0"
+                            mat-icon-button
+                            (click)="exportFullConnectivity()"
+                            matTooltip="Export full connectivity profile">
+                        <i class="fas fa-download"></i>
+                    </button>
                 </ng-container>
 
                 </div>
@@ -67,4 +74,8 @@
             </div>
         </div>
     </hbp-connectivity-matrix-row>
+    <full-connectivity-grid #fullConnectivityGrid
+                            dataset-url="https://connectivityquery-connectivity.apps-dev.hbp.eu/studies"
+                            onlyExport="true">
+    </full-connectivity-grid>
 </div>
\ No newline at end of file
-- 
GitLab