diff --git a/horizon/browsers/base.py b/horizon/browsers/base.py index 802b63536..30a7b1514 100644 --- a/horizon/browsers/base.py +++ b/horizon/browsers/base.py @@ -127,12 +127,14 @@ class ResourceBrowser(html.HTMLElement): """ self.navigation_table = tables[self.navigation_table_class._meta.name] self.content_table = tables[self.content_table_class._meta.name] - if self.has_breadcrumb: - self.prepare_breadcrumb(tables) - - def prepare_breadcrumb(self, tables): navigation_item = self.kwargs.get(self.navigation_kwarg_name) content_path = self.kwargs.get(self.content_kwarg_name) + # Tells the navigation table what is selected. + self.navigation_table.current_item_id = navigation_item + if self.has_breadcrumb: + self.prepare_breadcrumb(tables, navigation_item, content_path) + + def prepare_breadcrumb(self, tables, navigation_item, content_path): if self.has_breadcrumb and navigation_item and content_path: for table in tables.values(): table.breadcrumb = Breadcrumb(self.request, diff --git a/horizon/tables/base.py b/horizon/tables/base.py index 126af4f1b..600d797c1 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -407,6 +407,7 @@ class Row(html.HTMLElement): super(Row, self).__init__() self.table = table self.datum = datum + self.selected = False if self.datum: self.load_cells() else: @@ -882,6 +883,7 @@ class DataTable(object): self._needs_form_wrapper = needs_form_wrapper self._no_data_message = self._meta.no_data_message self.breadcrumb = None + self.current_item_id = None # Create a new set columns = [] @@ -1292,7 +1294,11 @@ class DataTable(object): rows = [] try: for datum in self.filtered_data: - rows.append(self._meta.row_class(self, datum)) + row = self._meta.row_class(self, datum) + if self.get_object_id(datum) == self.current_item_id: + self.selected = True + row.classes.append('current_selected') + rows.append(row) except: # Exceptions can be swallowed at the template level here, # re-raising as a TemplateSyntaxError makes them visible. diff --git a/openstack_dashboard/static/dashboard/less/horizon.less b/openstack_dashboard/static/dashboard/less/horizon.less index 7f7225ce3..9abdbf270 100644 --- a/openstack_dashboard/static/dashboard/less/horizon.less +++ b/openstack_dashboard/static/dashboard/less/horizon.less @@ -1452,6 +1452,9 @@ label.log-length { max-width: 200px; } } + tr.current_selected td { + background-color: #E9F5FA; + } tfoot td { border-right: 0 none; border-bottom-right-radius: 0; @@ -1464,6 +1467,7 @@ label.log-length { white-space: nowrap; } tbody td { + border-right: @dataTableBorderWidth solid @dataTableBorderColor; background-color: @white; } } @@ -1475,6 +1479,7 @@ label.log-length { border-top-left-radius: 0; } td{ + border-bottom: @dataTableBorderWidth solid @dataTableBorderColor; &:last-child { border-right: 0 none; }