From bccacd4d1acbe38353e535f94cd5bacf05886906 Mon Sep 17 00:00:00 2001
From: Maiykol <hartung.michael@outlook.com>
Date: Thu, 24 Jun 2021 16:51:27 +0200
Subject: [PATCH] refresh network on network relevant config change

---
 .../pages/explorer-page/explorer-page.component.ts  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/app/pages/explorer-page/explorer-page.component.ts b/src/app/pages/explorer-page/explorer-page.component.ts
index cde11c06..3a02fff3 100644
--- a/src/app/pages/explorer-page/explorer-page.component.ts
+++ b/src/app/pages/explorer-page/explorer-page.component.ts
@@ -49,20 +49,25 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
     if (typeof config === 'undefined') {
       return;
     }
+    // check if config updates affect network
+    let updateNetworkFlag = false;
 
     const configObj = JSON.parse(config);
     for (const key of Object.keys(configObj)) {
       if (key === 'nodeGroups' ) {
         this.setConfigNodeGroup(key, configObj[key]);
+        updateNetworkFlag = true;
         // dont set the key here, will be set in function
         continue;
       } else if (key === 'edgeGroups') {
         this.setConfigEdgeGroup(key, configObj[key])
+        updateNetworkFlag = true;
         // dont set the key here, will be set in function
         continue;
       }
       else if (key === 'interactions') {
         this.getInteractions();
+        updateNetworkFlag = true;
         // dont set the key here, will be set in function
         continue;
       } else if (key === 'showLeftSidebar') {
@@ -84,6 +89,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
       }
       this.myConfig[key] = configObj[key];
     }
+    if (updateNetworkFlag && typeof this.networkJSON !== 'undefined') {
+      // update network if network config has changed and networkJSON exists
+      this.createNetwork();
+    }
   }
 
   @Input()
@@ -267,6 +276,10 @@ export class ExplorerPageComponent implements OnInit, AfterViewInit {
     this.showDetails = false;
   }
 
+  // public async updateNetwork() {
+
+  // }
+
   public async createNetwork() {
     this.analysis.resetSelection();
     this.selectedWrapper = null;
-- 
GitLab