Suppress 0s in monitoring pane rows
Do not set value to 0 and do not add rows without non-zero value. Also fix javascript in template to avoid coloring 'No items to display.' With the following rules: $ openstack congress policy rule create action 'warning(x) :- blah(x)' $ openstack congress policy rule create classification 'blah(x) :- error(x)' Monitoring pane pre-patch shows rows of zero warning/error screenshot: https://imagebin.ca/v/3VXCVtZxXYUQ rows suppressed post-patch. screenshot: https://imagebin.ca/v/3VXX9g34QOGf Closes-Bug: 1708294 Change-Id: I56adc4da430e3e1e15bd31c42fe3f7bce996dcd0
This commit is contained in:
parent
791ad086ea
commit
becbd719cd
@ -98,8 +98,10 @@ def get_policy_violations_data(request):
|
|||||||
row.set_policy_details(policy)
|
row.set_policy_details(policy)
|
||||||
for t in tables:
|
for t in tables:
|
||||||
rows = congress.policy_rows_list(request, policy['name'], t)
|
rows = congress.policy_rows_list(request, policy['name'], t)
|
||||||
row.set_value(t, len(rows))
|
if len(rows) > 0:
|
||||||
violations_table.append(row)
|
row.set_value(t, len(rows))
|
||||||
|
if row.get('error') or row.get('warning'):
|
||||||
|
violations_table.append(row)
|
||||||
return violations_table
|
return violations_table
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,16 +31,18 @@
|
|||||||
{{ monitoring_table.render }}
|
{{ monitoring_table.render }}
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// color none 0 errors/warnings red/yellow
|
// color non-zero errors/warnings red/yellow
|
||||||
table_rows = document.getElementById("monitoring").childNodes[5];
|
table_rows = document.getElementById("monitoring").childNodes[5];
|
||||||
num_rows = (table_rows.childNodes.length - 1)/2;
|
num_rows = (table_rows.childNodes.length - 1)/2;
|
||||||
for (i = 0; i < num_rows; i++) {
|
for (i = 0; i < num_rows; i++) {
|
||||||
row = table_rows.childNodes[1 + 2*i];
|
row = table_rows.childNodes[1 + 2*i];
|
||||||
if (row.childNodes[1].innerHTML.trim() != "-") {
|
if (row.className != "odd empty") { // ignore the row indicating no items
|
||||||
row.childNodes[1].style.backgroundColor = "rgba(255, 0, 0, 0.5)";
|
if (row.childNodes[1].innerHTML.trim() != "-") {
|
||||||
}
|
row.childNodes[1].style.backgroundColor = "rgba(255, 0, 0, 0.5)";
|
||||||
if (row.childNodes[2].innerHTML.trim() != "-") {
|
}
|
||||||
row.childNodes[2].style.backgroundColor = "rgba(255, 255, 0, 0.5)";
|
if (row.childNodes[2].innerHTML.trim() != "-") {
|
||||||
|
row.childNodes[2].style.backgroundColor = "rgba(255, 255, 0, 0.5)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user