src/components/NamespaceSelector.tsx hinzugefügt
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
export default function NamespaceSelector({ value, onChange }) {
|
||||
const [namespaces, setNamespaces] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/v1/namespaces")
|
||||
.then((r) => r.json())
|
||||
.then((d) => setNamespaces(d.items || []));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<select value={value} onChange={(e) => onChange(e.target.value)}>
|
||||
{namespaces.map((ns) => (
|
||||
<option key={ns.metadata.name} value={ns.metadata.name}>
|
||||
{ns.metadata.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user