Merge "Refactor last events"
This commit is contained in:
commit
f7a495786f
@ -110,20 +110,16 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
|
|||||||
success_url = reverse_lazy(INDEX_URL)
|
success_url = reverse_lazy(INDEX_URL)
|
||||||
|
|
||||||
def get_progress_update(self, request, data):
|
def get_progress_update(self, request, data):
|
||||||
last_event = data.get('last_event')
|
|
||||||
return {
|
return {
|
||||||
'progress': data.get('progress'),
|
'progress': data.get('progress'),
|
||||||
'last_event': {
|
'show_last_events': data.get('show_last_events'),
|
||||||
'event_time': last_event.event_time,
|
'last_events_title': unicode(data.get('last_events_title')),
|
||||||
'resource_name': last_event.resource_name,
|
'last_events': [{
|
||||||
'resource_status': last_event.resource_status,
|
|
||||||
} if last_event else None,
|
|
||||||
'last_failed_events': [{
|
|
||||||
'event_time': event.event_time,
|
'event_time': event.event_time,
|
||||||
'resource_name': event.resource_name,
|
'resource_name': event.resource_name,
|
||||||
'resource_status': event.resource_status,
|
'resource_status': event.resource_status,
|
||||||
'resource_status_reason': event.resource_status_reason,
|
'resource_status_reason': event.resource_status_reason,
|
||||||
} for event in data.get('last_failed_events', [])],
|
} for event in data.get('last_events', [])],
|
||||||
'roles': [{
|
'roles': [{
|
||||||
'status': role.get('status', 'warning'),
|
'status': role.get('status', 'warning'),
|
||||||
'finished': role.get('finished', False),
|
'finished': role.get('finished', False),
|
||||||
@ -171,12 +167,19 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
|
|||||||
context['roles'] = roles
|
context['roles'] = roles
|
||||||
|
|
||||||
if stack:
|
if stack:
|
||||||
context['last_failed_events'] = [
|
context['show_last_events'] = True
|
||||||
e for e in stack.events
|
failed_events = [e for e in stack.events
|
||||||
if 'FAILED' in e.resource_status][-3:]
|
if 'FAILED' in e.resource_status and
|
||||||
|
'aborted' not in e.resource_status_reason][-3:]
|
||||||
|
|
||||||
|
if failed_events:
|
||||||
|
context['last_events_title'] = _('Last failed events')
|
||||||
|
context['last_events'] = failed_events
|
||||||
|
else:
|
||||||
|
context['last_events_title'] = _('Last event')
|
||||||
|
context['last_events'] = [stack.events[0]]
|
||||||
|
|
||||||
if stack.is_deleting or stack.is_delete_failed:
|
if stack.is_deleting or stack.is_delete_failed:
|
||||||
context['last_event'] = stack.events[0]
|
|
||||||
# TODO(lsmola) since at this point we don't have total number
|
# TODO(lsmola) since at this point we don't have total number
|
||||||
# of nodes we will hack this around, till API can show this
|
# of nodes we will hack this around, till API can show this
|
||||||
# information. So it will actually show progress like the total
|
# information. So it will actually show progress like the total
|
||||||
@ -200,7 +203,6 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
|
|||||||
context['progress'] = min(95, max(
|
context['progress'] = min(95, max(
|
||||||
5, 100 * float(resources_count) / total_num_nodes_count))
|
5, 100 * float(resources_count) / total_num_nodes_count))
|
||||||
elif stack.is_deploying:
|
elif stack.is_deploying:
|
||||||
context['last_event'] = stack.events[0]
|
|
||||||
total = sum(d['total_node_count'] for d in roles)
|
total = sum(d['total_node_count'] for d in roles)
|
||||||
context['progress'] = min(95, max(
|
context['progress'] = min(95, max(
|
||||||
5, 100 * sum(float(d.get('deployed_node_count', 0))
|
5, 100 * sum(float(d.get('deployed_node_count', 0))
|
||||||
@ -208,6 +210,8 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
|
|||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
# stack is active
|
# stack is active
|
||||||
|
if not stack.is_failed:
|
||||||
|
context['show_last_events'] = False
|
||||||
context['progress'] = 100
|
context['progress'] = 100
|
||||||
controller_role = plan.get_role_by_name("controller")
|
controller_role = plan.get_role_by_name("controller")
|
||||||
context['admin_password'] = plan.parameter_value(
|
context['admin_password'] = plan.parameter_value(
|
||||||
|
@ -30,7 +30,7 @@ tuskar.deployment_progress = (function () {
|
|||||||
}
|
}
|
||||||
var $bar = $('div.deployment-box div.progress div.progress-bar');
|
var $bar = $('div.deployment-box div.progress div.progress-bar');
|
||||||
$bar.css('width', '' + data.progress + '%');
|
$bar.css('width', '' + data.progress + '%');
|
||||||
if (data.last_failed_events.length > 0 || data.last_event) {
|
if (data.show_last_events) {
|
||||||
$('div.deploy-last-events').html(module.events_template.render(data));
|
$('div.deploy-last-events').html(module.events_template.render(data));
|
||||||
} else {
|
} else {
|
||||||
$('div.deploy-last-events').html('');
|
$('div.deploy-last-events').html('');
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
{% if show_last_events %}
|
||||||
|
<strong>{{ last_events_title }}</strong>
|
||||||
|
<div>
|
||||||
|
<dl>
|
||||||
|
{% for event in last_events %}
|
||||||
|
<dd>
|
||||||
|
<time datetime="{{ event.event_time }}">{{ event.event_time }}</time>
|
||||||
|
<br />
|
||||||
|
{{ event.resource_name }} |
|
||||||
|
{{ event.resource_status }} |
|
||||||
|
{{ event.resource_status_reason }}
|
||||||
|
</dd>
|
||||||
|
<br />
|
||||||
|
{% endfor %}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
|
||||||
|
{% endif %}
|
@ -16,24 +16,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block deployment-info %}
|
{% block deployment-info %}
|
||||||
{% if last_failed_events %}
|
{% include "infrastructure/overview/_last_events.html" %}
|
||||||
<strong>{% trans "Last failed events:" %}</strong>
|
|
||||||
{% for event in last_failed_events %}
|
|
||||||
<div>
|
|
||||||
<dl>
|
|
||||||
<dt>{% trans "Timestamp" %}</dt>
|
|
||||||
<dd><time datetime="{{ event.event_time }}">{{ event.event_time }}</time></dd>
|
|
||||||
<dt>{% trans "Resource Name" %}</dt>
|
|
||||||
<dd>{{ event.resource_name }}</dd>
|
|
||||||
<dt>{% trans "Status" %}</dt>
|
|
||||||
<dd>{{ event.resource_status }}</dd>
|
|
||||||
<dt>{% trans "Reason" %}</dt>
|
|
||||||
<dd>{{ event.resource_status_reason }}</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block deployment-buttons %}
|
{% block deployment-buttons %}
|
||||||
|
@ -28,36 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="deploy-last-events">
|
<div class="deploy-last-events">
|
||||||
{% if last_failed_events %}
|
{% include "infrastructure/overview/_last_events.html" %}
|
||||||
<strong>{% trans "Last failed events:" %}</strong>
|
|
||||||
{% for event in last_failed_events %}
|
|
||||||
<div>
|
|
||||||
<dl>
|
|
||||||
<dt>{% trans "Timestamp" %}</dt>
|
|
||||||
<dd><time datetime="{{ event.event_time }}">{{ event.event_time }}</time></dd>
|
|
||||||
<dt>{% trans "Resource Name" %}</dt>
|
|
||||||
<dd>{{ event.resource_name }}</dd>
|
|
||||||
<dt>{% trans "Status" %}</dt>
|
|
||||||
<dd>{{ event.resource_status }}</dd>
|
|
||||||
<dt>{% trans "Reason" %}</dt>
|
|
||||||
<dd>{{ event.resource_status_reason }}</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% elif last_event %}
|
|
||||||
<div>
|
|
||||||
<dl>
|
|
||||||
<dt>{% trans "Last Update" %}</dt>
|
|
||||||
<dd>
|
|
||||||
<time datetime="{{ last_event.event_time }}">{{ last_event.event_time }}</time>
|
|
||||||
<br />
|
|
||||||
{{ last_event.resource_name }}
|
|
||||||
{{ last_event.resource_status }}
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -74,34 +45,23 @@
|
|||||||
|
|
||||||
{% block templates %}
|
{% block templates %}
|
||||||
<script type="text/html" id="events-template">{% spaceless %}{% jstemplate %}
|
<script type="text/html" id="events-template">{% spaceless %}{% jstemplate %}
|
||||||
[[#last_failed_events]]
|
[[#show_last_events]]
|
||||||
<strong>{% trans "Last failed events:" %}</strong>
|
<strong>[[ last_events_title ]]</strong>
|
||||||
<div>
|
<div>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{% trans "Timestamp" %}</dt>
|
[[#last_events]]
|
||||||
<dd><time datetime="[[ event_time ]]">[[ event_time ]]</time></dd>
|
|
||||||
<dt>{% trans "Resource Name" %}</dt>
|
|
||||||
<dd>[[ resource_name ]]</dd>
|
|
||||||
<dt>{% trans "Status" %}</dt>
|
|
||||||
<dd>[[ resource_status ]]</dd>
|
|
||||||
<dt>{% trans "Reason" %}</dt>
|
|
||||||
<dd>[[ resource_status_reason ]]</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
[[/last_failed_events]]
|
|
||||||
[[#last_event]]
|
|
||||||
<div>
|
|
||||||
<dl>
|
|
||||||
<dt>{% trans "Last Update" %}</dt>
|
|
||||||
<dd>
|
<dd>
|
||||||
<time datetime="[[ event_time ]]">[[ event_time ]]</time>
|
<time datetime="[[ event_time ]]">[[ event_time ]]</time>
|
||||||
<br />
|
<br />
|
||||||
[[ resource_name ]]
|
[[ resource_name ]] |
|
||||||
[[ resource_status ]]
|
[[ resource_status ]] |
|
||||||
|
[[ resource_status_reason ]]
|
||||||
</dd>
|
</dd>
|
||||||
|
<br />
|
||||||
|
[[/last_events]]
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
[[/last_event]]
|
[[/show_last_events]]
|
||||||
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
|
<p><a href="{% url 'horizon:infrastructure:history:index' %}">See full log</a></p>
|
||||||
{% endjstemplate %}{% endspaceless %}</script>
|
{% endjstemplate %}{% endspaceless %}</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user