[Sahara] Replaced several IDs with names and names with links
Change-Id: I49cd489bcb1524859dfe09311e41c6f88bd804d3 Closes-Bug: #1367010
This commit is contained in:
parent
0a81213ab2
commit
2b1c8ecf4c
@ -23,6 +23,7 @@ from openstack_dashboard.dashboards.project. \
|
|||||||
data_processing.utils import workflow_helpers as helpers
|
data_processing.utils import workflow_helpers as helpers
|
||||||
|
|
||||||
from openstack_dashboard.api import glance
|
from openstack_dashboard.api import glance
|
||||||
|
from openstack_dashboard.api import network
|
||||||
from openstack_dashboard.api import neutron
|
from openstack_dashboard.api import neutron
|
||||||
from openstack_dashboard.api import nova
|
from openstack_dashboard.api import nova
|
||||||
|
|
||||||
@ -93,10 +94,14 @@ class NodeGroupsTab(tabs.Tab):
|
|||||||
sahara = saharaclient.client(request)
|
sahara = saharaclient.client(request)
|
||||||
cluster = sahara.clusters.get(cluster_id)
|
cluster = sahara.clusters.get(cluster_id)
|
||||||
for ng in cluster.node_groups:
|
for ng in cluster.node_groups:
|
||||||
if not ng["flavor_id"]:
|
if ng["flavor_id"]:
|
||||||
continue
|
ng["flavor_name"] = (
|
||||||
ng["flavor_name"] = (
|
nova.flavor_get(request, ng["flavor_id"]).name)
|
||||||
nova.flavor_get(request, ng["flavor_id"]).name)
|
if ng["floating_ip_pool"]:
|
||||||
|
ng["floating_ip_pool_name"] = (
|
||||||
|
self._get_floating_ip_pool_name(
|
||||||
|
request, ng["floating_ip_pool"]))
|
||||||
|
|
||||||
ng["node_group_template"] = helpers.safe_call(
|
ng["node_group_template"] = helpers.safe_call(
|
||||||
sahara.node_group_templates.get,
|
sahara.node_group_templates.get,
|
||||||
ng.get("node_group_template_id", None))
|
ng.get("node_group_template_id", None))
|
||||||
@ -107,6 +112,12 @@ class NodeGroupsTab(tabs.Tab):
|
|||||||
|
|
||||||
return {"cluster": cluster}
|
return {"cluster": cluster}
|
||||||
|
|
||||||
|
def _get_floating_ip_pool_name(self, request, pool_id):
|
||||||
|
pools = [pool for pool in network.floating_ip_pools_list(
|
||||||
|
request) if pool.id == pool_id]
|
||||||
|
|
||||||
|
return pools[0].name if pools else pool_id
|
||||||
|
|
||||||
|
|
||||||
class Instance(object):
|
class Instance(object):
|
||||||
def __init__(self, name=None, id=None, internal_ip=None,
|
def __init__(self, name=None, id=None, internal_ip=None,
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
<dd>{% trans "Template not specified" %}</dd>
|
<dd>{% trans "Template not specified" %}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<dt>{% trans "Base Image" %}</dt>
|
<dt>{% trans "Base Image" %}</dt>
|
||||||
<dd>{{ base_image.name }}</dd>
|
<dd><a href="{% url 'horizon:project:images:images:detail' base_image.id %}">{{ base_image.name }}</a></dd>
|
||||||
{% if network %}
|
{% if network %}
|
||||||
<dt>{% trans "Neutron Management Network" %}</dt>
|
<dt>{% trans "Neutron Management Network" %}</dt>
|
||||||
<dd>{{ network }}</dd>
|
<dd>{{ network }}</dd>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
{% if node_group.floating_ip_pool %}
|
{% if node_group.floating_ip_pool %}
|
||||||
<dt>{% trans "Floating IP Pool" %}</dt>
|
<dt>{% trans "Floating IP Pool" %}</dt>
|
||||||
<dd>{{ node_group.floating_ip_pool }}</dd>
|
<dd><a href="{% url 'horizon:project:networks:detail' node_group.floating_ip_pool %}">{{ node_group.floating_ip_pool_name }}</a></dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<dt>{% trans "Template" %}</dt>
|
<dt>{% trans "Template" %}</dt>
|
||||||
|
@ -18,6 +18,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from horizon import exceptions
|
from horizon import exceptions
|
||||||
from horizon import tabs
|
from horizon import tabs
|
||||||
|
|
||||||
|
from openstack_dashboard.api import network
|
||||||
from openstack_dashboard.api import nova
|
from openstack_dashboard.api import nova
|
||||||
from openstack_dashboard.api import sahara as saharaclient
|
from openstack_dashboard.api import sahara as saharaclient
|
||||||
|
|
||||||
@ -46,7 +47,24 @@ class GeneralTab(tabs.Tab):
|
|||||||
flavor = {}
|
flavor = {}
|
||||||
exceptions.handle(request,
|
exceptions.handle(request,
|
||||||
_("Unable to fetch flavor for template."))
|
_("Unable to fetch flavor for template."))
|
||||||
return {"template": template, "flavor": flavor}
|
|
||||||
|
floating_ip_pool_name = None
|
||||||
|
if template.floating_ip_pool:
|
||||||
|
try:
|
||||||
|
floating_ip_pool_name = self._get_floating_ip_pool_name(
|
||||||
|
request, template.floating_ip_pool)
|
||||||
|
except Exception:
|
||||||
|
exceptions.handle(request,
|
||||||
|
_("Unable to fetch floating ip pools."))
|
||||||
|
|
||||||
|
return {"template": template, "flavor": flavor,
|
||||||
|
"floating_ip_pool_name": floating_ip_pool_name}
|
||||||
|
|
||||||
|
def _get_floating_ip_pool_name(self, request, pool_id):
|
||||||
|
pools = [pool for pool in network.floating_ip_pools_list(
|
||||||
|
request) if pool.id == pool_id]
|
||||||
|
|
||||||
|
return pools[0].name if pools else pool_id
|
||||||
|
|
||||||
|
|
||||||
class ConfigsTab(tabs.Tab):
|
class ConfigsTab(tabs.Tab):
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{% if template.floating_ip_pool %}
|
{% if template.floating_ip_pool %}
|
||||||
<dl>
|
<dl>
|
||||||
<dt>{% trans "Floating IP Pool" %}</dt>
|
<dt>{% trans "Floating IP Pool" %}</dt>
|
||||||
<dd>{{ template.floating_ip_pool }}</dd>
|
<dd><a href="{% url 'horizon:project:networks:detail' template.floating_ip_pool %}">{{ floating_ip_pool_name }}</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<dl>
|
<dl>
|
||||||
|
Loading…
Reference in New Issue
Block a user