service autocomplete
This commit is contained in:
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) : ''}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user