diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-10-14 11:59:53 +0200 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-10-14 11:59:53 +0200 |
commit | 56301cec9e9ce82c61d7362555b70986b41a2c18 (patch) | |
tree | 8e115860de34a4aa0718a847997dd5b6751bdb0e | |
parent | 03e1425aa87357543b11391ed19eb5b6c0763b30 (diff) | |
download | tuskar-ui-56301cec9e9ce82c61d7362555b70986b41a2c18.tar.gz |
Fix the plan validation
* Enable the "deploy" button properly when the plan is valid
* Display a message while waiting for validation
* Remove some duplicate templates that somehow crept back
Change-Id: I05eacf47f33329c9d8ea71412838a839efe18605
5 files changed, 11 insertions, 169 deletions
diff --git a/tuskar_ui/infrastructure/overview/templates/overview/deployment_progress.html b/tuskar_ui/infrastructure/overview/templates/overview/deployment_progress.html deleted file mode 100644 index 04ed27be..00000000 --- a/tuskar_ui/infrastructure/overview/templates/overview/deployment_progress.html +++ /dev/null @@ -1,83 +0,0 @@ -{% extends "infrastructure/overview/deployment_base.html" %} - -{% load i18n %} -{% load url from future%} -{% load horizon %} - -{% block deployment-icon %} - <i class="fa fa-spinner fa-spin text-info"></i> -{% endblock %} - -{% block deployment-title %} - {% if stack.is_deleting %} - {% trans "Undeploying..." %} - {% elif stack.is_deploying %} - {% trans "Deploying..." %} - {% endif %} -{% endblock %} - -{% block deployment-info %} -{% if progress %} - <div class="progress"> - <div - class="progress-bar progress-bar-striped active" - role="progressbar" - aria-valuenow="{{ progress }}" - aria-valuemin="0" - aria-valuemax="100" - style="width: {{ progress }}%" - ><span class="sr-only">{{ progress }}% {% trans "Complete" %}</span></div> - </div> -{% endif %} -<div class="deploy-last-events'> -{% if last_failed_events %} - <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> -</div> -{% endblock %} - -{% block deployment-buttons %} - {% if stack.is_deploying %} - <a - href="{% url 'horizon:infrastructure:overview:undeploy_confirmation' %}" - class="btn btn-danger ajax-modal"> - <i class="fa fa-close"></i> - {% trans "Stop" %} - </a> - {% endif %} -{% endblock %} - -{% block templates %} -<script type="text/html" id="events-template">{% spaceless %}{% jstemplate %} -<strong>{% trans "Last failed events:" %}</strong> -[[#last_failed_events]] -<div> - <dl> - <dt>{% trans "Timestamp" %}</dt> - <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]] -{% endjstemplate %}{% endspaceless %}</script> -{% endblock %} diff --git a/tuskar_ui/infrastructure/overview/templates/overview/index.html b/tuskar_ui/infrastructure/overview/templates/overview/index.html deleted file mode 100644 index ff13c043..00000000 --- a/tuskar_ui/infrastructure/overview/templates/overview/index.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends 'infrastructure/base.html' %} -{% load i18n %} -{% load url from future %} - -{% block title %}{% trans 'My OpenStack Deployment' %}{% endblock %} - -{% block page_header %} - {% include 'horizon/common/_domain_page_header.html' with title=_('My OpenStack Deployment') %} -{% endblock page_header %} - -{% block main %} -<div class="row"> - <div class="col-xs-3"> - {% if stack %} - {% if stack.is_deleting or stack.is_deploying %} - {% include "infrastructure/overview/deployment_progress.html" %} - {% elif stack.is_delete_failed or stack.is_failed %} - {% include "infrastructure/overview/deployment_failed.html" %} - {% elif stack.is_deployed and not stack.is_initialized %} - {% include "infrastructure/overview/deployment_initialize.html" %} - {% else %} - {% include "infrastructure/overview/deployment_live.html" %} - {% endif %} - {% else %} - {% include "infrastructure/overview/deployment_plan.html" %} - {% endif %} - </div> - <div class="col-xs-6"> - {% if stack %} - {% include "infrastructure/overview/role_nodes_status.html" %} - {% else %} - {% include "infrastructure/overview/role_nodes_edit.html" %} - {% endif %} - </div> -</div> -{% endblock %} diff --git a/tuskar_ui/infrastructure/overview/templates/overview/role_nodes_status.html b/tuskar_ui/infrastructure/overview/templates/overview/role_nodes_status.html deleted file mode 100644 index 701229da..00000000 --- a/tuskar_ui/infrastructure/overview/templates/overview/role_nodes_status.html +++ /dev/null @@ -1,41 +0,0 @@ -{% load i18n %} -{% load url from future %} -{% load horizon %} - -<h4>{% trans "Deployment Roles" %}</h4> -<div class="deploy-role-status"> -{% for role in roles %} - <div class="alert well-sm clearfix alert-{{ role.status }}"> - <div class="col-sm-2"> - {% if role.finished %} - <strong>{{ role.deployed_node_count }}</strong><small class="text-muted">/{{ role.planned_node_count }}</small> - {% else %} - <strong>{{ role.planned_node_count }}</strong> - {% endif %} - </div> - <div class="col-sm-10"> - <a - href="{% url "horizon:infrastructure:roles:detail" role_id=role.id %}" - >{{ role.name }}</a> - </div> - </div> -{% endfor %} -</div> - -<script type="text/html" id="roles-template">{% spaceless %}{% jstemplate %} -[[#roles]] - <div class="alert well-sm clearfix alert-[[status]]"> - <div class="col-sm-2"> - [[#finished]] - <strong>[[ planned_node_count ]]</strong> - [[/finished]] - [[^finished]] - <strong>[[ deployed_node_count ]] - </strong><small class="text-muted">/[[ planned_node_count ]]</small> - [[/finished]] - </div> - <div class="col-sm-10"><strong>[[ name ]]</strong></div> - </div> -[[/roles]] -{% endjstemplate %}{% endspaceless %}</script> - diff --git a/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.edit_plan.js b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.edit_plan.js index 89f9f568..4bc36ac9 100644 --- a/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.edit_plan.js +++ b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.edit_plan.js @@ -40,25 +40,24 @@ tuskar.edit_plan = (function () { }; module.update_messages = function (data) { - $('div.deployment-box ul').replaceWith( - module.message_template.render(data)); if (data === null) { $('div.deployment-buttons a.btn-primary').addClass('disabled'); $('div.deployment-icon i').replaceWith( '<i class="fa fa-spinner fa-spin text-info"></i>'); + data = {validating:true}; } else if (data.plan_invalid) { $('div.deployment-buttons a.btn-primary').addClass('disabled'); $('div.deployment-icon i').replaceWith( '<i class="fa fa-exclamation-circle text-danger"></i>'); - $('div.deployment-box h4').replaceWith( - module.title_template.render(data)); } else { - $('div.deploymnet-buttons a.btn-primary').removeClass('disabled'); + $('div.deployment-buttons a.btn-primary').removeClass('disabled'); $('div.deployment-icon i').replaceWith( '<i class="fa fa-check-circle text-success"></i>'); - $('div.deployment-box h4').replaceWith( - module.title_template.render(data)); } + $('div.deployment-box h4').replaceWith( + module.title_template.render(data)); + $('div.deployment-box ul').replaceWith( + module.message_template.render(data)); }; horizon.addInitFunction(module.init); diff --git a/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_plan.html b/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_plan.html index 9598725e..66d91ace 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_plan.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/overview/deployment_plan.html @@ -46,8 +46,11 @@ class="btn btn-primary ajax-modal btn-default {% if plan_invalid %}disabled{% en {% block templates %} <script type="text/html" id="title-template">{% spaceless %}{% jstemplate %} <h4> -[[#plan_invalid]]{% trans "Design your deployment" %}[[/plan_invalid]] -[[^plan_invalid]]{% trans "Ready to get deployed" %}[[/plan_invalid]] +[[#validating]]{% trans "Validating the plan..." %}[[/validating]] +[[^validating]] + [[#plan_invalid]]{% trans "Design your deployment" %}[[/plan_invalid]] + [[^plan_invalid]]{% trans "Ready to get deployed" %}[[/plan_invalid]] +[[/validating]] </h4> {% endjstemplate %}{% endspaceless %}</script> <script type="text/html" id="message-template">{% spaceless %}{% jstemplate %} |