Allow 'Manage Host' to show membership action

Now on the 'Manage Host' page shows also the membership
option to be opened on a new tab.

Change-Id: I73c431232650c00cb5dcbac5a96382a4247690cb
Closes-Bug: #1288280
This commit is contained in:
facundo Farias 2014-03-06 16:00:41 -03:00
parent 6a818a1c25
commit 46a49102ab
3 changed files with 8 additions and 30 deletions

View File

@ -1,29 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% load url from future %}
{% block form_id %}{% endblock %}
{% block form_action %}{% url 'horizon:admin:aggregates:manage_hosts' id%}{% endblock %}
{% block modal_id %}add_aggregate_modal{% endblock %}
{% block modal-header %}{% trans "Manage Hosts" %}{% endblock %}
{% block modal-body %}
<div class="left">
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
</div>
<div class="right">
<h3>{% trans "Description" %}:</h3>
<p>{% blocktrans %}
Here you can add/remove hosts to the selected aggregate host.
Note that while a host can be a member of multiple aggregates, it can belong to one availability zone at most.
{% endblocktrans %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Add Host" %}" />
<a href="{% url 'horizon:admin:aggregates:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -7,5 +7,5 @@
{% endblock page_header %}
{% block main %}
{% include 'admin/aggregates/_manage_hosts.html' %}
{% include 'horizon/common/_workflow.html' %}
{% endblock %}

View File

@ -219,8 +219,15 @@ class AggregatesViewTests(test.BaseAdminViewTests):
class ManageHostsTests(test.BaseAdminViewTests):
@test.create_stubs({api.nova: ('aggregate_get', 'host_list')})
def test_manage_hosts(self):
aggregate = self.aggregates.first()
api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \
.AndReturn(aggregate)
api.nova.host_list(IsA(http.HttpRequest)) \
.AndReturn(self.hosts.list())
self.mox.ReplayAll()
res = self.client.get(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL,
args=[aggregate.id]))
self.assertEqual(res.status_code, 200)