Skip to content

Commit

Permalink
fix: do not divide by 0 on the machine stats page
Browse files Browse the repository at this point in the history
If the number of registered machines is 0 just return 0 capacity.

Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
  • Loading branch information
Unix4ever committed Jul 29, 2024
1 parent 4ec7a43 commit 111796a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/views/omni/Machines/Machines.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const watchOpts = computed<WatchOptions>(() => {

const getCapacity = (item: Resource<MachineStatusMetricsSpec>) => {
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;

Expand Down

0 comments on commit 111796a

Please sign in to comment.