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 #11229: Wrong sort on compliance in tables #1717

Merged
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
17 changes: 12 additions & 5 deletions rudder-web/src/main/webapp/javascript/rudder/rudder-datatable.js
Expand Up @@ -57,6 +57,15 @@ function resortTable (tableId) {
table.draw();
}

function computeCompliancePercent (complianceArray) {
var repaired = complianceArray[3];
// Enforce N/A + Audit N/A
var na = complianceArray[1] + complianceArray[9];
// Enforce success + Audit success
var success = complianceArray[2] + complianceArray[10];
return repaired + na + success;
}

$.fn.dataTableExt.afnSortData['compliance'] = function ( oSettings, iColumn )
{
var data =
Expand All @@ -66,7 +75,7 @@ $.fn.dataTableExt.afnSortData['compliance'] = function ( oSettings, iColumn )
, function (elem, index) {
if (elem.id in ruleCompliances) {
var compliance = ruleCompliances[elem.id];
return compliance[0] + compliance[1] + compliance[2]
return computeCompliancePercent(compliance)
}
return -1;
}
Expand All @@ -84,7 +93,7 @@ $.fn.dataTableExt.afnSortData['node-compliance'] = function ( oSettings, iColumn
, function (elem, index) {
if (elem.id in nodeCompliances) {
var compliance = nodeCompliances[elem.id];
return compliance[0] + compliance[1] + compliance[2]
return computeCompliancePercent(compliance)
}
return -1;
}
Expand Down Expand Up @@ -1466,9 +1475,7 @@ function buildComplianceBar(compliance, minPxSize) {
var auditError = compliance[12];
var badPolicyMode = compliance[13];

var notApplicable = enforceNotApplicable + auditNotApplicable;
var success = enforceSuccess + compliant;
var okStatus = success + repaired + notApplicable;
var okStatus = computeCompliancePercent(compliance)
var unexpected = missing + unknown + badPolicyMode;
var error = enforceError + auditError;

Expand Down