src/components/PodTree.tsx hinzugefügt

This commit is contained in:
ds
2026-06-28 18:39:40 +00:00
parent e365410dce
commit e4779a2599
+37
View File
@@ -0,0 +1,37 @@
import React, { useEffect, useState } from "react";
import { fetchPods } from "../api";
export default function PodTree({ namespace, onSelect }) {
const [pods, setPods] = useState([]);
useEffect(() => {
fetchPods(namespace).then((d) => setPods(d.items || []));
}, [namespace]);
return (
<div style={{ marginTop: 10 }}>
{pods.map((pod) => (
<div key={pod.metadata.name}>
<b>{pod.metadata.name}</b>
<div style={{ marginLeft: 10 }}>
{(pod.spec.containers || []).map((c) => (
<div
key={c.name}
style={{ cursor: "pointer", color: "#aaa" }}
onClick={() =>
onSelect({
pod: pod.metadata.name,
container: c.name
})
}
>
{c.name}
</div>
))}
</div>
</div>
))}
</div>
);
}