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": {
|
||||
"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": {
|
||||
"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") {
|
||||
refreshTrain();
|
||||
} else {
|
||||
refreshDataset();
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -572,13 +573,28 @@ function LibrarySelector({
|
||||
>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{t("deleteCategory.title")}</DialogTitle>
|
||||
<DialogTitle>
|
||||
{Object.keys(dataset).length <= 2
|
||||
? t("deleteCategory.minClassesTitle")
|
||||
: t("deleteCategory.title")}
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
{t("deleteCategory.desc", { name: confirmDelete })}
|
||||
{Object.keys(dataset).length <= 2
|
||||
? t("deleteCategory.minClassesDesc")
|
||||
: t("deleteCategory.desc", { name: confirmDelete })}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="flex justify-end gap-2">
|
||||
{Object.keys(dataset).length <= 2 ? (
|
||||
<Button variant="outline" onClick={() => setConfirmDelete(null)}>
|
||||
{t("button.ok", { ns: "common" })}
|
||||
</Button>
|
||||
) : (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setConfirmDelete(null)}
|
||||
>
|
||||
{t("button.cancel", { ns: "common" })}
|
||||
</Button>
|
||||
<Button
|
||||
@ -593,6 +609,8 @@ function LibrarySelector({
|
||||
>
|
||||
{t("button.delete", { ns: "common" })}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user