From a8c08de875715b51c2a3e6c072d4e85b045d1903 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Thu, 11 Sep 2014 13:31:45 +0200 Subject: [PATCH] Add support for row actions to detail pages Add support for performing actions on an object from the object's detail page. Actions are displayed in the page header, in a row of buttons. To use this newly added capability, `row=True` must be passed as a parameter to the render_row_actions method, when called from a DetailView. Change-Id: I4fd96433f9514242c21d6c47f79bf83f3a5e4fc0 Implements: blueprint detail-pages-ia --- openstack_dashboard/dashboards/admin/networks/tests.py | 7 ------- openstack_dashboard/dashboards/project/images/images/views.py | 3 +++ openstack_dashboard/dashboards/project/instances/views.py | 3 +++ openstack_dashboard/dashboards/project/networks/views.py | 3 +++ openstack_dashboard/dashboards/project/stacks/views.py | 4 ---- openstack_dashboard/dashboards/project/volumes/backups/views.py | 4 ++++ openstack_dashboard/dashboards/project/volumes/snapshots/views.py | 3 +++ openstack_dashboard/dashboards/project/volumes/volumes/views.py | 4 ++++ openstack_dashboard/dashboards/theme/theme_index/panel.py | 1 + openstack_dashboard/enabled/_99_customization.py | 1 - 10 files changed, 21 insertions(+), 12 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py index e233302..764a070 100644 --- a/openstack_dashboard/dashboards/admin/networks/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/tests.py @@ -191,19 +191,12 @@ class NetworkTests(test.BaseAdminViewTests): api.neutron.is_extension_supported(IsA(http.HttpRequest), 'mac-learning')\ .AndReturn(mac_learning) -<<<<<<< HEAD api.neutron.is_extension_supported( IsA(http.HttpRequest), 'dhcp_agent_scheduler').AndReturn(True) api.neutron.is_extension_supported( IsA(http.HttpRequest), 'dhcp_agent_scheduler').AndReturn(True) -======= - api.neutron.is_extension_supported(IsA(http.HttpRequest), - 'dhcp_agent_scheduler').AndReturn(True) - api.neutron.is_extension_supported(IsA(http.HttpRequest), - 'dhcp_agent_scheduler').AndReturn(True) ->>>>>>> dc6b1ce... Add dropdown actions to all details pages self.mox.ReplayAll() diff --git a/openstack_dashboard/dashboards/project/images/images/views.py b/openstack_dashboard/dashboards/project/images/images/views.py index 2bf34bd..5b5b36d 100644 --- a/openstack_dashboard/dashboards/project/images/images/views.py +++ b/openstack_dashboard/dashboards/project/images/images/views.py @@ -94,6 +94,9 @@ class DetailView(tabs.TabView): context["image"] = image context["url"] = self.get_redirect_url() context["actions"] = table.render_row_actions(image) + context["page_title"] = _("Image Details: " + "%(image_name)s") % {'image_name': + image.name} return context @staticmethod diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 674e201..05ad37c 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -300,6 +300,9 @@ class DetailView(tabs.TabView): table = project_tables.InstancesTable(self.request) context["url"] = reverse(self.redirect_url) context["actions"] = table.render_row_actions(instance) + context["page_title"] = _("Instance Details: " + "%(instance_name)s") % {'instance_name': + instance.name} return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/project/networks/views.py b/openstack_dashboard/dashboards/project/networks/views.py index 5dec3a8..1f4b2a9 100644 --- a/openstack_dashboard/dashboards/project/networks/views.py +++ b/openstack_dashboard/dashboards/project/networks/views.py @@ -143,6 +143,9 @@ class DetailView(tables.MultiTableView): table = project_tables.NetworksTable(self.request) context["url"] = self.get_redirect_url() context["actions"] = table.render_row_actions(network) + context["page_title"] = _("Network Details: " + "%(network_name)s") % {'network_name': + network.name} return context @staticmethod diff --git a/openstack_dashboard/dashboards/project/stacks/views.py b/openstack_dashboard/dashboards/project/stacks/views.py index 87a86a3..dc34564 100644 --- a/openstack_dashboard/dashboards/project/stacks/views.py +++ b/openstack_dashboard/dashboards/project/stacks/views.py @@ -308,10 +308,6 @@ class DetailView(tabs.TabView): def get_redirect_url(): return reverse('horizon:project:stacks:index') - @staticmethod - def get_redirect_url(): - return reverse('horizon:project:stacks:index') - class ResourceView(tabs.TabView): tab_group_class = project_tabs.ResourceDetailTabs diff --git a/openstack_dashboard/dashboards/project/volumes/backups/views.py b/openstack_dashboard/dashboards/project/volumes/backups/views.py index c4f9065..09c7f47 100644 --- a/openstack_dashboard/dashboards/project/volumes/backups/views.py +++ b/openstack_dashboard/dashboards/project/volumes/backups/views.py @@ -60,6 +60,10 @@ class BackupDetailView(tabs.TabView): context["backup"] = backup context["url"] = self.get_redirect_url() context["actions"] = table.render_row_actions(backup) + context["page_title"] = _("Volume Backup Details: " + "%(backup_name)s") % {'backup_name': + backup.name} + return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py index 6a37c5d..e6749f9 100644 --- a/openstack_dashboard/dashboards/project/volumes/snapshots/views.py +++ b/openstack_dashboard/dashboards/project/volumes/snapshots/views.py @@ -77,6 +77,9 @@ class DetailView(tabs.TabView): context["snapshot"] = snapshot context["url"] = self.get_redirect_url() context["actions"] = table.render_row_actions(snapshot) + context["page_title"] = _("Volume Snapshot Details: " + "%(snapshot_name)s") % {'snapshot_name': + snapshot.name} return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/project/volumes/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/volumes/views.py index b5bd7fc..d52f198 100644 --- a/openstack_dashboard/dashboards/project/volumes/volumes/views.py +++ b/openstack_dashboard/dashboards/project/volumes/volumes/views.py @@ -52,6 +52,10 @@ class DetailView(tabs.TabView): context["volume"] = volume context["url"] = self.get_redirect_url() context["actions"] = table.render_row_actions(volume) + context["page_title"] = _("Volume Details: " + "%(volume_name)s") % {'volume_name': + volume.name} + return context @memoized.memoized_method diff --git a/openstack_dashboard/dashboards/theme/theme_index/panel.py b/openstack_dashboard/dashboards/theme/theme_index/panel.py index 9c42a79..7d85f3c 100644 --- a/openstack_dashboard/dashboards/theme/theme_index/panel.py +++ b/openstack_dashboard/dashboards/theme/theme_index/panel.py @@ -20,6 +20,7 @@ import horizon from openstack_dashboard.dashboards.theme import dashboard + class ThemePanel(horizon.Panel): name = _("Panel providing a theme") slug = 'theme_index' diff --git a/openstack_dashboard/enabled/_99_customization.py b/openstack_dashboard/enabled/_99_customization.py index f37f848..272bcbe 100644 --- a/openstack_dashboard/enabled/_99_customization.py +++ b/openstack_dashboard/enabled/_99_customization.py @@ -6,4 +6,3 @@ DEFAULT = False ADD_EXCEPTIONS = {} # A list of applications to be added to INSTALLED_APPS. ADD_INSTALLED_APPS = ['openstack_dashboard.dashboards.theme'] -