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 ( + ; } diff --git a/packages/web_ui/src/components/InputRole.tsx b/packages/web_ui/src/components/InputRole.tsx index e8039cda..fec189a8 100644 --- a/packages/web_ui/src/components/InputRole.tsx +++ b/packages/web_ui/src/components/InputRole.tsx @@ -4,7 +4,7 @@ import { InputComponentProps } from "../BaseWebPlugin"; import { useRoles } from "../model/roles"; export default function InputRole(props: InputComponentProps) { - const [roles] = useRoles(); + const [roles, synced] = useRoles(); return