Skip to content

Commit

Permalink
Fixes #8773: n/a is counted both separately and in succes in complian…
Browse files Browse the repository at this point in the history
…ce display
  • Loading branch information
VinceMacBuche committed Jul 28, 2016
1 parent 70807b4 commit c850092
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class ReportDisplayer(
AnonFunc(ajaxCall)
}


private[this] def displayIntro(report: NodeStatusReport): NodeSeq = {

def explainCompliance(info: RunAndConfigInfo): NodeSeq = {
Expand Down Expand Up @@ -261,7 +260,6 @@ class ReportDisplayer(
}
}


<div class="tw-bs">
<div id="node-compliance-intro" class={background}>
<p>{explainCompliance(report.runInfo)}</p>{
Expand All @@ -270,7 +268,6 @@ class ReportDisplayer(
</div>
}


private[this] def displayReports(node : NodeInfo) : NodeSeq = {
val boxXml = (
for {
Expand All @@ -288,10 +285,9 @@ class ReportDisplayer(
* And if don't even have expected configuration, don't display anything.
*/


report.runInfo match {
case NoRunNoExpectedReport | _:NoExpectedReport =>
bind("lastReportGrid", reportByNodeTemplate
bind("lastreportgrid", reportByNodeTemplate
, "intro" -> intro
, "grid" -> NodeSeq.Empty
, "missing" -> NodeSeq.Empty
Expand All @@ -316,7 +312,7 @@ class ReportDisplayer(
)
} )

bind("lastReportGrid", reportByNodeTemplate
bind("lastreportgrid", reportByNodeTemplate
, "intro" -> intro
, "grid" -> showReportDetail(filtered, node, withCompliance = false)
, "missing" -> NodeSeq.Empty
Expand All @@ -328,7 +324,7 @@ class ReportDisplayer(
val missing = getComponents(MissingReportType , report, directiveLib).toSet
val unexpected = getComponents(UnexpectedReportType, report, directiveLib).toSet

bind("lastReportGrid", reportByNodeTemplate
bind("lastreportgrid", reportByNodeTemplate
, "intro" -> intro
, "grid" -> showReportDetail(report, node, withCompliance = true)
, "missing" -> showMissingReports(missing)
Expand All @@ -340,7 +336,6 @@ class ReportDisplayer(

boxXml match {
case e:EmptyBox =>

logger.error(e)
<div class="error">Could not fetch reports information</div>
case Full(xml) => xml
Expand Down
33 changes: 15 additions & 18 deletions rudder-web/src/main/webapp/javascript/rudder/rudder-datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1394,20 +1394,14 @@ function buildComplianceBar(compliance, minPxSize) {
var unexpected = missing + unknown;

var widthArr = getWidthProgressBar([
/*0*/ notApplicable
, /*1*/ okStatus
, /*2*/ pending
, /*3*/ noreport
, /*4*/ unexpected
, /*5*/ error
, /*6*/ reportsDisabled
/*0*/ okStatus
, /*1*/ pending
, /*2*/ noreport
, /*3*/ unexpected
, /*4*/ error
, /*5*/ reportsDisabled
], minPxSize);

if(notApplicable != 0) {
var value = compliancePercentValue(notApplicable);
content.append('<div class="progress-bar progress-bar-notapplicable" style=" width:'+widthArr[0]+'" title="Not applicable: '+notApplicable+'%">'+value+'%</div>');
}

if(okStatus != 0) {
var text = []
if (success != 0) {
Expand All @@ -1416,18 +1410,21 @@ function buildComplianceBar(compliance, minPxSize) {
if (repaired != 0) {
text.push("Repaired: "+repaired+"%");
}
if (notApplicable != 0) {
text.push("Not applicable: "+notApplicable+"%");
}
var value = compliancePercentValue(okStatus);
content.append('<div class="progress-bar progress-bar-success" style="width:'+widthArr[1]+'" title="'+text.join("\n")+'">'+value+'%</div>');
content.append('<div class="progress-bar progress-bar-success" style="width:'+widthArr[0]+'" title="'+text.join("\n")+'">'+value+'%</div>');
}

if(pending != 0) {
var value = compliancePercentValue(pending);
content.append('<div class="progress-bar progress-bar-pending active progress-bar-striped" style="width:'+widthArr[2]+'" title="Applying: '+pending+'%">'+value+'%</div>');
content.append('<div class="progress-bar progress-bar-pending active progress-bar-striped" style="width:'+widthArr[1]+'" title="Applying: '+pending+'%">'+value+'%</div>');
}

if(noreport != 0) {
var value = compliancePercentValue(noreport);
content.append('<div class="progress-bar progress-bar-no-report" style=" width:'+widthArr[3]+'" title="No report: '+noreport+'%">'+value+'%</div>');
content.append('<div class="progress-bar progress-bar-no-report" style=" width:'+widthArr[2]+'" title="No report: '+noreport+'%">'+value+'%</div>');
}

if(unexpected != 0) {
Expand All @@ -1439,17 +1436,17 @@ function buildComplianceBar(compliance, minPxSize) {
text.push("Unknown reports: "+unknown+"%");
}
var value = compliancePercentValue(unexpected);
content.append('<div class="progress-bar progress-bar-unknown" style="width:'+widthArr[4]+'" title="'+text.join("\n")+'">'+value+'%</div>');
content.append('<div class="progress-bar progress-bar-unknown" style="width:'+widthArr[3]+'" title="'+text.join("\n")+'">'+value+'%</div>');
}

if(error != 0) {
var value = compliancePercentValue(error);
content.append('<div class="progress-bar progress-bar-error" style="width:'+widthArr[5]+'" title="Error: '+error+'%">'+value+'%</div>');
content.append('<div class="progress-bar progress-bar-error" style="width:'+widthArr[4]+'" title="Error: '+error+'%">'+value+'%</div>');
}

if(reportsDisabled != 0) {
var value = compliancePercentValue(reportsDisabled);
content.append('<div class="progress-bar progress-bar-reportsdisabled" style="width:'+widthArr[6]+'%" title="Reports Disabled: '+reportsDisabled+'%">'+value+'%</div>')
content.append('<div class="progress-bar progress-bar-reportsdisabled" style="width:'+widthArr[5]+'%" title="Reports Disabled: '+reportsDisabled+'%">'+value+'%</div>')
}

return content
Expand Down

0 comments on commit c850092

Please sign in to comment.