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