feat(#5316): add collapsible health details with localStorage persistence#5364
feat(#5316): add collapsible health details with localStorage persistence#5364SteKoe wants to merge 7 commits into
Conversation
736495f to
4d4f64a
Compare
…handling for health details
- Remove redundant onMounted (isCollapsed already initialised synchronously) - Guard toggleCollapsed: skip localStorage write when instance.id is absent - Introduce safeNameId for HTML id attributes and aria-controls (names with spaces/colons/slashes produced invalid ids) - Guard encodeURIComponent(name ?? '') against null/undefined name - Fix duplicate child :key to include loop index, preventing wrong instance reuse - Guard v-else-if object branch with !== null to handle null detail values - Fix sba-icon-button PropType to [Object, Array, String] so string icon names pass Vue runtime validation
…n, extract safeDetailId - details v-for :key now includes loop index to handle duplicate detail names - health.details || health.components replaced with ?? and validated as plain object, eliminating false fallthrough on falsy health.details values and both sources being shared via a single healthEntries computed - Inline detail.name.replace() repeated three times replaced with safeDetailId(name, idx) helper that also falls back to 'detail_N' when all characters are special
…t row alternation The Instance node always received index=0, and each health group node also defaulted to index=0, so all top-level rows rendered with the same bg-white background. Now the Instance node is explicitly :index="0" and each group node receives :index="groupIdx + 1", producing correct even/odd alternation across all sibling health-details rows.
… 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.
4d4f64a to
7e880bd
Compare
|
Nice @SteKoe. Just one question: is there a reason why the icon is green when the details are expanded? Will its color reflect that status (even if, then, it's clearly visible it's not the same green) or what's the idea behind its coloring scheme? I find that green a bit confusing without additional context. |
| :name="child.name" | ||
| :health="child.value" | ||
| /> | ||
| <template v-if="depth < 10"> |
There was a problem hiding this comment.
I wouldn't really do this as it may prevent consumers of SBA to have a look at the details completely, unless there is a way for the consumers to configure such a limit (i.e.: sort of a settings page).
|
|
||
| const COLLAPSED_KEY = computed( | ||
| () => | ||
| `de.codecentric.spring-boot-admin.health-details.${encodeURIComponent(name ?? '')}.${encodeURIComponent(instance?.id ?? '')}.collapsed`, |
There was a problem hiding this comment.
The name property is not declared as optional, so is this '' default really necessary?
| `de.codecentric.spring-boot-admin.health-details.${encodeURIComponent(name ?? '')}.${encodeURIComponent(instance?.id ?? '')}.collapsed`, | ||
| ); | ||
|
|
||
| function readCollapsedFromStorage(): boolean { |
There was a problem hiding this comment.
For backwards compatibility, the default value should be false here.
Otherwise, at least in terms of UX, you're introducing a breaking change here :)
This pull request improves the
HealthDetailscomponent by adding a collapsible details section for health information, enhancing accessibility, and ensuring the collapsed state is persisted per instance. It also updates tests to cover the new behavior and adds internationalized strings for the toggle button in multiple languages.HealthDetails Component Enhancements:
localStorageper instance and health group. [1] [2]instanceprop to childhealth-detailscomponents. [1] [2] [3] [4]Testing Improvements:
localStorage, and correct handling of child health components. [1] [2] [3] [4]Internationalization:
toggle_detailsstring for the health details toggle button in all supported languages. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Bildschirmaufnahme.2026-05-15.um.21.37.36.mov