Adding plan parameter view on service configuration tab
Change-Id: Ia0eb495ec1bbc7fa41df296abddddf60956da55d
This commit is contained in:
parent
da896c2241
commit
25644c7985
32
tuskar_ui/infrastructure/parameters/tables.py
Normal file
32
tuskar_ui/infrastructure/parameters/tables.py
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- 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 _
|
||||
|
||||
from horizon import tables
|
||||
|
||||
|
||||
class ParametersTable(tables.DataTable):
|
||||
label = tables.Column('label',
|
||||
verbose_name=_("Parameter Name"))
|
||||
value = tables.Column('value',
|
||||
verbose_name=_("Default Value"))
|
||||
description = tables.Column('description',
|
||||
verbose_name=("Detailed Description"))
|
||||
|
||||
class Meta:
|
||||
name = "parameters"
|
||||
verbose_name = _("Service Configuration")
|
||||
table_actions = ()
|
||||
row_actions = ()
|
@ -1,6 +1,5 @@
|
||||
{% extends 'infrastructure/base.html' %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
{% block title %}{% trans 'Service Configuration' %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
@ -8,9 +7,12 @@
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<h4>To Be Done</h4>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="no-table-title">
|
||||
{{ table.render }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
@ -29,6 +29,8 @@ INDEX_URL = urlresolvers.reverse(
|
||||
TEST_DATA = utils.TestDataContainer()
|
||||
tuskar_data.data(TEST_DATA)
|
||||
|
||||
from tuskar_ui.infrastructure.parameters import views
|
||||
|
||||
|
||||
class ParametersTest(test.BaseAdminViewTests):
|
||||
|
||||
@ -47,3 +49,13 @@ class ParametersTest(test.BaseAdminViewTests):
|
||||
res = self.client.get(INDEX_URL)
|
||||
|
||||
self.assertTemplateUsed(res, 'infrastructure/parameters/index.html')
|
||||
|
||||
def test_param_object(self):
|
||||
param_dict = {'parameter_group': 'Neutron',
|
||||
'default': '1.2.3.4',
|
||||
'name': 'Ip Address',
|
||||
'description': 'This is an IP Address'}
|
||||
|
||||
p = views.ServiceParameter(param_dict, 5)
|
||||
self.assertEqual(p.id, 5)
|
||||
self.assertEqual(p.value, '1.2.3.4')
|
||||
|
@ -12,17 +12,29 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from horizon import views as horizon_views
|
||||
from horizon import tables as horizon_tables
|
||||
|
||||
from tuskar_ui import api
|
||||
from tuskar_ui.infrastructure.parameters import tables
|
||||
|
||||
|
||||
class IndexView(horizon_views.APIView):
|
||||
template_name = 'infrastructure/parameters/index.html'
|
||||
class ServiceParameter:
|
||||
def __init__(self, params_dict, id):
|
||||
self.id = id
|
||||
self.label = params_dict.get('name')
|
||||
self.value = params_dict.get('default')
|
||||
self.category = params_dict.get('parameter_group')
|
||||
self.description = params_dict.get('description')
|
||||
|
||||
def get_data(self, request, context, *args, **kwargs):
|
||||
|
||||
class IndexView(horizon_tables.DataTableView):
|
||||
table_class = tables.ParametersTable
|
||||
template_name = "infrastructure/parameters/index.html"
|
||||
|
||||
def get_data(self):
|
||||
plan = api.tuskar.OvercloudPlan.get_the_plan(self.request)
|
||||
context['plan'] = plan
|
||||
context['plan_parameters'] = plan.parameter_list(
|
||||
base_parameters = plan.parameter_list(
|
||||
include_key_parameters=False)
|
||||
return context
|
||||
params = [ServiceParameter(param, ind)
|
||||
for ind, param in enumerate(base_parameters)]
|
||||
return params
|
||||
|
@ -29,6 +29,7 @@ def data(TEST):
|
||||
'template': '',
|
||||
'created_at': '2014-05-27T21:11:09Z',
|
||||
'modified_at': '2014-05-30T21:11:09Z',
|
||||
'uuid': '1234567890',
|
||||
'roles': [
|
||||
{
|
||||
'uuid': 'role-1',
|
||||
@ -122,13 +123,17 @@ def data(TEST):
|
||||
'description': '',
|
||||
'no_echo': 'false',
|
||||
'default': '',
|
||||
'label': 'Keystone Host',
|
||||
'value': ''
|
||||
}, {
|
||||
'name': 'object_storage_SwiftHashSuffix',
|
||||
'parameter_group': 'Swift',
|
||||
'label': 'Swift Object Storage Hash Suffix',
|
||||
'type': 'String',
|
||||
'description': '',
|
||||
'no_echo': 'true',
|
||||
'default': '',
|
||||
'value': ''
|
||||
}, {
|
||||
'name': 'block_storage_NeutronNetworkType',
|
||||
'parameter_group': 'Neutron',
|
||||
|
Loading…
x
Reference in New Issue
Block a user