From 28f3d0ea939614f0b68e2858681b1aa7811e6877 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 1 Apr 2019 11:04:36 +0200
Subject: [PATCH] after active tab is unloaded the first tab is selected as
 active

---
 CHANGELOG                                         | 2 ++
 frontend-js/src/main/js/gui/leftPanel/GuiUtils.js | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index e9e2cd3b65..8cafe7f238 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 minerva (12.2.1) stable; urgency=medium
   * Bug fix: export of reaction colorsi in SBML is properly encoded (COPASI can
     read colors properly) (#744) 
+  * Bug fix: removing active plugin didn't switch plugin tab to the next loaded 
+    plugin (#757)
 
  -- Piotr Gawron <piotr.gawron@uni.lu>  Mon, 1 Apr 2019 17:00:00 +0200
 
diff --git a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
index 796ec101f1..704973c859 100644
--- a/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
+++ b/frontend-js/src/main/js/gui/leftPanel/GuiUtils.js
@@ -1175,6 +1175,13 @@ GuiUtils.prototype.removeTab = function (abstractGuiElement, panel) {
   } else {
     logger.warn("Cannot find tab for panel: " + panel);
   }
+  var isActive = $(".nav-tabs > li.active", $(abstractGuiElement.getElement())).length > 0;
+  if (!isActive) {
+    var links = $(".nav-tabs > li", $(abstractGuiElement.getElement()));
+    if (links.length > 0) {
+      $("a", $(links[0])).click();
+    }
+  }
 };
 
 /**
-- 
GitLab