Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8773: n/a is counted both separately and in succes in compliance display #1149

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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