|
16 | 16 |
|
17 | 17 | <template> |
18 | 18 | <dl |
19 | | - class="px-4 py-3" |
20 | | - :class="{ 'bg-white': index % 2 === 0, 'bg-gray-100': index % 2 !== 0 }" |
| 19 | + class="px-4 py-3 even:bg-white odd:bg-gray-50" |
21 | 20 | role="group" |
22 | 21 | :aria-label="name" |
23 | 22 | > |
|
32 | 31 | <sba-status-badge v-if="health.status" :status="health.status" /> |
33 | 32 | </div> |
34 | 33 | <div v-if="details && details.length > 0" class="w-12 text-right"> |
35 | | - <sba-icon-button |
36 | | - class="p-0!" |
| 34 | + <sba-button |
| 35 | + class="p-0! border-none" |
37 | 36 | :class=" |
38 | 37 | classNames({ |
39 | 38 | 'text-sba-600!': !isCollapsed, |
40 | 39 | 'text-black': isCollapsed, |
41 | 40 | }) |
42 | 41 | " |
43 | | - :icon="faCircleInfo" |
44 | 42 | :title="t('instances.details.health.toggle_details', { name })" |
45 | 43 | :aria-label="t('instances.details.health.toggle_details', { name })" |
46 | 44 | :aria-expanded="String(!isCollapsed)" |
47 | 45 | :aria-controls="`health-details-${id}__${safeNameId}`" |
48 | 46 | @click="() => toggleCollapsed()" |
49 | | - /> |
| 47 | + > |
| 48 | + <font-awesome-icon |
| 49 | + :icon="faChevronRight" |
| 50 | + class="transition-transform" |
| 51 | + :class="{ 'rotate-90': !isCollapsed }" |
| 52 | + /> |
| 53 | + <font-awesome-icon :icon="faCircleInfo" /> |
| 54 | + </sba-button> |
50 | 55 | </div> |
51 | 56 | </dt> |
52 | 57 | <dd |
|
55 | 60 | :aria-labelledby="`health-${id}__${safeNameId}`" |
56 | 61 | > |
57 | 62 | <dl v-if="!isCollapsed" class="grid grid-cols-6 mt-2"> |
58 | | - <template v-for="(detail, idx) in details" :key="`${detail.name}_${idx}`"> |
| 63 | + <template |
| 64 | + v-for="(detail, idx) in details" |
| 65 | + :key="`${detail.name}_${idx}`" |
| 66 | + > |
59 | 67 | <dt |
60 | 68 | :id="`health-detail-${id}__${safeDetailId(detail.name, idx)}`" |
61 | 69 | class="font-medium col-span-2" |
|
73 | 81 | v-text="prettyBytes(detail.value as number)" |
74 | 82 | /> |
75 | 83 | <dd |
76 | | - v-else-if="detail.value !== null && typeof detail.value === 'object'" |
| 84 | + v-else-if=" |
| 85 | + detail.value !== null && typeof detail.value === 'object' |
| 86 | + " |
77 | 87 | class="col-span-4" |
78 | 88 | role="definition" |
79 | 89 | :aria-label="detail.name" |
|
101 | 111 | v-for="(child, idx) in childHealth" |
102 | 112 | :key="`${child.name}_${idx}`" |
103 | 113 | :instance="instance" |
104 | | - :index="idx" |
105 | 114 | :depth="depth + 1" |
106 | 115 | :name="child.name" |
107 | 116 | :health="child.value" |
|
110 | 119 | </template> |
111 | 120 |
|
112 | 121 | <script lang="ts" setup> |
113 | | -import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'; |
| 122 | +import { |
| 123 | + faChevronRight, |
| 124 | + faCircleInfo, |
| 125 | +} from '@fortawesome/free-solid-svg-icons'; |
114 | 126 | import classNames from 'classnames'; |
115 | 127 | import prettyBytes from 'pretty-bytes'; |
116 | 128 | import { computed, ref, useId, watch } from 'vue'; |
117 | 129 | import { useI18n } from 'vue-i18n'; |
118 | 130 |
|
119 | 131 | import SbaFormattedObj from '@/components/sba-formatted-obj.vue'; |
120 | | -import SbaIconButton from '@/components/sba-icon-button.vue'; |
121 | 132 |
|
122 | 133 | import Instance from '@/services/instance'; |
123 | 134 | import autolink from '@/utils/autolink'; |
124 | 135 |
|
125 | 136 | const { t } = useI18n(); |
126 | 137 | const id = useId(); |
127 | 138 |
|
128 | | -const { health, name, instance, index = 0, depth = 0 } = defineProps<{ |
| 139 | +const { |
| 140 | + health, |
| 141 | + name, |
| 142 | + instance, |
| 143 | + depth = 0, |
| 144 | +} = defineProps<{ |
129 | 145 | instance: Instance; |
130 | 146 | name: string; |
131 | 147 | health: Record<string, any>; |
132 | | - /** Row position within siblings — drives even/odd background alternation. */ |
133 | | - index?: number; |
134 | | - /** Recursion depth — used to prevent infinite nesting. */ |
135 | 148 | depth?: number; |
136 | | -}>(); |
| 149 | +}>(); |
137 | 150 |
|
138 | 151 | // Sanitised name safe for use in HTML id attributes |
139 | 152 | const safeNameId = computed(() => (name ?? '').replace(/[^a-zA-Z0-9_-]/g, '_')); |
|
0 commit comments