Skip to content

Commit

Permalink
fix(RemediationsButton): RHICOMPL-1460 - Pass proper OS version for rule
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed Feb 25, 2021
1 parent 6a6e2f5 commit b9b94b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 6 additions & 2 deletions packages/inventory-compliance/src/Compliance/Compliance.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ query System($systemId: String!){
score
supported
ssgVersion
majorOsVersion
policy {
id
}
Expand All @@ -54,10 +55,13 @@ const SystemQuery = ({ data: { system }, loading, hidePassed }) => (
<SystemPolicyCards policies={ system?.testResultProfiles } loading={ loading } />
<br/>
<SystemRulesTable hidePassed={ hidePassed }
system={ system }
system={ {
...system,
supported: ((system?.testResultProfiles || []).filter((profile) => (profile.supported)).length > 0)
} }
columns={ columns }
profileRules={ system?.testResultProfiles.map(profile => ({
system: system.id,
system,
profile,
rules: profile.rules
})) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { addNotification } from '@redhat-cloud-services/frontend-components-noti
import { AnsibeTowerIcon } from '@patternfly/react-icons';

class ComplianceRemediationButton extends React.Component {
formatRule = ({ title, refId }, profile, system) => ({
id: `ssg:rhel7|${profile.split('xccdf_org.ssgproject.')[1]}|${refId}`,
formatRule = ({ title, refId }, profile, system, majorOsVersion) => ({
id: `ssg:rhel${majorOsVersion}|${profile.split('xccdf_org.ssgproject.')[1]}|${refId}`,
description: title,
systems: [
system
Expand All @@ -34,9 +34,12 @@ class ComplianceRemediationButton extends React.Component {
rule.remediationAvailable &&
this.ruleProfile(rule, system).supported &&
rule.compliant === false
)).map(
rule => this.formatRule(rule, this.ruleProfile(rule, system).refId, system.id)
);
)).map((rule) => {
const profile = this.ruleProfile(rule, system);
return this.formatRule(
rule, profile.refId, system.id, profile.majorOsVersion
);
});
}

dataProvider = () => {
Expand Down

0 comments on commit b9b94b3

Please sign in to comment.