mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-11 17:47:37 +03:00
Always show ID field when editing a trigger
This commit is contained in:
parent
4638c22c16
commit
b1b7153e2c
@ -25,6 +25,7 @@ type NameAndIdFieldsProps<T extends FieldValues = FieldValues> = {
|
|||||||
processId?: (name: string) => string;
|
processId?: (name: string) => string;
|
||||||
placeholderName?: string;
|
placeholderName?: string;
|
||||||
placeholderId?: string;
|
placeholderId?: string;
|
||||||
|
idVisible?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function NameAndIdFields<T extends FieldValues = FieldValues>({
|
export default function NameAndIdFields<T extends FieldValues = FieldValues>({
|
||||||
@ -39,10 +40,11 @@ export default function NameAndIdFields<T extends FieldValues = FieldValues>({
|
|||||||
processId,
|
processId,
|
||||||
placeholderName,
|
placeholderName,
|
||||||
placeholderId,
|
placeholderId,
|
||||||
|
idVisible,
|
||||||
}: NameAndIdFieldsProps<T>) {
|
}: NameAndIdFieldsProps<T>) {
|
||||||
const { t } = useTranslation(["common"]);
|
const { t } = useTranslation(["common"]);
|
||||||
const { watch, setValue, trigger, formState } = useFormContext<T>();
|
const { watch, setValue, trigger, formState } = useFormContext<T>();
|
||||||
const [isIdVisible, setIsIdVisible] = useState(false);
|
const [isIdVisible, setIsIdVisible] = useState(idVisible ?? false);
|
||||||
const hasUserTypedRef = useRef(false);
|
const hasUserTypedRef = useRef(false);
|
||||||
|
|
||||||
const defaultProcessId = (name: string) => {
|
const defaultProcessId = (name: string) => {
|
||||||
|
|||||||
@ -258,6 +258,7 @@ export default function CreateTriggerDialog({
|
|||||||
nameLabel={t("triggers.dialog.form.name.title")}
|
nameLabel={t("triggers.dialog.form.name.title")}
|
||||||
nameDescription={t("triggers.dialog.form.name.description")}
|
nameDescription={t("triggers.dialog.form.name.description")}
|
||||||
placeholderName={t("triggers.dialog.form.name.placeholder")}
|
placeholderName={t("triggers.dialog.form.name.placeholder")}
|
||||||
|
idVisible={!!trigger}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user