Reload env components page after deployment of empty environment
This patch adds javascript that reloads the page with environment components until deployment of empty environment is finished. It allows to add new components to the page without manual page refresh. Reload is made with timeout set in horizon config 'ajax_poll_interval'. Currently there is no other way to detect the moment of empty env deployment finish. Change-Id: I61c43a1891a43bcb53d2894e11e649607c36b2e0 Closes-bug: #1573540
This commit is contained in:
parent
fa74dfd255
commit
c8832a5492
@ -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):
|
||||
|
@ -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() {
|
||||
|
@ -14,6 +14,7 @@
|
||||
{% endblock page_header %}
|
||||
{% block main %}
|
||||
<input type="hidden" id="environmentId" value="{{ environment_id }}">
|
||||
<input type="hidden" id="pollInterval" value="{{ poll_interval }}">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
{{ tab_group.render }}
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
fixes:
|
||||
- Environment components page reloads after deployment of
|
||||
empty environment. It allows to add new components to
|
||||
the empty environment without manual page refresh.
|
Loading…
Reference in New Issue
Block a user