Merge "header is changed to updating"

This commit is contained in:
Jenkins 2015-01-21 16:02:02 +00:00 committed by Gerrit Code Review
commit 627aa918da
5 changed files with 26 additions and 6 deletions

View File

@ -284,13 +284,21 @@ class Stack(base.APIResourceWrapper):
@cached_property
def is_deploying(self):
"""Check if this Stack is currently deploying or updating.
"""Check if this Stack is currently deploying.
:return: True if deployment is in progress, False otherwise.
:rtype: bool
"""
return self.stack_status in ('CREATE_IN_PROGRESS',
'UPDATE_IN_PROGRESS')
return self.stack_status in ('CREATE_IN_PROGRESS',)
@cached_property
def is_updating(self):
"""Check if this Stack is currently updating.
:return: True if updating is in progress, False otherwise.
:rtype: bool
"""
return self.stack_status in ('UPDATE_IN_PROGRESS',)
@cached_property
def is_failed(self):

View File

@ -203,7 +203,7 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
context['progress'] = min(95, max(
5, 100 * float(resources_count) / total_num_nodes_count))
elif stack.is_deploying:
elif stack.is_deploying or stack.is_updating:
total = sum(d['total_node_count'] for d in roles)
context['progress'] = min(95, max(
5, 100 * sum(float(d.get('deployed_node_count', 0))

View File

@ -11,6 +11,8 @@
{% trans "Undeploying..." %}
{% elif stack.is_deploying %}
{% trans "Deploying..." %}
{% elif stack.is_updating %}
{% trans "Updating..." %}
{% endif %}
{% endblock %}
@ -33,7 +35,7 @@
{% endblock %}
{% block deployment-buttons %}
{% if stack.is_deploying %}
{% if stack.is_deploying or stack.is_updating %}
<a
href="{% url 'horizon:infrastructure:overview:undeploy_confirmation' %}"
class="btn btn-danger ajax-modal">

View File

@ -12,7 +12,7 @@
<div class="row">
<div class="col-xs-4">
{% if stack %}
{% if stack.is_deleting or stack.is_deploying %}
{% if stack.is_deleting or stack.is_deploying or stack.is_updating %}
{% include "infrastructure/overview/deployment_progress.html" %}
{% elif stack.is_delete_failed or stack.is_failed %}
{% include "infrastructure/overview/deployment_failed.html" %}

View File

@ -68,6 +68,16 @@ class HeatAPITests(test.APITestCase):
ret_val = stack.is_deployed
self.assertFalse(ret_val)
def test_stack_is_updating(self):
stack = api.heat.Stack(self.heatclient_stacks.first())
ret_val = stack.is_updating
self.assertFalse(ret_val)
def test_stack_is_deploying(self):
stack = api.heat.Stack(self.heatclient_stacks.first())
ret_val = stack.is_deploying
self.assertFalse(ret_val)
@unittest.skip("Add appropriate test data to deal with nested stacks.")
def test_stack_resources(self):
stack = api.heat.Stack(self.heatclient_stacks.first(),