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

fix: resoruces should be displayed correctly. #3590

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

dbadura
Copy link
Contributor

@dbadura dbadura commented Jan 15, 2025

Description

Changes proposed in this pull request:

  • handle nano cpus which are sent from metrics api
  • unclutter resoruces code
  • use full cpu unit in data

Related issue(s)

Definition of done

  • The PR's title starts with one of the following prefixes:
    • feat: A new feature
    • fix: A bug fix
    • docs: Documentation only changes
    • refactor: A code change that neither fixes a bug nor adds a feature
    • test: Adding tests
    • chore: Maintainance changes to the build process or auxiliary tools, libraries, workflows, etc.
  • Related issues are linked. To link internal trackers, use the issue IDs like backlog#4567
  • Explain clearly why you created the PR and what changes it introduces
  • All necessary steps are delivered, for example, tests, documentation, merging

@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 15, 2025
const coreValue = (
Math.round((+amount + Number.EPSILON) * 100) / 100
).toFixed(fixed);
if (unit !== '' && prefixMap[unit]) {
Copy link
Contributor

@KonradPietocha KonradPietocha Jan 17, 2025

Choose a reason for hiding this comment

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

Are null, undefined and 0 possible here and acceptable? If not, we can just use: "if (unit && prefixMap[unit])"

const value = (amount / prefixMap[unit]).toFixed(fixed);
return {
value: value,
string: `${value}${infix}${unit}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be better to change the names to: "value" and "valueWithUnit" or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that we can remove the whole object and return just string.

@kyma-bot kyma-bot added the lgtm Looks good to me! label Jan 20, 2025
@kyma-bot kyma-bot removed the lgtm Looks good to me! label Jan 21, 2025
@kyma-bot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@dbadura dbadura added the lgtm Looks good to me! label Jan 21, 2025
@kyma-bot kyma-bot removed the lgtm Looks good to me! label Jan 21, 2025
@kyma-bot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@dbadura dbadura added the lgtm Looks good to me! label Jan 21, 2025
@dbadura dbadura merged commit 2481978 into kyma-project:main Jan 21, 2025
15 checks passed
@dbadura dbadura deleted the fix-resources-display branch January 21, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. lgtm Looks good to me! size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants