Improve system info page
This change adds region info and all the url types, and also removes enabled (which never did anything). Change-Id: I7594d2b3d1e9826ec66bac379059171150155c4b Closes-bug: #1497448
This commit is contained in:
parent
91443dfda1
commit
5934d83b04
@ -53,29 +53,38 @@ class SubServiceFilterAction(ServiceFilterAction):
|
||||
filter_field = 'binary'
|
||||
|
||||
|
||||
def get_status(service):
|
||||
# if not configured in this region, neither option makes sense
|
||||
if service.host:
|
||||
return SERVICE_ENABLED if not service.disabled else SERVICE_DISABLED
|
||||
def show_endpoints(datanum):
|
||||
if 'endpoints' in datanum:
|
||||
template_name = 'admin/info/_cell_endpoints_v2.html'
|
||||
context = None
|
||||
if (len(datanum['endpoints']) > 0 and
|
||||
"publicURL" in datanum['endpoints'][0]):
|
||||
context = datanum['endpoints'][0]
|
||||
else:
|
||||
# this is a keystone v3 version of endpoints
|
||||
template_name = 'admin/info/_cell_endpoints_v3.html'
|
||||
context = {'endpoints': datanum['endpoints']}
|
||||
return template.loader.render_to_string(template_name,
|
||||
context)
|
||||
return None
|
||||
|
||||
|
||||
class ServicesTable(tables.DataTable):
|
||||
id = tables.Column('id', hidden=True)
|
||||
name = tables.Column("name", verbose_name=_('Name'))
|
||||
service_type = tables.Column('__unicode__', verbose_name=_('Service'))
|
||||
host = tables.Column('host', verbose_name=_('Host'))
|
||||
status = tables.Column(get_status,
|
||||
verbose_name=_('Status'),
|
||||
status=True,
|
||||
display_choices=SERVICE_STATUS_DISPLAY_CHOICES)
|
||||
service_type = tables.Column('type', verbose_name=_('Service'))
|
||||
region = tables.Column('region', verbose_name=_('Region'))
|
||||
endpoints = tables.Column(show_endpoints, verbose_name=_('Endpoints'))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
# this method is need b/c the parent impl does not handle dicts
|
||||
return datum.get('id')
|
||||
|
||||
class Meta(object):
|
||||
name = "services"
|
||||
verbose_name = _("Services")
|
||||
table_actions = (ServiceFilterAction,)
|
||||
multi_select = False
|
||||
status_columns = ["status"]
|
||||
|
||||
|
||||
def get_available(zone):
|
||||
|
@ -19,7 +19,6 @@ from horizon import tabs
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.api import cinder
|
||||
from openstack_dashboard.api import heat
|
||||
from openstack_dashboard.api import keystone
|
||||
from openstack_dashboard.api import neutron
|
||||
from openstack_dashboard.api import nova
|
||||
from openstack_dashboard.dashboards.admin.info import constants
|
||||
@ -32,13 +31,27 @@ class ServicesTab(tabs.TableTab):
|
||||
slug = tables.ServicesTable.Meta.name
|
||||
template_name = constants.INFO_DETAIL_TEMPLATE_NAME
|
||||
|
||||
def generate_catalog_endpoints(self, catalog):
|
||||
for i, service in enumerate(catalog):
|
||||
regions = set(endpoint['region'] for endpoint
|
||||
in service['endpoints'])
|
||||
for region in regions:
|
||||
endpoints = [endpoint for endpoint
|
||||
in service['endpoints']
|
||||
if endpoint['region'] == region]
|
||||
# sort the endpoints, so they appear in consistent order
|
||||
endpoints.sort(key=lambda endpoint: endpoint.get('interface'))
|
||||
yield {'id': service['name'] + region,
|
||||
'name': service['name'],
|
||||
'type': service['type'],
|
||||
'region': region,
|
||||
'endpoints': endpoints,
|
||||
}
|
||||
|
||||
def get_services_data(self):
|
||||
request = self.tab_group.request
|
||||
services = []
|
||||
for i, service in enumerate(request.user.service_catalog):
|
||||
service['id'] = i
|
||||
services.append(
|
||||
keystone.Service(service, request.user.services_region))
|
||||
catalog = request.user.service_catalog
|
||||
services = list(self.generate_catalog_endpoints(catalog))
|
||||
return services
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{% load i18n %}
|
||||
<dl class="dl-horizontal">
|
||||
<dt title="{% trans "Admin URL:" %}">{% trans "Admin URL:" %}</dt>
|
||||
<dd>{{ adminURL }}</dd>
|
||||
<dt title="{% trans "Internal URL:" %}">{% trans "Internal URL:" %}</dt>
|
||||
<dd>{{ internalURL }}</dd>
|
||||
<dt title="{% trans "Public URL:" %}">{% trans "Public URL:" %}</dt>
|
||||
<dd>{{ publicURL }}</dd>
|
||||
</dl>
|
@ -0,0 +1,6 @@
|
||||
<dl class="dl-horizontal">
|
||||
{% for endpoint in endpoints %}
|
||||
<dt title="{{ endpoint.interface|title }}">{{ endpoint.interface|title }}</dt>
|
||||
<dd>{{ endpoint.url }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
@ -60,19 +60,9 @@ class SystemInfoViewTests(test.BaseAdminViewTests):
|
||||
def test_index(self):
|
||||
res = self._test_base_index()
|
||||
services_tab = res.context['tab_group'].get_tab('services')
|
||||
self.assertQuerysetEqual(
|
||||
services_tab._tables['services'].data,
|
||||
['<Service: compute>',
|
||||
'<Service: volumev2>',
|
||||
'<Service: image>',
|
||||
'<Service: identity (native backend)>',
|
||||
'<Service: object-store>',
|
||||
'<Service: network>',
|
||||
'<Service: ec2>',
|
||||
'<Service: metering>',
|
||||
'<Service: orchestration>',
|
||||
])
|
||||
|
||||
self.assertTrue("region" in services_tab._tables['services'].data[0])
|
||||
self.assertTrue("endpoints" in
|
||||
services_tab._tables['services'].data[0])
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def test_neutron_index(self):
|
||||
|
@ -51,6 +51,19 @@
|
||||
.normal_column ul {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dl-horizontal {
|
||||
margin-bottom: 0;
|
||||
|
||||
@media (min-width: $grid-float-breakpoint) {
|
||||
dt {
|
||||
width: (($dl-horizontal-offset/2) - 20);
|
||||
}
|
||||
dd {
|
||||
margin-left: $dl-horizontal-offset/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sometimes the header is empty, lets keep the same look either way
|
||||
@ -145,3 +158,4 @@
|
||||
.status_unknown .horizon-pending-bar-icon {
|
||||
color: $text-color;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user