Skip to content

Commit b5c0c69

Browse files
committed
fix(health-details): separate depth (recursion guard) from index (row alternation)
index + 1 was passed to all siblings, giving every child the same index and therefore the same background colour. Introduced a separate 'depth' prop for the recursion guard (depth < 10) and pass ':index="idx"' to children so each sibling gets its own position-based index, producing correct even/odd alternation at every level of the health component tree.
1 parent 6d504d8 commit b5c0c69

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

spring-boot-admin-server-ui/src/main/frontend/views/instances/details/health-details.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@
9696
</dl>
9797
</dd>
9898
</dl>
99-
<template v-if="index < 10">
99+
<template v-if="depth < 10">
100100
<health-details
101101
v-for="(child, idx) in childHealth"
102102
:key="`${child.name}_${idx}`"
103103
:instance="instance"
104-
:index="index + 1"
104+
:index="idx"
105+
:depth="depth + 1"
105106
:name="child.name"
106107
:health="child.value"
107108
/>
@@ -124,12 +125,15 @@ import autolink from '@/utils/autolink';
124125
const { t } = useI18n();
125126
const id = useId();
126127
127-
const { health, name, instance, index = 0 } = defineProps<{
128+
const { health, name, instance, index = 0, depth = 0 } = defineProps<{
128129
instance: Instance;
129130
name: string;
130131
health: Record<string, any>;
132+
/** Row position within siblings — drives even/odd background alternation. */
131133
index?: number;
132-
}>();
134+
/** Recursion depth — used to prevent infinite nesting. */
135+
depth?: number;
136+
}>();
133137
134138
// Sanitised name safe for use in HTML id attributes
135139
const safeNameId = computed(() => (name ?? '').replace(/[^a-zA-Z0-9_-]/g, '_'));

0 commit comments

Comments
 (0)