Skip to content

Commit

Permalink
Merge pull request #11288 from epwinchell/openscap_results
Browse files Browse the repository at this point in the history
Update openSCAP results styling
(cherry picked from commit e61dbc4)

https://bugzilla.redhat.com/show_bug.cgi?id=1377417
  • Loading branch information
Dan Clarizio authored and chessbyte committed Oct 7, 2016
1 parent b4186e1 commit 983597f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/assets/stylesheets/patternfly_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,14 @@ table.table-hover tbody tr:nth-child(even).no-hover:hover td {

/* summary screen formatting */

table .label {display: table-cell;width: 20% !important; min-width: 200px; font: normal 12px OpenSansSemibold,Arial,Helvetica,sans-serif;cursor: default;color: #333; text-align: left;}
table .label {
display: table-cell;
width: 20% !important;
min-width: 200px;
font: normal 12px OpenSansSemibold,Arial,Helvetica,sans-serif;
cursor: default;
text-align: left;
}

table.table.table-selectable tbody tr.selected td {
background-color: $link-color;
Expand Down
28 changes: 27 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,10 @@ def view_to_hash(view)
celltext = Dictionary.gettext(row[col], :type => :model, :notfound => :titleize)
when 'approval_state'
celltext = _(PROV_STATES[row[col]])
when "result"
new_row[:cells] << {:span => result_span_class(row[col]), :text => row[col].titleize}
when "severity"
new_row[:cells] << {:span => severity_span_class(row[col]), :text => row[col].titleize}
when 'state'
celltext = row[col].titleize
when 'hardware.bitness'
Expand All @@ -937,7 +941,7 @@ def view_to_hash(view)
celltext = format_col_for_display(view, row, col, celltz || tz)
end

new_row[:cells] << {:text => celltext}
new_row[:cells] << {:text => celltext} if celltext
end

if @row_button # Show a button in the last col
Expand All @@ -951,6 +955,28 @@ def view_to_hash(view)
root
end

def result_span_class(value)
case value.downcase
when "pass"
"label label-success"
when "fail"
"label label-danger"
else
"label label-primary"
end
end

def severity_span_class(value)
case value.downcase
when "high"
"label label-danger"
when "medium"
"label label-warning"
else
"label label-primary"
end
end

def calculate_pct_img(val)
val == 100 ? 20 : ((val + 2) / 5.25).round # val is the percentage value of free space
end
Expand Down
3 changes: 3 additions & 0 deletions app/views/layouts/_list_grid.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
:title => cell[:title],
:alt => cell[:title]}
= cell[:text]
- elsif cell[:span]
%span{:class => "#{cell[:span]}"}
= cell[:text]
- else
- if cell[:icon]
%i{:class => cell[:icon], :title => cell[:title]}
Expand Down

0 comments on commit 983597f

Please sign in to comment.