mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-19 14:48:22 +03:00
Start with correct type selected
This commit is contained in:
parent
46cf4eefc3
commit
ff9308a0e8
@ -30,6 +30,7 @@ const STATE_STEPS = [
|
|||||||
type ClassificationModelWizardDialogProps = {
|
type ClassificationModelWizardDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
defaultModelType?: "state" | "object";
|
||||||
};
|
};
|
||||||
|
|
||||||
type WizardState = {
|
type WizardState = {
|
||||||
@ -92,6 +93,7 @@ function wizardReducer(state: WizardState, action: WizardAction): WizardState {
|
|||||||
export default function ClassificationModelWizardDialog({
|
export default function ClassificationModelWizardDialog({
|
||||||
open,
|
open,
|
||||||
onClose,
|
onClose,
|
||||||
|
defaultModelType,
|
||||||
}: ClassificationModelWizardDialogProps) {
|
}: ClassificationModelWizardDialogProps) {
|
||||||
const { t } = useTranslation(["views/classificationModel"]);
|
const { t } = useTranslation(["views/classificationModel"]);
|
||||||
|
|
||||||
@ -166,6 +168,7 @@ export default function ClassificationModelWizardDialog({
|
|||||||
{wizardState.currentStep === 0 && (
|
{wizardState.currentStep === 0 && (
|
||||||
<Step1NameAndDefine
|
<Step1NameAndDefine
|
||||||
initialData={wizardState.step1Data}
|
initialData={wizardState.step1Data}
|
||||||
|
defaultModelType={defaultModelType}
|
||||||
onNext={handleStep1Next}
|
onNext={handleStep1Next}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -40,12 +40,14 @@ export type Step1FormData = {
|
|||||||
|
|
||||||
type Step1NameAndDefineProps = {
|
type Step1NameAndDefineProps = {
|
||||||
initialData?: Partial<Step1FormData>;
|
initialData?: Partial<Step1FormData>;
|
||||||
|
defaultModelType?: "state" | "object";
|
||||||
onNext: (data: Step1FormData) => void;
|
onNext: (data: Step1FormData) => void;
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Step1NameAndDefine({
|
export default function Step1NameAndDefine({
|
||||||
initialData,
|
initialData,
|
||||||
|
defaultModelType,
|
||||||
onNext,
|
onNext,
|
||||||
onCancel,
|
onCancel,
|
||||||
}: Step1NameAndDefineProps) {
|
}: Step1NameAndDefineProps) {
|
||||||
@ -146,7 +148,7 @@ export default function Step1NameAndDefine({
|
|||||||
resolver: zodResolver(step1FormData),
|
resolver: zodResolver(step1FormData),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
modelName: initialData?.modelName || "",
|
modelName: initialData?.modelName || "",
|
||||||
modelType: initialData?.modelType || "state",
|
modelType: initialData?.modelType || defaultModelType || "state",
|
||||||
objectLabel: initialData?.objectLabel,
|
objectLabel: initialData?.objectLabel,
|
||||||
objectType: initialData?.objectType || "sub_label",
|
objectType: initialData?.objectType || "sub_label",
|
||||||
classes: initialData?.classes?.length ? initialData.classes : [""],
|
classes: initialData?.classes?.length ? initialData.classes : [""],
|
||||||
|
|||||||
@ -79,6 +79,7 @@ export default function ModelSelectionView({
|
|||||||
<div className="flex size-full flex-col p-2">
|
<div className="flex size-full flex-col p-2">
|
||||||
<ClassificationModelWizardDialog
|
<ClassificationModelWizardDialog
|
||||||
open={newModel}
|
open={newModel}
|
||||||
|
defaultModelType={pageToggle === "objects" ? "object" : "state"}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setNewModel(false);
|
setNewModel(false);
|
||||||
refreshConfig();
|
refreshConfig();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user