Merge "Only show image name as a link when the image exists"
This commit is contained in:
commit
e7698f9e0e
@ -129,7 +129,7 @@ class Server(base.APIResourceWrapper):
|
||||
from openstack_dashboard.api import glance
|
||||
|
||||
if not self.image:
|
||||
return _("-")
|
||||
return None
|
||||
if hasattr(self.image, 'name'):
|
||||
return self.image.name
|
||||
if 'name' in self.image:
|
||||
@ -140,7 +140,7 @@ class Server(base.APIResourceWrapper):
|
||||
return image.name
|
||||
except (glance_exceptions.ClientException,
|
||||
horizon_exceptions.ServiceCatalogException):
|
||||
return _("-")
|
||||
return None
|
||||
|
||||
@property
|
||||
def internal_name(self):
|
||||
|
@ -101,7 +101,13 @@
|
||||
{% endwith %}
|
||||
{% if instance.image %}
|
||||
<dt>{% trans "Image Name" %}</dt>
|
||||
<dd><a href="{{ instance.image_url }}">{{ instance.image_name }}</a></dd>
|
||||
<dd>
|
||||
{% if instance.image_name %}
|
||||
<a href="{{ instance.image_url }}">{{ instance.image_name }}</a>
|
||||
{% else %}
|
||||
{% trans "-" %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
<dt>{% trans "Image ID" %}</dt>
|
||||
<dd>{{ instance.image.id }}</dd>
|
||||
{% else %}
|
||||
|
@ -59,7 +59,7 @@ class ServerWrapperTests(test.TestCase):
|
||||
self.mox.ReplayAll()
|
||||
|
||||
server = api.nova.Server(server, self.request)
|
||||
self.assertEqual('-', server.image_name)
|
||||
self.assertEqual(None, server.image_name)
|
||||
|
||||
|
||||
class ComputeApiTests(test.APITestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user