Add a scale-out dialog
Support for updating the deployed stack. Change-Id: Iefbadba7f5f4c55cb7d1f6fa7b0087b48e7161d5
This commit is contained in:
parent
f7a495786f
commit
b553d4bfb1
@ -98,7 +98,7 @@ class Stack(base.APIResourceWrapper):
|
||||
'environment': environment,
|
||||
'files': provider_resource_templates,
|
||||
}
|
||||
password = getattr(settings, 'UNDERCLOUD_ADMIN_PASSWORD', None),
|
||||
password = getattr(settings, 'UNDERCLOUD_ADMIN_PASSWORD', None)
|
||||
|
||||
# TODO(lsmola) Bug #1394505. Until then we are calling the client
|
||||
# directly. When it's fixed, we should use heat_update from
|
||||
|
@ -161,6 +161,39 @@ class EditPlan(horizon.forms.SelfHandlingForm):
|
||||
return True
|
||||
|
||||
|
||||
class ScaleOut(EditPlan):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ScaleOut, self).__init__(*args, **kwargs)
|
||||
for name, field in self.fields.items():
|
||||
if name.endswith('-count'):
|
||||
field.widget.attrs['min'] = field.initial
|
||||
|
||||
def handle(self, request, data):
|
||||
if not super(ScaleOut, self).handle(request, data):
|
||||
return False
|
||||
plan = self.plan
|
||||
try:
|
||||
stack = api.heat.Stack.get_by_plan(self.request, plan)
|
||||
stack.update(request, plan.name, plan.master_template,
|
||||
plan.environment, plan.provider_resource_templates)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
if hasattr(e, 'error'):
|
||||
horizon.exceptions.handle(
|
||||
request,
|
||||
_(
|
||||
"Unable to deploy overcloud. Reason: {0}"
|
||||
).format(e.error['error']['message']),
|
||||
)
|
||||
return False
|
||||
else:
|
||||
raise
|
||||
else:
|
||||
msg = _('Deployment in progress.')
|
||||
horizon.messages.success(request, msg)
|
||||
return True
|
||||
|
||||
|
||||
class DeployOvercloud(horizon.forms.SelfHandlingForm):
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
|
@ -29,4 +29,7 @@ urlpatterns = urls.patterns(
|
||||
urls.url(r'^post-deploy-init$',
|
||||
views.PostDeployInitView.as_view(),
|
||||
name='post_deploy_init'),
|
||||
urls.url(r'^scale-out$',
|
||||
views.ScaleOutView.as_view(),
|
||||
name='scale_out'),
|
||||
)
|
||||
|
@ -313,3 +313,27 @@ class PostDeployInitView(horizon.forms.ModalFormView, StackMixin):
|
||||
initial = super(PostDeployInitView, self).get_initial(**kwargs)
|
||||
initial['stack_id'] = self.get_stack().id
|
||||
return initial
|
||||
|
||||
|
||||
class ScaleOutView(horizon.forms.ModalFormView, StackMixin):
|
||||
form_class = forms.ScaleOut
|
||||
template_name = "infrastructure/overview/scale_out.html"
|
||||
submit_label = _("Deploy Changes")
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse(INDEX_URL)
|
||||
|
||||
def get_form(self, form_class):
|
||||
return form_class(self.request, **self.get_form_kwargs())
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super(ScaleOutView, self).get_context_data(*args, **kwargs)
|
||||
plan = api.tuskar.Plan.get_the_plan(self.request)
|
||||
form = context.get('form')
|
||||
roles = [_get_role_data(plan, None, form, role)
|
||||
for role in plan.role_list]
|
||||
context.update({
|
||||
'roles': roles,
|
||||
'plan': plan,
|
||||
})
|
||||
return context
|
||||
|
@ -15,6 +15,7 @@ div.number_picker {
|
||||
margin: 8px auto;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
outline: 0;
|
||||
}
|
||||
a {
|
||||
display: block;
|
||||
|
@ -0,0 +1,41 @@
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
{% load form_helpers %}
|
||||
|
||||
{% block form_id %}scale_out_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:infrastructure:overview:scale_out' %}{% endblock %}
|
||||
|
||||
{% block modal_id %}scale_out_modal{% endblock %}
|
||||
{% block modal-header %}{% trans "Scale-out Deployment" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="scale-out-form">
|
||||
{% include 'horizon/common/_form_errors.html' with form=form %}
|
||||
{% for role in roles %}
|
||||
<div class="form-group well well-sm clearfix{% if role.field.errors %} error{% endif %} {{ role.field.css_classes }}">
|
||||
<div class="col-xs-8 deploy-role-name">
|
||||
<span class="deployment-roles-label">{{ role.name|capfirst }}</span>
|
||||
{% for error in role.field.errors %}
|
||||
<span class="help-block"><span class="text-danger">
|
||||
{{ error }}
|
||||
</span></span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-xs-2 deploy-role-count">
|
||||
{{ role.planned_node_count }} →
|
||||
</div>
|
||||
<div class="col-xs-2 deploy-role-count">
|
||||
{{ role.field|add_bootstrap_class }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(window.$ || window.addHorizonLoadEvent)(function () {
|
||||
tuskar.number_picker.init();
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
@ -1,7 +1,7 @@
|
||||
{% extends "infrastructure/overview/deployment_base.html" %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load url from future%}
|
||||
{% load url from future %}
|
||||
|
||||
{% block deployment-heading %}
|
||||
<div class="deployment-icon">
|
||||
@ -18,27 +18,41 @@
|
||||
<div>
|
||||
{% for dashboard_url in dashboard_urls %}
|
||||
<div class="row">
|
||||
<div class="col-xs-3">{% trans "Horizon URL:" %}</div>
|
||||
<div class="col-xs-9"><a href="{{ dashboard_url }}">{{ dashboard_url }}</a></div>
|
||||
<div class="col-xs-4">{% trans "Horizon URL:" %}</div>
|
||||
<div class="col-xs-8"><a href="{{ dashboard_url }}">{{ dashboard_url }}</a></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="row">
|
||||
<div class="col-xs-3">{% trans "User name:" %}</div>
|
||||
<div class="col-xs-9">admin</div>
|
||||
<div class="col-xs-4">{% trans "User name:" %}</div>
|
||||
<div class="col-xs-8">admin</div>
|
||||
</div>
|
||||
<form>
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
{% trans "Password" %}
|
||||
</div>
|
||||
<div class="col-xs-9">
|
||||
<input class="form-control" id="id_password" type="password" value="{{ admin_password }}" disabled="true" readonly="true"/>
|
||||
<div class="col-xs-4">{% trans "Password" %}</div>
|
||||
<div class="col-xs-8">
|
||||
<span class="btn btn-xs btn-default password-button"
|
||||
data-content="{{ admin_password }}"
|
||||
><i class="fa fa-eye"></i> {% trans "Reveal" %}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(window.$ || window.addHorizonLoadEvent)(function () {
|
||||
$('span.password-button').popover({
|
||||
trigger: 'click',
|
||||
placement: 'top'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block deployment-buttons %}
|
||||
{{ block.super }}
|
||||
<a
|
||||
href="{% url 'horizon:infrastructure:overview:scale_out' %}"
|
||||
class="btn ajax-modal btn-default"
|
||||
>
|
||||
<i class="fa fa-lg fa-arrows-alt"></i> {% trans "Scale-out" %}
|
||||
</a>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,11 @@
|
||||
{% extends 'infrastructure/base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Scale-out Deployment" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Scale-out Deployment") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block infrastructure_main %}
|
||||
{% include "infrastructure/overview/_scale_out.html" %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user