handling missing ids better + more tranlsations
This commit is contained in:
1 parent
69a9805c02
commit
774ebe482a
45 files changed
+556
-262
No files matched your search
@@ -1,19 +1,27 @@
|
||||
import { FC } from "react";
|
||||
import { useHAServices } from 'haService';
|
||||
import { InputAutoComplete, InputAutoCompletePropsBase } from './InputAutoComplete';
|
||||
import { prettyName } from 'utils/formatting';
|
||||
import { useHAServices } from "haService";
|
||||
import {
|
||||
InputAutoComplete,
|
||||
InputAutoCompletePropsBase,
|
||||
} from "./InputAutoComplete";
|
||||
import { prettyName } from "utils/formatting";
|
||||
import { useLang } from "lang";
|
||||
|
||||
export type InputServiceProps = InputAutoCompletePropsBase & { multiple?: false };
|
||||
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) : ''}
|
||||
export const InputService: FC<InputServiceProps> = (props) => {
|
||||
const services = useHAServices();
|
||||
const lang = useLang();
|
||||
return (
|
||||
<InputAutoComplete
|
||||
{...props}
|
||||
label={props.label ?? lang.get("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