From 111796a56b0285baa3a3e02b0e05951090fad13a Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Mon, 29 Jul 2024 17:13:19 +0300 Subject: [PATCH] fix: do not divide by 0 on the machine stats page If the number of registered machines is 0 just return 0 capacity. Signed-off-by: Artem Chernyshev --- frontend/src/views/omni/Machines/Machines.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/views/omni/Machines/Machines.vue b/frontend/src/views/omni/Machines/Machines.vue index 267a7165..990e20f1 100644 --- a/frontend/src/views/omni/Machines/Machines.vue +++ b/frontend/src/views/omni/Machines/Machines.vue @@ -76,6 +76,10 @@ const watchOpts = computed(() => { const getCapacity = (item: Resource) => { const registered = item?.spec.registered_machines_count ?? 0; + if (registered == 0) { + return 0; + } + const allocated = item?.spec.allocated_machines_count ?? 0; const free = registered - allocated;