Skip to content

Commit

Permalink
Fix bug where a manually added node breaks the node list page
Browse files Browse the repository at this point in the history
  • Loading branch information
ly5156 committed Jan 13, 2025
1 parent 3f2651f commit 7524b64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion shell/components/formatter/PercentageBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
</script>

<template>
<p v-if="!value || value === '0'">
<p v-if="!value || value === '0' || isNaN(value)">
{{ t('generic.na') }}
</p>
<PercentageBarComponent
Expand Down
8 changes: 4 additions & 4 deletions shell/models/cluster/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default class ClusterNode extends SteveModel {
}

get cpuCapacity() {
return parseSi(this.status.allocatable.cpu);
return parseSi(this.status.allocatable?.cpu);
}

get cpuUsagePercentage() {
Expand All @@ -233,7 +233,7 @@ export default class ClusterNode extends SteveModel {
}

get ramCapacity() {
return parseSi(this.status.capacity.memory);
return parseSi(this.status.capacity?.memory);
}

get ramAllocatable() {
Expand All @@ -253,7 +253,7 @@ export default class ClusterNode extends SteveModel {
}

get podUsage() {
return calculatePercentage(this.status.allocatable.pods, this.status.capacity.pods);
return calculatePercentage(this.status.allocatable?.pods, this.status.capacity?.pods);
}

get podReservationUsage() {
Expand All @@ -269,7 +269,7 @@ export default class ClusterNode extends SteveModel {
}

get podCapacity() {
return Number.parseInt(this.status.capacity.pods);
return Number.parseInt(this.status.capacity?.pods);
}

get podConsumed() {
Expand Down

0 comments on commit 7524b64

Please sign in to comment.