Instance log and console actions now go to detail tabs.
Fixes bug 969630. Change-Id: I28a591e5f765300f6a0bca021ef1fa802d277336
This commit is contained in:
parent
47f44598c8
commit
ca5ea82ed0
@ -24,6 +24,8 @@ from horizon import api
|
|||||||
from horizon import tables
|
from horizon import tables
|
||||||
from horizon.templatetags import sizeformat
|
from horizon.templatetags import sizeformat
|
||||||
|
|
||||||
|
from .tabs import InstanceDetailTabs, LogTab, VNCTab
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -158,22 +160,32 @@ class SnapshotLink(tables.LinkAction):
|
|||||||
class ConsoleLink(tables.LinkAction):
|
class ConsoleLink(tables.LinkAction):
|
||||||
name = "console"
|
name = "console"
|
||||||
verbose_name = _("VNC Console")
|
verbose_name = _("VNC Console")
|
||||||
url = "horizon:nova:instances_and_volumes:instances:vnc"
|
url = "horizon:nova:instances_and_volumes:instances:detail"
|
||||||
classes = ("btn-console",)
|
classes = ("btn-console",)
|
||||||
|
|
||||||
def allowed(self, request, instance=None):
|
def allowed(self, request, instance=None):
|
||||||
return instance.status in ACTIVE_STATES
|
return instance.status in ACTIVE_STATES
|
||||||
|
|
||||||
|
def get_link_url(self, datum):
|
||||||
|
base_url = super(ConsoleLink, self).get_link_url(datum)
|
||||||
|
tab_query_string = VNCTab(InstanceDetailTabs).get_query_string()
|
||||||
|
return "?".join([base_url, tab_query_string])
|
||||||
|
|
||||||
|
|
||||||
class LogLink(tables.LinkAction):
|
class LogLink(tables.LinkAction):
|
||||||
name = "log"
|
name = "log"
|
||||||
verbose_name = _("View Log")
|
verbose_name = _("View Log")
|
||||||
url = "horizon:nova:instances_and_volumes:instances:console"
|
url = "horizon:nova:instances_and_volumes:instances:detail"
|
||||||
classes = ("btn-log",)
|
classes = ("btn-log",)
|
||||||
|
|
||||||
def allowed(self, request, instance=None):
|
def allowed(self, request, instance=None):
|
||||||
return instance.status in ACTIVE_STATES
|
return instance.status in ACTIVE_STATES
|
||||||
|
|
||||||
|
def get_link_url(self, datum):
|
||||||
|
base_url = super(LogLink, self).get_link_url(datum)
|
||||||
|
tab_query_string = LogTab(InstanceDetailTabs).get_query_string()
|
||||||
|
return "?".join([base_url, tab_query_string])
|
||||||
|
|
||||||
|
|
||||||
class UpdateRow(tables.Row):
|
class UpdateRow(tables.Row):
|
||||||
ajax = True
|
ajax = True
|
||||||
|
@ -247,7 +247,7 @@ class Tab(html.HTMLElement):
|
|||||||
preload = True
|
preload = True
|
||||||
_active = None
|
_active = None
|
||||||
|
|
||||||
def __init__(self, tab_group, request):
|
def __init__(self, tab_group, request=None):
|
||||||
super(Tab, self).__init__()
|
super(Tab, self).__init__()
|
||||||
# Priority: constructor, class-defined, fallback
|
# Priority: constructor, class-defined, fallback
|
||||||
if not self.name:
|
if not self.name:
|
||||||
@ -255,10 +255,11 @@ class Tab(html.HTMLElement):
|
|||||||
self.name = unicode(self.name) # Force unicode.
|
self.name = unicode(self.name) # Force unicode.
|
||||||
if not self.slug:
|
if not self.slug:
|
||||||
raise ValueError("%s must have a slug." % self.__class__.__name__)
|
raise ValueError("%s must have a slug." % self.__class__.__name__)
|
||||||
self.request = request
|
|
||||||
self.tab_group = tab_group
|
self.tab_group = tab_group
|
||||||
self._allowed = self.allowed(request)
|
self.request = request
|
||||||
self._enabled = self.enabled(request)
|
if request:
|
||||||
|
self._allowed = self.allowed(request)
|
||||||
|
self._enabled = self.enabled(request)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s: %s>" % (self.__class__.__name__, self.slug)
|
return "<%s: %s>" % (self.__class__.__name__, self.slug)
|
||||||
@ -314,6 +315,9 @@ class Tab(html.HTMLElement):
|
|||||||
"""
|
"""
|
||||||
return SEPARATOR.join([self.tab_group.slug, self.slug])
|
return SEPARATOR.join([self.tab_group.slug, self.slug])
|
||||||
|
|
||||||
|
def get_query_string(self):
|
||||||
|
return "=".join((self.tab_group.param_name, self.get_id()))
|
||||||
|
|
||||||
def get_default_classes(self):
|
def get_default_classes(self):
|
||||||
"""
|
"""
|
||||||
Returns a list of the default classes for the tab. Defaults to
|
Returns a list of the default classes for the tab. Defaults to
|
||||||
|
Loading…
Reference in New Issue
Block a user