diff --git a/src/components/PodTree.tsx b/src/components/PodTree.tsx new file mode 100644 index 0000000..9bfaf92 --- /dev/null +++ b/src/components/PodTree.tsx @@ -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 ( +
+ {pods.map((pod) => ( +
+ {pod.metadata.name} + +
+ {(pod.spec.containers || []).map((c) => ( +
+ onSelect({ + pod: pod.metadata.name, + container: c.name + }) + } + > + └ {c.name} +
+ ))} +
+
+ ))} +
+ ); +} \ No newline at end of file