From 3524be227158f05f406679d409862832f68c7a87 Mon Sep 17 00:00:00 2001 From: Pedro Gonzalez Gomez Date: Thu, 18 May 2023 13:47:16 +0200 Subject: [PATCH] mgr/dashboard: fix Nan undefined values and add empty pipe on expand-cluster Fixes: https://tracker.ceph.com/issues/61207 Signed-off-by: Pedro Gonzalez Gomez (cherry picked from commit 764a1b67392f09a288a6f38d9d4f89d2a203cf57) --- .../create-cluster/create-cluster-review.component.html | 4 ++-- .../frontend/src/app/shared/services/formatter.service.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html index 750fef894fb..a2ae23b2c2b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html @@ -29,12 +29,12 @@ CPUs - {{ totalCPUs }} + {{ totalCPUs | empty }} Memory - {{ totalMemory }} + {{ totalMemory | empty }} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts index a4b6d427b01..790d78d21c1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts @@ -13,6 +13,9 @@ export class FormatterService { if (!_.isNumber(n)) { return '-'; } + if (_.isNaN(n)) { + return 'N/A'; + } let unit = n < 1 ? 0 : Math.floor(Math.log(n) / Math.log(divisor)); unit = unit >= units.length ? units.length - 1 : unit; let result = _.round(n / Math.pow(divisor, unit), decimals).toString(); -- 2.39.5