fix: guard fleet containers iteration, prevent TypeError on null
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
959cd9e191
commit
9c9fd1ca1e
@ -67,12 +67,12 @@
|
|||||||
<!-- Container List -->
|
<!-- Container List -->
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<h4 class="text-xs font-medium text-white/60 mb-2 uppercase tracking-wide">Containers</h4>
|
<h4 class="text-xs font-medium text-white/60 mb-2 uppercase tracking-wide">Containers</h4>
|
||||||
<div v-if="!node.containers.length" class="text-white/40 text-sm py-2">
|
<div v-if="!node.containers?.length" class="text-white/40 text-sm py-2">
|
||||||
No containers reported.
|
No containers reported.
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="space-y-1">
|
<div v-else class="space-y-1">
|
||||||
<div
|
<div
|
||||||
v-for="c in node.containers"
|
v-for="c in (node.containers || [])"
|
||||||
:key="c.id"
|
:key="c.id"
|
||||||
class="flex items-center gap-3 p-2 bg-white/5 rounded-lg"
|
class="flex items-center gap-3 p-2 bg-white/5 rounded-lg"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -107,7 +107,7 @@ export function formatTimestamp(ts: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getContainerState(node: FleetNode, appId: string): string | null {
|
export function getContainerState(node: FleetNode, appId: string): string | null {
|
||||||
const container = node.containers.find(c => c.id === appId)
|
const container = (node.containers || []).find(c => c.id === appId)
|
||||||
if (!container) return null
|
if (!container) return null
|
||||||
return container.state
|
return container.state
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ export function useFleetData() {
|
|||||||
const allAppIds = computed(() => {
|
const allAppIds = computed(() => {
|
||||||
const appSet = new Set<string>()
|
const appSet = new Set<string>()
|
||||||
for (const node of nodes.value) {
|
for (const node of nodes.value) {
|
||||||
for (const c of node.containers) {
|
for (const c of (node.containers || [])) {
|
||||||
appSet.add(c.id)
|
appSet.add(c.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user