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 #36736 - Correct memory fact on HW properties card #10737

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Text,
TextVariants,
} from '@patternfly/react-core';
import { number_to_human_size as NumberToHumanSize } from 'number_helpers';
import CardTemplate from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';
import { TranslatedPlural } from '../../../Table/components/TranslatedPlural';
import { hostIsNotRegistered } from '../hostDetailsHelpers';
Expand Down Expand Up @@ -43,7 +44,7 @@ const HwPropertiesCard = ({ isExpandedGlobal, hostDetails }) => {
const coreSocket = facts?.['cpu::core(s)_per_socket'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is reportedFacts?.cores. I can't comment on it, but above there's also reportedFacts?.sockets

const reportedFacts = propsToCamelCase(hostDetails?.reported_data || {});
const totalDisks = reportedFacts?.disksTotal;
const memory = facts?.['dmi::memory::maximum_capacity'];
const memory = facts?.['memory::memtotal'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this as a reported fact called ram.

Suggested change
const memory = facts?.['memory::memtotal'];
const memory = reportedFacts?.ram;


return (
<CardTemplate
Expand Down Expand Up @@ -71,7 +72,9 @@ const HwPropertiesCard = ({ isExpandedGlobal, hostDetails }) => {
</DescriptionListGroup>
<DescriptionListGroup>
<DescriptionListTerm>{__('RAM')}</DescriptionListTerm>
<DescriptionListDescription>{memory}</DescriptionListDescription>
<DescriptionListDescription>{NumberToHumanSize(memory*1024, {
strip_insignificant_zeros: true, precision: 2
})}</DescriptionListDescription>
</DescriptionListGroup>
<DescriptionListGroup>
<HostDisks totalDisks={totalDisks} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this on the screenshot. This value is the total number of bytes of all disks combined, not the number of disks.

Copy link
Member Author

@chris1984 chris1984 Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have that fixed in a separate pr

#10750

Expand All @@ -89,7 +92,7 @@ HwPropertiesCard.propTypes = {
cpuCount: PropTypes.number,
cpuSockets: PropTypes.number,
coreSocket: PropTypes.number,
memory: PropTypes.string,
memory: PropTypes.number,
}),
reported_data: PropTypes.shape({
totalDisks: PropTypes.number,
Expand Down