Fixes inconsistent Edit between tables & details

This patch addresses several instances where clicking Edit on a Detail
page (such as Edit Port on the Port Detail Page) gave either more or
less options than the equivalent action in the Table. This patch fixes
any occurences so that Edit ___ show the same form and fields regardless
of where it is clicked

Closes-bug: 1408346
Change-Id: Ic2599d594b627bd7ab584d1a314360921e41a203
This commit is contained in:
Rob Cresswell
2015-01-09 13:48:03 +00:00
committed by Rob Cresswell
parent 4fdc42cf63
commit 49e40509eb
5 changed files with 25 additions and 9 deletions

View File

@@ -122,8 +122,13 @@ class UpdateView(views.UpdateView):
class DetailView(views.DetailView):
"""Admin placeholder for image detail view."""
pass
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
table = project_tables.AdminImagesTable(self.request)
context["url"] = reverse('horizon:admin:images:index')
context["actions"] = table.render_row_actions(context["image"])
return context
class UpdateMetadataView(forms.ModalFormView):

View File

@@ -59,6 +59,7 @@ def rdp(args, **kvargs):
class AdminUpdateView(views.UpdateView):
workflow_class = update_instance.AdminUpdateInstance
success_url = reverse_lazy("horizon:admin:instances:index")
class AdminIndexView(tables.DataTableView):

View File

@@ -971,13 +971,7 @@ class NetworkPortTests(test.BaseAdminViewTests):
.AndReturn(self.ports.first())
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'mac-learning')\
.AndReturn(mac_learning)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'mac-learning')\
.AndReturn(mac_learning)
api.neutron.is_extension_supported(IsA(http.HttpRequest),
'mac-learning')\
.AndReturn(mac_learning)
.MultipleTimes().AndReturn(mac_learning)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:admin:networks:ports:detail',

View File

@@ -63,6 +63,13 @@ class DetailView(r_views.DetailView):
template_name = 'admin/routers/detail.html'
failure_url = reverse_lazy('horizon:admin:routers:index')
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
table = rtbl.RoutersTable(self.request)
context["url"] = self.failure_url
context["actions"] = table.render_row_actions(context["router"])
return context
class UpdateView(r_views.UpdateView):
form_class = rforms.UpdateForm

View File

@@ -21,6 +21,8 @@ from horizon.utils import memoized
from openstack_dashboard.api import cinder
from openstack_dashboard.dashboards.admin.volumes.volumes \
import forms as volumes_forms
from openstack_dashboard.dashboards.admin.volumes.volumes \
import tables as volumes_tables
from openstack_dashboard.dashboards.project.volumes.volumes \
import views as volumes_views
@@ -28,6 +30,13 @@ from openstack_dashboard.dashboards.project.volumes.volumes \
class DetailView(volumes_views.DetailView):
template_name = "admin/volumes/volumes/detail.html"
def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs)
table = volumes_tables.VolumesTable(self.request)
context["url"] = self.get_redirect_url()
context["actions"] = table.render_row_actions(context["volume"])
return context
def get_redirect_url(self):
return reverse('horizon:admin:volumes:index')