From 6001db7b137c33f6b829b4f4596af0c73064c0ef Mon Sep 17 00:00:00 2001
From: Julian Matschinske <julian.matschinske@wzw.tum.de>
Date: Mon, 13 Apr 2020 12:18:55 +0200
Subject: [PATCH] Add button for graph export

---
 .../analysis-window/analysis-window.component.html | 14 ++++++++++++++
 .../analysis-window/analysis-window.component.ts   |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/src/app/components/analysis-window/analysis-window.component.html b/src/app/components/analysis-window/analysis-window.component.html
index f37b055f..c589a593 100644
--- a/src/app/components/analysis-window/analysis-window.component.html
+++ b/src/app/components/analysis-window/analysis-window.component.html
@@ -135,6 +135,7 @@
               </button>
             </p>
           </div>
+
           <div class="field">
             <p class="control footer-buttons">
               <button class="button is-danger is-rounded has-tooltip" data-tooltip="Delete the current analysis."
@@ -156,6 +157,19 @@
           <app-toggle class="footer-buttons" textOn="Animation On" textOff="Off"
                       tooltipOn="Enable the network animation." tooltipOff="Disable the network animation and freeze nodes."
                       [value]="physicsEnabled" (valueChange)="updatePhysicsEnabled($event)"></app-toggle>
+
+          <div class="field">
+            <p class="control footer-buttons">
+              <a [href]="graphmlLink()" class="button is-success is-rounded has-tooltip" data-tooltip="Export this network as .graphml file.">
+                <span class="icon">
+                  <i class="fas fa-download" aria-hidden="true"></i>
+                </span>
+                <span>
+                  Export as .graphml
+                </span>
+              </a>
+            </p>
+          </div>
         </footer>
       </div>
       <div class="content tab-content scrollable" *ngIf="task && task.info.done" [class.is-visible]="tab === 'table'">
diff --git a/src/app/components/analysis-window/analysis-window.component.ts b/src/app/components/analysis-window/analysis-window.component.ts
index a2ae23cd..3370e8e5 100644
--- a/src/app/components/analysis-window/analysis-window.component.ts
+++ b/src/app/components/analysis-window/analysis-window.component.ts
@@ -305,6 +305,10 @@ export class AnalysisWindowComponent implements OnInit, OnChanges {
     return `${environment.backend}task_result/?token=${this.token}&view=${view}&fmt=csv`;
   }
 
+  public graphmlLink(): string {
+    return `${environment.backend}graph_export/?token=${this.token}`;
+  }
+
   public inferNodeType(nodeId: string): WrapperType {
     if (nodeId.indexOf('-') !== -1 || nodeId.indexOf('_') !== -1) {
       return 'virus';
-- 
GitLab