Skip to content

Commit

Permalink
Merge pull request #1035 from yaacov/invalidate-sum-of-ocp-vm-resources
Browse files Browse the repository at this point in the history
🐞  If one item missing invalidate sum of resources
  • Loading branch information
yaacov authored Mar 27, 2024
2 parents 8128898 + b794577 commit 1f176a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const OpenshiftPlanResources: React.FC<{ planInventory: OpenshiftVM[] }>
{ cpuCount: 0, memoryMB: 0 },
);

const missingCPUInfo = planInventory.find(({ object }) => getK8sCPU(object) === '0');
const missingMemoryInfo = planInventory.find(({ object }) => getK8sVMMemory(object) === '0Mi');

return (
<PageSection variant="light">
<SectionHeading text={t('Calculated resources')} />
Expand All @@ -56,15 +59,15 @@ export const OpenshiftPlanResources: React.FC<{ planInventory: OpenshiftVM[] }>
<Th width={10}>
<strong>{t('Total CPU count:')}</strong>
</Th>
<Td width={10}>{totalResources.cpuCount || '-'} Cores</Td>
<Td width={10}>{totalResourcesRunning.cpuCount || '-'} Cores</Td>
<Td width={10}>{missingCPUInfo ? '-' : `${totalResources.cpuCount} Cores`}</Td>
<Td width={10}>{missingCPUInfo ? '-' : `${totalResourcesRunning.cpuCount} Cores`}</Td>
</Tr>
<Tr>
<Th width={10}>
<strong>{t('Total memory:')}</strong>
</Th>
<Td width={10}>{totalResources.memoryMB || '-'} MB</Td>
<Td width={10}>{totalResourcesRunning.memoryMB || '-'} MB</Td>
<Td width={10}>{missingMemoryInfo ? '-' : `${totalResources.memoryMB} MB`}</Td>
<Td width={10}>{missingMemoryInfo ? '-' : `${totalResourcesRunning.memoryMB} MB`}</Td>
</Tr>
</Tbody>
</TableComposable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export const OpenstackPlanResources: React.FC<{ planInventory: OpenstackVM[] }>
<Th width={10}>
<strong>{t('Total CPU count:')}</strong>
</Th>
<Td width={10}>- Cores</Td>
<Td width={10}>- Cores</Td>
<Td width={10}>-</Td>
<Td width={10}>-</Td>
</Tr>
<Tr>
<Th width={10}>
<strong>{t('Total memory:')}</strong>
</Th>
<Td width={10}>- MB</Td>
<Td width={10}>- MB</Td>
<Td width={10}>-</Td>
<Td width={10}>-</Td>
</Tr>
</Tbody>
</TableComposable>
Expand Down

0 comments on commit 1f176a0

Please sign in to comment.