Replace table row 'status_unknown' class with 'warning' class

The default bootstrap styling for table rows uses the same classes as
alerts (warning, danger etc). Rather than layering additional logic
around this with a new class, we should just fall back to the documented
boostrap method.

Also resets the warning colour to its default bootstrap variable, rather
than carrying an altered version.

Change-Id: I3472244fcbbd121a8de48d78084554760dab6385
Closes-Bug: 1615632
This commit is contained in:
Rob Cresswell 2016-08-22 14:17:13 +01:00
parent 526e34839d
commit 041af0fd0a
10 changed files with 14 additions and 32 deletions

View File

@ -40,7 +40,7 @@
* @param {function=} resultHandler function that is called with return value
* from a clicked actions perform function passed into `actions` directive (optional)
* @param {function=} itemInTransitionFunction function that is called with each item in
* the table. If it returns true, the row is given the class "status_unknown" which by
* the table. If it returns true, the row is given the class "warning" which by
* default highlights the row with a warning color.
*
* @description

View File

@ -75,7 +75,7 @@
"</hz-dynamic-table>")($scope);
$scope.$digest();
// 3 items in table, only one with ID that will return true from itemInTransitionFunc
expect(element.find("tr.status_unknown").length).toBe(1);
expect(element.find("tr.warning").length).toBe(1);
});
});

View File

@ -53,7 +53,7 @@
-->
<tr ng-repeat-start="item in items track by item[config.trackId]"
ng-class="{'st-selected': checked[item[config.trackId]],
'status_unknown': itemInTransitionFunction(item)}">
'warning': itemInTransitionFunction(item)}">
<td ng-show="config.selectAll" class="multi_select_column">
<div class="themable-checkbox">

View File

@ -158,10 +158,6 @@ $em-per-priority: floor($table-col-avg-width / $font-size-base) * 3;
+ .detail-row > td {
background-color: $table-bg-accent;
}
&.status_unknown td {
background-color: lighten($brand-warning, 10%);
}
}
&,
@ -174,11 +170,6 @@ $em-per-priority: floor($table-col-avg-width / $font-size-base) * 3;
+ tr.detail-row td {
background-color: transparent;
}
&.status_unknown td {
background-color: lighten($brand-warning, 6%);
}
}
}
}

View File

@ -1,7 +1,7 @@
/* Namespace for core functionality related to DataTables. */
horizon.datatables = {
update: function () {
var $rows_to_update = $('tr.status_unknown.ajax-update');
var $rows_to_update = $('tr.warning.ajax-update');
var $table = $rows_to_update.closest('table');
var interval = $rows_to_update.attr('data-update-interval');
var decay_constant = $table.attr('decay_constant');
@ -63,7 +63,7 @@ horizon.datatables = {
success: function (data) {
var $new_row = $(data);
if ($new_row.hasClass('status_unknown')) {
if ($new_row.hasClass('warning')) {
var $container = $(document.createElement('div'))
.addClass('progress-text horizon-loading-bar');
@ -82,7 +82,7 @@ horizon.datatables = {
.addClass('fa fa-question-circle progress-bar-text')
.appendTo($container);
}
$new_row.find("td.status_unknown:last").prepend($container);
$new_row.find("td.warning:last").prepend($container);
}
// Only replace row if the html content has changed

View File

@ -797,7 +797,7 @@ class Cell(html.HTMLElement):
elif status is False:
return "status_down"
else:
return "status_unknown"
return "warning"
def get_default_classes(self):
"""Returns a flattened string of the cell's CSS classes."""
@ -1790,7 +1790,7 @@ class DataTable(object):
elif status is False:
return "status_down"
else:
return "status_unknown"
return "warning"
def get_columns(self):
"""Returns this table's columns including auto-generated ones."""

View File

@ -591,7 +591,7 @@ class DataTableTests(test.TestCase):
row.cells['id'].get_status_class(cell_status))
cell_status = row3.cells['id'].status
self.assertIsNone(cell_status)
self.assertEqual('status_unknown',
self.assertEqual('warning',
row.cells['id'].get_status_class(cell_status))
# Ensure data is not cached on the column across table instances

View File

@ -116,19 +116,11 @@
td {
background-color: $table-bg-odd;
}
&.status_unknown td {
background-color: lighten($brand-warning, 6%);
}
}
tr.even {
td {
background-color: inherit;
}
&.status_unknown td {
background-color: lighten($brand-warning, 10%);
}
}
// Hover stuffs!
@ -137,11 +129,6 @@
tr:hover th {
background-color: $table-bg-hover;
}
tr.odd.status_unknown:hover td,
tr.even.status_unknown:hover td {
background-color: lighten($brand-warning, 6%);
}
}
// Force Table Fixed

View File

@ -24,7 +24,7 @@ $gray-lighter: lighten(#000, 93.5%) !default; // #eee
$brand-primary: #428bca !default;
$brand-success: #5cb85c !default;
$brand-info: #5bc0de !default;
$brand-warning: #fdd835 !default;
$brand-warning: #f0ad4e !default;
$brand-danger: #d9534f !default;

View File

@ -0,0 +1,4 @@
---
upgrade:
- The ``status_unknown`` table row class has been replaced with
the default bootstrap ``warning`` class.