]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix Nan undefined values and add empty pipe on expand-cluster
authorPedro Gonzalez Gomez <pegonzal@redhat.com>
Thu, 18 May 2023 11:47:16 +0000 (13:47 +0200)
committerNizamudeen A <nia@redhat.com>
Fri, 26 May 2023 06:49:43 +0000 (12:19 +0530)
Fixes: https://tracker.ceph.com/issues/61207
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
(cherry picked from commit 764a1b67392f09a288a6f38d9d4f89d2a203cf57)

src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/create-cluster/create-cluster-review.component.html
src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts

index 750fef894fb9508756adb17bdd58e8236956f97e..a2ae23b2c2bf4dad8a3ee8e1a1d0d3ee576161ff 100644 (file)
         <tr>
           <td i18n
               class="bold">CPUs</td>
-          <td>{{ totalCPUs }}</td>
+          <td>{{ totalCPUs | empty }}</td>
         </tr>
         <tr>
           <td i18n
               class="bold">Memory</td>
-          <td>{{ totalMemory }}</td>
+          <td>{{ totalMemory | empty }}</td>
         </tr>
       </table>
     </fieldset>
index a4b6d427b012ff7d15900c0a325cd74a318f235c..790d78d21c19830d31180822f14c736cf880caa2 100644 (file)
@@ -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();