diff --git a/.gitignore b/.gitignore index 3fedf1d0ec..d353785ecb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ pylint.txt reports horizon.egg-info openstack_dashboard/local/local_settings.py +openstack_dashboard/test/.secret_key_store doc/build/ doc/source/sourcecode /static/ diff --git a/MANIFEST.in b/MANIFEST.in index eefe078cd6..ce88137c14 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ recursive-include bin *.js recursive-include doc *.py *.rst *.css *.js *.html *.conf *.jpg *.gif *.png *.css_t recursive-include horizon *.html *.css *.js *.csv *.template *.tmpl *.mo *.po -recursive-include openstack_dashboard *.html *.js *.css *.less *.csv *.template *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.gif *.ico *.wsgi +recursive-include openstack_dashboard *.html *.js *.less *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.ico *.wsgi recursive-include tools *.py *.sh include AUTHORS diff --git a/horizon/dashboards/nova/access_and_security/floating_ips/tables.py b/horizon/dashboards/nova/access_and_security/floating_ips/tables.py index 4b72c4d18d..1ad9f3b114 100644 --- a/horizon/dashboards/nova/access_and_security/floating_ips/tables.py +++ b/horizon/dashboards/nova/access_and_security/floating_ips/tables.py @@ -104,7 +104,7 @@ def get_instance_info(instance): def get_instance_link(datum): - view = "horizon:nova:instances_and_volumes:instances:detail" + view = "horizon:nova:instances:detail" if datum.instance_id: return urlresolvers.reverse(view, args=(datum.instance_id,)) else: diff --git a/horizon/dashboards/nova/access_and_security/floating_ips/tests.py b/horizon/dashboards/nova/access_and_security/floating_ips/tests.py index 8bd686bf6e..0fc0c96875 100644 --- a/horizon/dashboards/nova/access_and_security/floating_ips/tests.py +++ b/horizon/dashboards/nova/access_and_security/floating_ips/tests.py @@ -91,7 +91,7 @@ def test_associate_post_with_redirect(self): form_data = {'instance_id': server.id, 'ip_id': floating_ip.id} url = reverse('%s:associate' % NAMESPACE) - next = reverse("horizon:nova:instances_and_volumes:index") + next = reverse("horizon:nova:instances:index") res = self.client.post("%s?next=%s" % (url, next), form_data) self.assertRedirectsNoFollow(res, next) diff --git a/horizon/dashboards/nova/containers/tables.py b/horizon/dashboards/nova/containers/tables.py index 3b357b6cc0..6a1950622c 100644 --- a/horizon/dashboards/nova/containers/tables.py +++ b/horizon/dashboards/nova/containers/tables.py @@ -152,15 +152,14 @@ def sanitize_name(name): return name.split("/")[-1] -def get_size(obj): - return filesizeformat(obj.size) - - class ObjectsTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Object Name"), filters=(sanitize_name,)) - size = tables.Column(get_size, verbose_name=_('Size')) + size = tables.Column("size", + verbose_name=_('Size'), + filters=(filesizeformat,), + summation="sum") def get_object_id(self, obj): return obj.name diff --git a/horizon/dashboards/nova/dashboard.py b/horizon/dashboards/nova/dashboard.py index c87bbceb61..e950873c39 100644 --- a/horizon/dashboards/nova/dashboard.py +++ b/horizon/dashboards/nova/dashboard.py @@ -23,7 +23,8 @@ class BasePanels(horizon.PanelGroup): slug = "compute" name = _("Manage Compute") panels = ('overview', - 'instances_and_volumes', + 'instances', + 'volumes', 'images_and_snapshots', 'access_and_security') diff --git a/horizon/dashboards/nova/images_and_snapshots/images/tables.py b/horizon/dashboards/nova/images_and_snapshots/images/tables.py index b92197f203..9ec80394ff 100644 --- a/horizon/dashboards/nova/images_and_snapshots/images/tables.py +++ b/horizon/dashboards/nova/images_and_snapshots/images/tables.py @@ -31,7 +31,7 @@ class LaunchImage(tables.LinkAction): name = "launch_image" verbose_name = _("Launch") - url = "horizon:nova:instances_and_volumes:instances:launch" + url = "horizon:nova:instances:launch" classes = ("btn-launch", "ajax-modal") def get_link_url(self, datum): diff --git a/horizon/dashboards/nova/images_and_snapshots/snapshots/forms.py b/horizon/dashboards/nova/images_and_snapshots/snapshots/forms.py index d59c8271fc..9add576d35 100644 --- a/horizon/dashboards/nova/images_and_snapshots/snapshots/forms.py +++ b/horizon/dashboards/nova/images_and_snapshots/snapshots/forms.py @@ -51,7 +51,7 @@ def handle(self, request, data): return shortcuts.redirect('horizon:nova:images_and_snapshots:' 'index') except: - redirect = reverse("horizon:nova:instances_and_volumes:index") + redirect = reverse("horizon:nova:instances:index") exceptions.handle(request, _('Unable to create snapshot.'), redirect=redirect) diff --git a/horizon/dashboards/nova/images_and_snapshots/snapshots/tables.py b/horizon/dashboards/nova/images_and_snapshots/snapshots/tables.py index 328fd3845c..62d32c4bde 100644 --- a/horizon/dashboards/nova/images_and_snapshots/snapshots/tables.py +++ b/horizon/dashboards/nova/images_and_snapshots/snapshots/tables.py @@ -30,7 +30,7 @@ class LaunchSnapshot(tables.LinkAction): name = "launch_snapshot" verbose_name = _("Launch") - url = "horizon:nova:instances_and_volumes:instances:launch" + url = "horizon:nova:instances:launch" classes = ("btn-launch", "ajax-modal") def get_link_url(self, datum): diff --git a/horizon/dashboards/nova/images_and_snapshots/snapshots/tests.py b/horizon/dashboards/nova/images_and_snapshots/snapshots/tests.py index d406f21002..740bb16f9c 100644 --- a/horizon/dashboards/nova/images_and_snapshots/snapshots/tests.py +++ b/horizon/dashboards/nova/images_and_snapshots/snapshots/tests.py @@ -51,7 +51,7 @@ def test_create_snapshot_get_with_invalid_status(self): url = reverse('horizon:nova:images_and_snapshots:snapshots:create', args=[server.id]) res = self.client.get(url) - redirect = reverse("horizon:nova:instances_and_volumes:index") + redirect = reverse("horizon:nova:instances:index") self.assertRedirectsNoFollow(res, redirect) def test_create_get_server_exception(self): @@ -64,7 +64,7 @@ def test_create_get_server_exception(self): url = reverse('horizon:nova:images_and_snapshots:snapshots:create', args=[server.id]) res = self.client.get(url) - redirect = reverse("horizon:nova:instances_and_volumes:index") + redirect = reverse("horizon:nova:instances:index") self.assertRedirectsNoFollow(res, redirect) def test_create_snapshot_post(self): @@ -107,5 +107,5 @@ def test_create_snapshot_post_exception(self): url = reverse('horizon:nova:images_and_snapshots:snapshots:create', args=[server.id]) res = self.client.post(url, formData) - redirect = reverse("horizon:nova:instances_and_volumes:index") + redirect = reverse("horizon:nova:instances:index") self.assertRedirectsNoFollow(res, redirect) diff --git a/horizon/dashboards/nova/images_and_snapshots/snapshots/views.py b/horizon/dashboards/nova/images_and_snapshots/snapshots/views.py index a45c4313e4..26860cb0eb 100644 --- a/horizon/dashboards/nova/images_and_snapshots/snapshots/views.py +++ b/horizon/dashboards/nova/images_and_snapshots/snapshots/views.py @@ -41,7 +41,7 @@ class CreateView(forms.ModalFormView): template_name = 'nova/images_and_snapshots/snapshots/create.html' def get_initial(self): - redirect = reverse('horizon:nova:instances_and_volumes:index') + redirect = reverse('horizon:nova:instances:index') instance_id = self.kwargs["instance_id"] try: self.instance = api.server_get(self.request, instance_id) diff --git a/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tables.py b/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tables.py index 01f30b77bc..f7f5be68fb 100644 --- a/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tables.py +++ b/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tables.py @@ -20,7 +20,7 @@ from horizon import api from horizon import tables -from ...instances_and_volumes.volumes import tables as volume_tables +from ...volumes import tables as volume_tables LOG = logging.getLogger(__name__) diff --git a/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tests.py b/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tests.py index 26beb2c544..fafecd9edd 100644 --- a/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tests.py +++ b/horizon/dashboards/nova/images_and_snapshots/volume_snapshots/tests.py @@ -32,12 +32,10 @@ class VolumeSnapshotsViewTests(test.TestCase): def test_create_snapshot_get(self): volume = self.volumes.first() - res = self.client.get(reverse('horizon:nova:instances_and_volumes:' - 'volumes:create_snapshot', + res = self.client.get(reverse('horizon:nova:volumes:create_snapshot', args=[volume.id])) - self.assertTemplateUsed(res, 'nova/instances_and_volumes/' - 'volumes/create_snapshot.html') + self.assertTemplateUsed(res, 'nova/volumes/create_snapshot.html') def test_create_snapshot_post(self): volume = self.volumes.first() @@ -56,7 +54,6 @@ def test_create_snapshot_post(self): 'volume_id': volume.id, 'name': snapshot.display_name, 'description': snapshot.display_description} - url = reverse('horizon:nova:instances_and_volumes:volumes:' - 'create_snapshot', args=[volume.id]) + url = reverse('horizon:nova:volumes:create_snapshot', args=[volume.id]) res = self.client.post(url, formData) self.assertRedirectsNoFollow(res, INDEX_URL) diff --git a/horizon/dashboards/nova/instances_and_volumes/__init__.py b/horizon/dashboards/nova/instances/__init__.py similarity index 100% rename from horizon/dashboards/nova/instances_and_volumes/__init__.py rename to horizon/dashboards/nova/instances/__init__.py diff --git a/horizon/dashboards/nova/instances_and_volumes/instances/forms.py b/horizon/dashboards/nova/instances/forms.py similarity index 93% rename from horizon/dashboards/nova/instances_and_volumes/instances/forms.py rename to horizon/dashboards/nova/instances/forms.py index 8e56f8b469..85cab29612 100644 --- a/horizon/dashboards/nova/instances_and_volumes/instances/forms.py +++ b/horizon/dashboards/nova/instances/forms.py @@ -45,5 +45,4 @@ def handle(self, request, data): except: exceptions.handle(request, _('Unable to update instance.')) - return shortcuts.redirect( - 'horizon:nova:instances_and_volumes:index') + return shortcuts.redirect('horizon:nova:instances:index') diff --git a/horizon/dashboards/nova/instances_and_volumes/panel.py b/horizon/dashboards/nova/instances/panel.py similarity index 83% rename from horizon/dashboards/nova/instances_and_volumes/panel.py rename to horizon/dashboards/nova/instances/panel.py index b12c225231..1a4ab8d670 100644 --- a/horizon/dashboards/nova/instances_and_volumes/panel.py +++ b/horizon/dashboards/nova/instances/panel.py @@ -20,9 +20,9 @@ from horizon.dashboards.nova import dashboard -class InstancesAndVolumes(horizon.Panel): - name = _("Instances & Volumes") - slug = 'instances_and_volumes' +class Instances(horizon.Panel): + name = _("Instances") + slug = 'instances' -dashboard.Nova.register(InstancesAndVolumes) +dashboard.Nova.register(Instances) diff --git a/horizon/dashboards/nova/instances_and_volumes/instances/tables.py b/horizon/dashboards/nova/instances/tables.py similarity index 94% rename from horizon/dashboards/nova/instances_and_volumes/instances/tables.py rename to horizon/dashboards/nova/instances/tables.py index cb51b72f3b..116ce1540e 100644 --- a/horizon/dashboards/nova/instances_and_volumes/instances/tables.py +++ b/horizon/dashboards/nova/instances/tables.py @@ -146,14 +146,14 @@ def action(self, request, obj_id): class LaunchLink(tables.LinkAction): name = "launch" verbose_name = _("Launch Instance") - url = "horizon:nova:instances_and_volumes:instances:launch" + url = "horizon:nova:instances:launch" classes = ("btn-launch", "ajax-modal") class EditInstance(tables.LinkAction): name = "edit" verbose_name = _("Edit Instance") - url = "horizon:nova:instances_and_volumes:instances:update" + url = "horizon:nova:instances:update" classes = ("ajax-modal", "btn-edit") @@ -170,7 +170,7 @@ def allowed(self, request, instance=None): class ConsoleLink(tables.LinkAction): name = "console" verbose_name = _("VNC Console") - url = "horizon:nova:instances_and_volumes:instances:detail" + url = "horizon:nova:instances:detail" classes = ("btn-console",) def allowed(self, request, instance=None): @@ -185,7 +185,7 @@ def get_link_url(self, datum): class LogLink(tables.LinkAction): name = "log" verbose_name = _("View Log") - url = "horizon:nova:instances_and_volumes:instances:detail" + url = "horizon:nova:instances:detail" classes = ("btn-log",) def allowed(self, request, instance=None): @@ -205,7 +205,7 @@ class AssociateIP(tables.LinkAction): def get_link_url(self, datum): base_url = urlresolvers.reverse(self.url) - next = urlresolvers.reverse("horizon:nova:instances_and_volumes:index") + next = urlresolvers.reverse("horizon:nova:instances:index") params = {"instance_id": self.table.get_object_id(datum), IPAssociationWorkflow.redirect_param_name: next} params = urlencode(params) @@ -222,14 +222,15 @@ def get_data(self, request, instance_id): def get_ips(instance): - template_name = 'nova/instances_and_volumes/instances/_instance_ips.html' + template_name = 'nova/instances/_instance_ips.html' context = {"instance": instance} return template.loader.render_to_string(template_name, context) def get_size(instance): if hasattr(instance, "full_flavor"): - size_string = _("%(name)s | %(RAM)s RAM | %(VCPU)s VCPU | %(disk)s Disk") + size_string = _("%(name)s | %(RAM)s RAM | %(VCPU)s VCPU " + "| %(disk)s Disk") vals = {'name': instance.full_flavor.name, 'RAM': sizeformat.mbformat(instance.full_flavor.ram), 'VCPU': instance.full_flavor.vcpus, @@ -237,6 +238,7 @@ def get_size(instance): return size_string % vals return _("Not available") + def get_keyname(instance): if hasattr(instance, "key_name"): keyname = instance.key_name @@ -263,8 +265,7 @@ class InstancesTable(tables.DataTable): ("image_snapshot", "Snapshotting"), ) name = tables.Column("name", - link=("horizon:nova:instances_and_volumes:" - "instances:detail"), + link=("horizon:nova:instances:detail"), verbose_name=_("Instance Name")) ip = tables.Column(get_ips, verbose_name=_("IP Address")) size = tables.Column(get_size, verbose_name=_("Size")) diff --git a/horizon/dashboards/nova/instances_and_volumes/instances/tabs.py b/horizon/dashboards/nova/instances/tabs.py similarity index 91% rename from horizon/dashboards/nova/instances_and_volumes/instances/tabs.py rename to horizon/dashboards/nova/instances/tabs.py index 94df3c5bf7..9e27c7d23c 100644 --- a/horizon/dashboards/nova/instances_and_volumes/instances/tabs.py +++ b/horizon/dashboards/nova/instances/tabs.py @@ -24,7 +24,7 @@ class OverviewTab(tabs.Tab): name = _("Overview") slug = "overview" - template_name = ("nova/instances_and_volumes/instances/" + template_name = ("nova/instances/" "_detail_overview.html") def get_context_data(self, request): @@ -34,7 +34,7 @@ def get_context_data(self, request): class LogTab(tabs.Tab): name = _("Log") slug = "log" - template_name = "nova/instances_and_volumes/instances/_detail_log.html" + template_name = "nova/instances/_detail_log.html" preload = False def get_context_data(self, request): @@ -53,7 +53,7 @@ def get_context_data(self, request): class VNCTab(tabs.Tab): name = _("VNC") slug = "vnc" - template_name = "nova/instances_and_volumes/instances/_detail_vnc.html" + template_name = "nova/instances/_detail_vnc.html" preload = False def get_context_data(self, request): diff --git a/horizon/dashboards/nova/instances_and_volumes/templates/instances_and_volumes/instances/_detail_log.html b/horizon/dashboards/nova/instances/templates/instances/_detail_log.html similarity index 68% rename from horizon/dashboards/nova/instances_and_volumes/templates/instances_and_volumes/instances/_detail_log.html rename to horizon/dashboards/nova/instances/templates/instances/_detail_log.html index 4eba3a0a91..8e60f63dca 100644 --- a/horizon/dashboards/nova/instances_and_volumes/templates/instances_and_volumes/instances/_detail_log.html +++ b/horizon/dashboards/nova/instances/templates/instances/_detail_log.html @@ -3,11 +3,11 @@
- {% url horizon:nova:instances_and_volumes:instances:console instance.id as console_url %} + {% url horizon:nova:instances:console instance.id as console_url %} {% trans "View Full Log" %}
-