service autocomplete

This commit is contained in:
ari committed 2022-06-06 22:37:34 -04:00
1 parent 78494ee74d
commit 4c3b34195a
14 files changed
+437 -274

No files matched your search

@@ -0,0 +1,19 @@
import { FC } from "react";
import { ServiceOption, useHAServices } from 'haService';
import { InputAutoComplete, InputAutoCompletePropsBase } from './InputAutoComplete';
import { prettyName } from 'utils/formatting';
export type InputServiceProps = InputAutoCompletePropsBase & { multiple?: false };
export const InputService: FC<InputServiceProps> = props => {
const services = useHAServices();
return <InputAutoComplete
{...props}
label={props.label ?? "Service"}
options={services.getOptions()}
getID={services.getID}
getLabel={services.getLabel}
groupBy={opt => (typeof opt !== 'string') ? prettyName(opt.domain) : ''}
/>
}