Correct Admin Instances actions to reference Admin ones

Currently "Console" and "View Log" actions are referencing the Project
version of these pages instead of the Admin version.

i.e. "Console" action redirects to Project > Instances > Detail page

Additionally, the Admin instance detail page is using the collection
of actions from the Project instance table.

This change corrects these references to redirect to the detail page
under the Admin panel group; updates the Admin detail page to use the
collection of actions from the Admin instance table.

Change-Id: I7043d8283c4f3a85e52b360a790aa3487b9a4ff7
Closes-Bug: 1421318
This commit is contained in:
Alan Fung 2015-03-18 11:23:48 -07:00
parent d94e37330c
commit 6ed0c7c09f
3 changed files with 19 additions and 4 deletions

View File

@ -30,6 +30,14 @@ class AdminEditInstance(project_tables.EditInstance):
url = "horizon:admin:instances:update"
class AdminConsoleLink(project_tables.ConsoleLink):
url = "horizon:admin:instances:detail"
class AdminLogLink(project_tables.LogLink):
url = "horizon:admin:instances:detail"
class MigrateInstance(policy.PolicyTargetMixin, tables.BatchAction):
name = "migrate"
classes = ("btn-migrate", "btn-danger")
@ -169,8 +177,8 @@ class AdminInstancesTable(tables.DataTable):
row_actions = (project_tables.ConfirmResize,
project_tables.RevertResize,
AdminEditInstance,
project_tables.ConsoleLink,
project_tables.LogLink,
AdminConsoleLink,
AdminLogLink,
project_tables.CreateSnapshot,
project_tables.TogglePause,
project_tables.ToggleSuspend,

View File

@ -193,3 +193,7 @@ class LiveMigrateView(forms.ModalFormView):
class DetailView(views.DetailView):
redirect_url = 'horizon:admin:instances:index'
def _get_actions(self, instance):
table = project_tables.AdminInstancesTable(self.request)
return table.render_row_actions(instance)

View File

@ -297,11 +297,14 @@ class DetailView(tabs.TabView):
context = super(DetailView, self).get_context_data(**kwargs)
instance = self.get_data()
context["instance"] = instance
table = project_tables.InstancesTable(self.request)
context["url"] = reverse(self.redirect_url)
context["actions"] = table.render_row_actions(instance)
context["actions"] = self._get_actions(instance)
return context
def _get_actions(self, instance):
table = project_tables.InstancesTable(self.request)
return table.render_row_actions(instance)
@memoized.memoized_method
def get_data(self):
instance_id = self.kwargs['instance_id']