From a0391c9a4f71dd45646161d528f1914029dcad5c Mon Sep 17 00:00:00 2001 From: Marcus Christie Date: Thu, 1 Dec 2016 20:06:47 -0500 Subject: [PATCH] AIRAVATA-2032 Fix closing exp summary tabs --- app/views/admin/manage-experiments.blade.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/admin/manage-experiments.blade.php b/app/views/admin/manage-experiments.blade.php index c2fad490a..f73f8dce6 100644 --- a/app/views/admin/manage-experiments.blade.php +++ b/app/views/admin/manage-experiments.blade.php @@ -364,10 +364,10 @@ class="glyphicon glyphicon-search"> Get Statistics }); $(".get-experiment").click(function () { - $(".loading-img").removeClass("hide"); var expId = $(".experimentId").val(); if( $("#" + expId).length <= 0){ + $(".loading-img").removeClass("hide"); $.ajax({ url: 'experiment/summary?expId=' + expId, type: 'get', @@ -385,13 +385,19 @@ class="glyphicon glyphicon-search"> Get Statistics }).complete(function () { $(".loading-img").addClass("hide"); }); + } else { + // Experiment data already loaded so just show it + $('#myTabs a[href="#' + expId + '"]').tab('show'); } }); $("body").on("click", ".close-tab", function(){ - var idToRemove = $(this).parent().parent().attr("href"); - $(this).parent().parent().remove(); - $("#"+idToRemove).remove(); + var tabContentSelector = $(this).closest("a").attr("href"); + // Remove tab and tab's content + $(this).closest("li").remove(); + $(tabContentSelector).remove(); + // Show the overview tab + $('#myTabs a[href="#overview"]').tab('show'); }); //Experiment stages are under development.