diff --git a/packages/web_ui/src/components/InputInstance.tsx b/packages/web_ui/src/components/InputInstance.tsx new file mode 100644 index 00000000..6564311c --- /dev/null +++ b/packages/web_ui/src/components/InputInstance.tsx @@ -0,0 +1,42 @@ +import { Select } from "antd"; + +import { InputComponentProps } from "../BaseWebPlugin"; +import { useInstances } from "../model/instance"; + +interface BaseInputInstanceProps extends InputComponentProps { + includeAll?: boolean; +} + +function BaseInputInstance(props: BaseInputInstanceProps) { + const [instances, synced] = useInstances(); + + const options = [ + ...(props.includeAll ? [{ label: "All instances", value: null }] : []), + ...[...instances.values()].map(instance => ({ + label: instance.name ?? `Instance ${instance.id}`, + value: instance.id, + })), + ]; + + return ( +