Add Service Configuration panel and test Role parameter data
Adds the service configuration panel, with a placeholder index view so that others can grow it into something truly beauteous. Also adds sample role parameter data. Change-Id: I77ddc3688d256d68b19ba69e12867cc9861bf82c
This commit is contained in:
parent
651158dfea
commit
aa23f55ece
@ -148,7 +148,8 @@ class OvercloudPlan(base.APIDictWrapper):
|
||||
|
||||
@cached_property
|
||||
def role_list(self):
|
||||
return [OvercloudRole(role) for role in self.roles]
|
||||
return [OvercloudRole.get(self._request, role['id'])
|
||||
for role in self.roles]
|
||||
|
||||
def parameter(self, param_name):
|
||||
for parameter in self.parameters:
|
||||
@ -162,7 +163,8 @@ class OvercloudPlan(base.APIDictWrapper):
|
||||
|
||||
|
||||
class OvercloudRole(base.APIDictWrapper):
|
||||
_attrs = ('id', 'name', 'version', 'description', 'created_at')
|
||||
_attrs = ('id', 'name', 'version', 'description', 'created_at',
|
||||
'parameters')
|
||||
|
||||
@classmethod
|
||||
@handle_errors(_("Unable to retrieve overcloud roles"), [])
|
||||
|
@ -22,6 +22,7 @@ class BasePanels(horizon.PanelGroup):
|
||||
panels = (
|
||||
'overcloud',
|
||||
'plans',
|
||||
'parameters',
|
||||
'nodes',
|
||||
'flavors',
|
||||
'history',
|
||||
|
0
tuskar_ui/infrastructure/parameters/__init__.py
Normal file
0
tuskar_ui/infrastructure/parameters/__init__.py
Normal file
27
tuskar_ui/infrastructure/parameters/panel.py
Normal file
27
tuskar_ui/infrastructure/parameters/panel.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
import horizon
|
||||
|
||||
from tuskar_ui.infrastructure import dashboard
|
||||
|
||||
|
||||
class Parameters(horizon.Panel):
|
||||
name = _("Service Configuration")
|
||||
slug = "parameters"
|
||||
|
||||
|
||||
dashboard.Infrastructure.register(Parameters)
|
@ -0,0 +1,23 @@
|
||||
{% extends 'infrastructure/base.html' %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
{% block title %}{% trans 'Service Configuration' %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include 'horizon/common/_page_header.html' with title=title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
{% for role in roles %}
|
||||
{{ role.name }}
|
||||
<ul>
|
||||
{% for p in role.parameters %}
|
||||
<li>{{ p.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
31
tuskar_ui/infrastructure/parameters/tests.py
Normal file
31
tuskar_ui/infrastructure/parameters/tests.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.core import urlresolvers
|
||||
|
||||
from mock import patch, call # noqa
|
||||
|
||||
from tuskar_ui.test import helpers as test
|
||||
|
||||
|
||||
INDEX_URL = urlresolvers.reverse(
|
||||
'horizon:infrastructure:parameters:index')
|
||||
|
||||
|
||||
class ParametersTest(test.BaseAdminViewTests):
|
||||
|
||||
def test_index(self):
|
||||
res = self.client.get(INDEX_URL)
|
||||
|
||||
self.assertTemplateUsed(res, 'infrastructure/parameters/index.html')
|
23
tuskar_ui/infrastructure/parameters/urls.py
Normal file
23
tuskar_ui/infrastructure/parameters/urls.py
Normal file
@ -0,0 +1,23 @@
|
||||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf import urls
|
||||
|
||||
from tuskar_ui.infrastructure.parameters import views
|
||||
|
||||
|
||||
urlpatterns = urls.patterns(
|
||||
'',
|
||||
urls.url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
)
|
27
tuskar_ui/infrastructure/parameters/views.py
Normal file
27
tuskar_ui/infrastructure/parameters/views.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- coding: utf8 -*-
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from horizon import views as horizon_views
|
||||
|
||||
from tuskar_ui import api
|
||||
|
||||
|
||||
class IndexView(horizon_views.APIView):
|
||||
template_name = 'infrastructure/parameters/index.html'
|
||||
|
||||
def get_data(self, request, context, *args, **kwargs):
|
||||
plan = api.tuskar.OvercloudPlan.get_the_plan(self.request)
|
||||
context['plan'] = plan
|
||||
context['roles'] = plan.role_list
|
||||
return context
|
@ -44,7 +44,6 @@ class TuskarAPITests(test.APITestCase):
|
||||
plan = api.tuskar.OvercloudPlan(self.tuskarclient_plans.first())
|
||||
|
||||
ret_val = plan.role_list
|
||||
|
||||
self.assertEqual(4, len(ret_val))
|
||||
for r in ret_val:
|
||||
self.assertIsInstance(r, api.tuskar.OvercloudRole)
|
||||
@ -54,7 +53,7 @@ class TuskarAPITests(test.APITestCase):
|
||||
|
||||
for r in ret_val:
|
||||
self.assertIsInstance(r, api.tuskar.OvercloudRole)
|
||||
self.assertEqual(5, len(ret_val))
|
||||
self.assertEqual(4, len(ret_val))
|
||||
|
||||
def test_role_get(self):
|
||||
role = self.tuskarclient_roles.first()
|
||||
|
@ -36,9 +36,9 @@ def data(TEST):
|
||||
'name': 'Object Storage',
|
||||
'version': 1,
|
||||
}, {
|
||||
'id': 'role-5',
|
||||
'id': 'role-4',
|
||||
'name': 'Block Storage',
|
||||
'version': 2,
|
||||
'version': 1,
|
||||
}],
|
||||
'parameters': [{
|
||||
'name': 'AdminPassword',
|
||||
@ -58,6 +58,21 @@ def data(TEST):
|
||||
'version': 1,
|
||||
'description': 'controller role',
|
||||
'created_at': '2014-05-27T21:11:09Z',
|
||||
'parameters': [{
|
||||
'name': 'controller_NovaInterfaces',
|
||||
'parameter_group': 'Nova',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'false',
|
||||
'default': 'eth0',
|
||||
}, {
|
||||
'name': 'controller_NeutronInterfaces',
|
||||
'parameter_group': 'Neutron',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'false',
|
||||
'default': 'eth0',
|
||||
}]
|
||||
}
|
||||
r_2 = {
|
||||
'id': 'role-2',
|
||||
@ -65,6 +80,14 @@ def data(TEST):
|
||||
'version': 1,
|
||||
'description': 'compute role',
|
||||
'created_at': '2014-05-27T21:11:09Z',
|
||||
'parameters': [{
|
||||
'name': 'compute_KeystoneHost',
|
||||
'parameter_group': 'Keystone',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'false',
|
||||
'default': '',
|
||||
}]
|
||||
}
|
||||
r_3 = {
|
||||
'id': 'role-3',
|
||||
@ -72,6 +95,14 @@ def data(TEST):
|
||||
'version': 1,
|
||||
'description': 'object storage role',
|
||||
'created_at': '2014-05-27T21:11:09Z',
|
||||
'parameters': [{
|
||||
'name': 'object_storage_SwiftHashSuffix',
|
||||
'parameter_group': 'Swift',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'true',
|
||||
'default': '',
|
||||
}]
|
||||
}
|
||||
r_4 = {
|
||||
'id': 'role-4',
|
||||
@ -79,12 +110,13 @@ def data(TEST):
|
||||
'version': 1,
|
||||
'description': 'block storage role',
|
||||
'created_at': '2014-05-27T21:11:09Z',
|
||||
'parameters': [{
|
||||
'name': 'block_storage_NeutronNetworkType',
|
||||
'parameter_group': 'Neutron',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'false',
|
||||
'default': 'gre',
|
||||
}]
|
||||
}
|
||||
r_5 = {
|
||||
'id': 'role-5',
|
||||
'name': 'Block Storage',
|
||||
'version': 2,
|
||||
'description': 'block storage role',
|
||||
'created_at': '2014-05-28T21:11:09Z',
|
||||
}
|
||||
TEST.tuskarclient_roles.add(r_1, r_2, r_3, r_4, r_5)
|
||||
TEST.tuskarclient_roles.add(r_1, r_2, r_3, r_4)
|
||||
|
Loading…
x
Reference in New Issue
Block a user