diff --git a/muranodashboard/environments/views.py b/muranodashboard/environments/views.py index 2b13b8ad4..82add9073 100644 --- a/muranodashboard/environments/views.py +++ b/muranodashboard/environments/views.py @@ -20,6 +20,7 @@ from django.core.urlresolvers import reverse_lazy from django import http from django.utils.translation import ugettext_lazy as _ from django.views import generic +from horizon import conf from horizon import exceptions from horizon.forms import views from horizon import tables @@ -88,6 +89,7 @@ class EnvironmentDetails(tabs.TabbedTableView): context["actions"] = table.render_row_actions(env) # recover the origin row_action for EnvironmentsTable Meta table._meta.row_actions = ori_row_actions + context['poll_interval'] = conf.HORIZON_CONFIG['ajax_poll_interval'] return context def get_tabs(self, request, *args, **kwargs): diff --git a/muranodashboard/static/muranodashboard/js/murano.tables.js b/muranodashboard/static/muranodashboard/js/murano.tables.js index eab670b42..1a116ef1c 100644 --- a/muranodashboard/static/muranodashboard/js/murano.tables.js +++ b/muranodashboard/static/muranodashboard/js/murano.tables.js @@ -32,6 +32,23 @@ $(function() { }); }); +// Reload page using horizon ajax_poll_interval +// until deployment of empty environment is finished +$(function() { + "use strict"; + if ($("div#environment_details__services").find("div.drop_component").length === 0 && + $("table#services.datatable").find("tr.empty").length && + $("button#services__action_deploy_env").length === 0) { + var $pollInterval = $("input#pollInterval")[0].value; + setTimeout(function () { + if (reloadCalled === false) { + reloadCalled = true; + location.reload(true); + } + }, $pollInterval); + } +}); + var reloadEnvironmentCalled = false; $(function() { diff --git a/muranodashboard/templates/services/index.html b/muranodashboard/templates/services/index.html index 722fff934..37029d11c 100644 --- a/muranodashboard/templates/services/index.html +++ b/muranodashboard/templates/services/index.html @@ -14,6 +14,7 @@ {% endblock page_header %} {% block main %} +