summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-01 09:50:49 +0000
committerGerrit Code Review <review@openstack.org>2012-03-01 09:50:49 +0000
commitd755f7fe62912b5c54e4d3bd09bc3e7cf4c92c39 (patch)
tree081dc9532f59425ee9bfea1335454ba77141757d
parent000b3133d60ad1974e6f50ea72e4bab4a56a54a8 (diff)
parenteceeadbd1b0c17a1320ef63f5534cf3d4bf0d646 (diff)
downloadhorizon-essex-4.tar.gz
Merge "Added detail view for images." into milestone-proposedessex-4
-rw-r--r--horizon/dashboards/nova/images_and_snapshots/images/tables.py3
-rw-r--r--horizon/dashboards/nova/images_and_snapshots/images/tests.py14
-rw-r--r--horizon/dashboards/nova/images_and_snapshots/images/urls.py5
-rw-r--r--horizon/dashboards/nova/images_and_snapshots/images/views.py17
-rw-r--r--horizon/dashboards/nova/templates/nova/images_and_snapshots/images/detail.html55
-rw-r--r--openstack_dashboard/static/dashboard/css/style.css15
6 files changed, 102 insertions, 7 deletions
diff --git a/horizon/dashboards/nova/images_and_snapshots/images/tables.py b/horizon/dashboards/nova/images_and_snapshots/images/tables.py
index 452ead629..fb239340e 100644
--- a/horizon/dashboards/nova/images_and_snapshots/images/tables.py
+++ b/horizon/dashboards/nova/images_and_snapshots/images/tables.py
@@ -66,7 +66,8 @@ def get_container_format(image):
class ImagesTable(tables.DataTable):
- name = tables.Column("name")
+ name = tables.Column("name", link="horizon:nova:images_and_snapshots:" \
+ "images:detail")
image_type = tables.Column(get_image_type,
verbose_name=_("Type"),
filters=(filters.title,))
diff --git a/horizon/dashboards/nova/images_and_snapshots/images/tests.py b/horizon/dashboards/nova/images_and_snapshots/images/tests.py
index 78d00938c..49c39d415 100644
--- a/horizon/dashboards/nova/images_and_snapshots/images/tests.py
+++ b/horizon/dashboards/nova/images_and_snapshots/images/tests.py
@@ -210,3 +210,17 @@ class ImageViewTests(test.TestCase):
args=[image.id])
res = self.client.post(url, form_data)
self.assertRedirectsNoFollow(res, IMAGES_INDEX_URL)
+
+ def test_image_detail_get(self):
+ image = self.images.first()
+ self.mox.StubOutWithMock(api.glance, 'image_get_meta')
+ api.glance.image_get_meta(IsA(http.HttpRequest), str(image.id)) \
+ .AndReturn(self.images.first())
+ self.mox.ReplayAll()
+
+ res = self.client.get(
+ reverse('horizon:nova:images_and_snapshots:images:detail',
+ args=[image.id]))
+ self.assertTemplateUsed(res,
+ 'nova/images_and_snapshots/images/detail.html')
+ self.assertEqual(res.context['image'].name, image.name)
diff --git a/horizon/dashboards/nova/images_and_snapshots/images/urls.py b/horizon/dashboards/nova/images_and_snapshots/images/urls.py
index 43004d797..cf9fb58b3 100644
--- a/horizon/dashboards/nova/images_and_snapshots/images/urls.py
+++ b/horizon/dashboards/nova/images_and_snapshots/images/urls.py
@@ -20,12 +20,13 @@
from django.conf.urls.defaults import patterns, url
-from .views import UpdateView, LaunchView
+from .views import UpdateView, LaunchView, DetailView
VIEWS_MOD = 'horizon.dashboards.nova.images_and_snapshots.images.views'
urlpatterns = patterns(VIEWS_MOD,
url(r'^(?P<image_id>[^/]+)/launch/$', LaunchView.as_view(), name='launch'),
- url(r'^(?P<image_id>[^/]+)/update/$', UpdateView.as_view(), name='update')
+ url(r'^(?P<image_id>[^/]+)/update/$', UpdateView.as_view(), name='update'),
+ url(r'^(?P<image_id>[^/]+)/$', DetailView.as_view(), name='detail'),
)
diff --git a/horizon/dashboards/nova/images_and_snapshots/images/views.py b/horizon/dashboards/nova/images_and_snapshots/images/views.py
index bd7ce2b57..e3ccaab86 100644
--- a/horizon/dashboards/nova/images_and_snapshots/images/views.py
+++ b/horizon/dashboards/nova/images_and_snapshots/images/views.py
@@ -24,12 +24,14 @@ Views for managing Nova images.
import logging
+from django import shortcuts
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from horizon import api
from horizon import exceptions
from horizon import forms
+from horizon import views
from .forms import UpdateImageForm, LaunchForm
@@ -168,3 +170,18 @@ class UpdateView(forms.ModalFormView):
'architecture': properties.get('architecture', ''),
'container_format': self.object.get('container_format', ''),
'disk_format': self.object.get('disk_format', ''), }
+
+
+class DetailView(views.APIView):
+ template_name = 'nova/images_and_snapshots/images/detail.html'
+
+ def get_data(self, request, context, *args, **kwargs):
+ image_id = kwargs['image_id']
+ try:
+ image = api.glance.image_get_meta(self.request, kwargs['image_id'])
+ except:
+ exceptions.handle(request, _('Unable to retrieve details for '
+ 'instance "%s".') % image_id,
+ redirect=redirect)
+ shortcuts.redirect('horizon:nova:images_and_snapshots:index')
+ return {'image': image}
diff --git a/horizon/dashboards/nova/templates/nova/images_and_snapshots/images/detail.html b/horizon/dashboards/nova/templates/nova/images_and_snapshots/images/detail.html
new file mode 100644
index 000000000..485131aba
--- /dev/null
+++ b/horizon/dashboards/nova/templates/nova/images_and_snapshots/images/detail.html
@@ -0,0 +1,55 @@
+{% extends 'nova/base.html' %}
+{% load i18n sizeformat %}
+{% block title %}{% trans "Image Detail "%}{% endblock %}
+
+{% block page_header %}
+ {% include "horizon/common/_page_header.html" with title="Image Detail: "|add:image.name %}
+{% endblock page_header %}
+
+{% block dash_main %}
+ <ul class="item_detail dash_block">
+ <li class="status detail_section">
+ <h3>{% trans "Status" %}</h3>
+ <ul>
+ <li><label>{% trans "Image ID:" %}</label>{{ image.id|default:"None" }}</li>
+ <li><label>{% trans "Image Status:" %}</label> {{ image.status|default:"None" }}</li>
+ <li><label>{% trans "Image Name:" %}</label> {{ image.name|default:"None" }}</li>
+ <li><label>{% trans "Public:" %}</label> {{ image.is_public }}</li>
+ <li><label>{% trans "Checksum:" %}</label> {{ image.checksum|default:"None" }}</li>
+ <li><label>{% trans "Created At:" %}</label> {{ image.created_at|default:"None" }}</li>
+ <li><label>{% trans "Last Updated At:" %}</label> {{ image.updated_app|default:"None" }}</li>
+ </ul>
+ </li>
+ <li class="specs detail_section">
+ <h3>{% trans "Specs" %}</h3>
+ <ul>
+ <li><label>{% trans "Size:" %}</label> {{ image.size|filesizeformat }}</li>
+ <li><label>{% trans "Container Format:" %}</label> {{ image.container_format|default:"None" }}</li>
+ <li><label>{% trans "Disk Format:" %}</label> {{ image.disk_format|default:"None" }}</li>
+ </ul>
+ </li>
+ <li class="custom_properties detail_section">
+ <h3>{% trans "Custom Properties" %}</h3>
+ <ul>
+ {% if image.properties.architecture %}
+ <li><label>{% trans "Architecture:" %}</label> {{ image.properties.architecture }}</li>
+ {% endif %}
+ {% if image.properties.kernel_id %}
+ <li><label>{% trans "Kernel ID:" %}</label> {{ image.properties.kernel_id }}</li>
+ {% endif %}
+ {% if image.properties.ramdisk_id %}
+ <li><label>{% trans "Ramdisk ID:" %}</label> {{ image.properties.ramdisk_id }}</li>
+ {% endif %}
+ {% if image.properties.image_state %}
+ <li><label>{% trans "Euca2ools state:" %}</label> {{ image.properties.image_state }}</li>
+ {% endif %}
+ {% if image.properties.project_id %}
+ <li><label>{% trans "Project ID:" %}</label> {{ image.properties.project_id }}</li>
+ {% endif %}
+ {% if image.properties.image_type %}
+ <li><label>{% trans "Image Type:" %}</label> {{ image.properties.image_type }}</li>
+ {% endif %}
+ </ul>
+ </li>
+ </ul>
+{% endblock %} \ No newline at end of file
diff --git a/openstack_dashboard/static/dashboard/css/style.css b/openstack_dashboard/static/dashboard/css/style.css
index aedf2b721..a8f85fe28 100644
--- a/openstack_dashboard/static/dashboard/css/style.css
+++ b/openstack_dashboard/static/dashboard/css/style.css
@@ -852,10 +852,11 @@ iframe {
border: none;
}
-form .error {
- background: #fce6e6;
- color: #b94a48;
- border: 1px solid #E9B1B0;
+.item_detail ul li label {
+ color: #000;
+ font-weight: bold;
+ display: block;
+ margin-top: 5px;
}
.progress_bar {
@@ -902,3 +903,9 @@ form .error {
.header_rule {
margin: 0 0 10px;
}
+
+.item_detail .detail_section {
+ margin-bottom: 25px;
+ float: left;
+ margin-right: 50px;
+}