1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 22:39:41 +02:00

refactor(containers): migrate resources tab to react [EE-5214] (#10355)

This commit is contained in:
Chaim Lev-Ari 2023-09-24 15:31:06 +03:00 committed by GitHub
parent ec091efe3b
commit ffac83864d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 1114 additions and 537 deletions

View file

@ -0,0 +1,36 @@
export function toConfigMemory(value: number): number {
if (value < 0) {
return 0;
}
return round(Math.round(value * 8) / 8, 3) * 1024 * 1024;
}
export function toViewModelMemory(value = 0): number {
if (value < 0) {
return 0;
}
return value / 1024 / 1024;
}
function round(value: number, decimals: number) {
const tenth = 10 ** decimals;
return Math.round((value + Number.EPSILON) * tenth) / tenth;
}
export function toViewModelCpu(value = 0) {
if (value < 0) {
return 0;
}
return value / 1000000000;
}
export function toConfigCpu(value: number) {
if (value < 0) {
return 0;
}
return value * 1000000000;
}