From c0809d5c2a461fe8147ad24c25846a90bd70e4e5 Mon Sep 17 00:00:00 2001 From: Omar Shykhkerimov Date: Mon, 29 Feb 2016 19:11:49 +0200 Subject: [PATCH] Reload environments page after all the environments have been deleted Closes-Bug: #1486499 Change-Id: I5be35fd9d2ef7101eed89a1d3a649f6c47d5cfd2 --- ...{horizon.tables+reload.js => murano.tables.js} | 15 +++++++++++++++ muranodashboard/templates/murano_base.html | 3 +-- 2 files changed, 16 insertions(+), 2 deletions(-) rename muranodashboard/static/muranodashboard/js/{horizon.tables+reload.js => murano.tables.js} (77%) diff --git a/muranodashboard/static/muranodashboard/js/horizon.tables+reload.js b/muranodashboard/static/muranodashboard/js/murano.tables.js similarity index 77% rename from muranodashboard/static/muranodashboard/js/horizon.tables+reload.js rename to muranodashboard/static/muranodashboard/js/murano.tables.js index fed2c9950..eab670b42 100644 --- a/muranodashboard/static/muranodashboard/js/horizon.tables+reload.js +++ b/muranodashboard/static/muranodashboard/js/murano.tables.js @@ -31,3 +31,18 @@ $(function() { } }); }); + +var reloadEnvironmentCalled = false; + +$(function() { + "use strict"; + $("table#environments").on("update", function () { + var $environmentsRows = $(this).find('tbody tr:visible').not('.empty'); + if ($environmentsRows.length === 0) { + if (reloadEnvironmentCalled === false) { + reloadEnvironmentCalled = true; + location.reload(true); + } + } + }); +}); diff --git a/muranodashboard/templates/murano_base.html b/muranodashboard/templates/murano_base.html index 7a66a063c..d8f711f3d 100644 --- a/muranodashboard/templates/murano_base.html +++ b/muranodashboard/templates/murano_base.html @@ -8,10 +8,9 @@ - - +