mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-06 13:34:13 +03:00
Improve deletion handling for classes
This commit is contained in:
parent
e0389382f8
commit
c84bfd3ace
@ -44,7 +44,9 @@
|
|||||||
},
|
},
|
||||||
"deleteCategory": {
|
"deleteCategory": {
|
||||||
"title": "Delete Class",
|
"title": "Delete Class",
|
||||||
"desc": "Are you sure you want to delete the class {{name}}? This will permanently delete all associated images and require re-training the model."
|
"desc": "Are you sure you want to delete the class {{name}}? This will permanently delete all associated images and require re-training the model.",
|
||||||
|
"minClassesTitle": "Cannot Delete Class",
|
||||||
|
"minClassesDesc": "A classification model must have at least 2 classes. Add another class before deleting this one."
|
||||||
},
|
},
|
||||||
"deleteModel": {
|
"deleteModel": {
|
||||||
"title": "Delete Classification Model",
|
"title": "Delete Classification Model",
|
||||||
|
|||||||
@ -265,10 +265,11 @@ export default function ModelTrainingView({ model }: ModelTrainingViewProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always refresh dataset to update the categories list
|
||||||
|
refreshDataset();
|
||||||
|
|
||||||
if (pageToggle == "train") {
|
if (pageToggle == "train") {
|
||||||
refreshTrain();
|
refreshTrain();
|
||||||
} else {
|
|
||||||
refreshDataset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -572,27 +573,44 @@ function LibrarySelector({
|
|||||||
>
|
>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{t("deleteCategory.title")}</DialogTitle>
|
<DialogTitle>
|
||||||
|
{Object.keys(dataset).length <= 2
|
||||||
|
? t("deleteCategory.minClassesTitle")
|
||||||
|
: t("deleteCategory.title")}
|
||||||
|
</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
{t("deleteCategory.desc", { name: confirmDelete })}
|
{Object.keys(dataset).length <= 2
|
||||||
|
? t("deleteCategory.minClassesDesc")
|
||||||
|
: t("deleteCategory.desc", { name: confirmDelete })}
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div className="flex justify-end gap-2">
|
<div className="flex justify-end gap-2">
|
||||||
<Button variant="outline" onClick={() => setConfirmDelete(null)}>
|
{Object.keys(dataset).length <= 2 ? (
|
||||||
{t("button.cancel", { ns: "common" })}
|
<Button variant="outline" onClick={() => setConfirmDelete(null)}>
|
||||||
</Button>
|
{t("button.ok", { ns: "common" })}
|
||||||
<Button
|
</Button>
|
||||||
variant="destructive"
|
) : (
|
||||||
className="text-white"
|
<>
|
||||||
onClick={() => {
|
<Button
|
||||||
if (confirmDelete) {
|
variant="outline"
|
||||||
handleDeleteCategory(confirmDelete);
|
onClick={() => setConfirmDelete(null)}
|
||||||
setConfirmDelete(null);
|
>
|
||||||
}
|
{t("button.cancel", { ns: "common" })}
|
||||||
}}
|
</Button>
|
||||||
>
|
<Button
|
||||||
{t("button.delete", { ns: "common" })}
|
variant="destructive"
|
||||||
</Button>
|
className="text-white"
|
||||||
|
onClick={() => {
|
||||||
|
if (confirmDelete) {
|
||||||
|
handleDeleteCategory(confirmDelete);
|
||||||
|
setConfirmDelete(null);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("button.delete", { ns: "common" })}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user