mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-10 14:01:12 +03:00
Always require restart on save since model changes also need one
This commit is contained in:
parent
8fd9726220
commit
96d081fad5
@ -1173,8 +1173,7 @@
|
|||||||
"noModelSelected": "Select a Frigate+ model"
|
"noModelSelected": "Select a Frigate+ model"
|
||||||
},
|
},
|
||||||
"toast": {
|
"toast": {
|
||||||
"saveSuccess": "Detector and model settings saved",
|
"saveSuccess": "Settings saved — restart Frigate to apply",
|
||||||
"saveSuccessRestart": "Detector changed — restart Frigate to apply",
|
|
||||||
"saveError": "Failed to save detector and model settings"
|
"saveError": "Failed to save detector and model settings"
|
||||||
},
|
},
|
||||||
"unsavedChanges": "Unsaved detector and model changes"
|
"unsavedChanges": "Unsaved detector and model changes"
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { LuExternalLink, LuFilter } from "react-icons/lu";
|
import { LuExternalLink, LuFilter } from "react-icons/lu";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import isEqual from "lodash/isEqual";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
import { useSWRConfig } from "swr";
|
import { useSWRConfig } from "swr";
|
||||||
@ -285,7 +284,6 @@ export default function DetectorsAndModelSettingsView({
|
|||||||
const onSave = useCallback(async () => {
|
const onSave = useCallback(async () => {
|
||||||
if (!state || !snapshot) return;
|
if (!state || !snapshot) return;
|
||||||
|
|
||||||
const detectorChanged = !isEqual(state.detectors, snapshot.detectors);
|
|
||||||
const tabChanged = state.modelTab !== snapshot.modelTab;
|
const tabChanged = state.modelTab !== snapshot.modelTab;
|
||||||
|
|
||||||
const modelPayload =
|
const modelPayload =
|
||||||
@ -303,7 +301,7 @@ export default function DetectorsAndModelSettingsView({
|
|||||||
}
|
}
|
||||||
|
|
||||||
await axios.put("config/set", {
|
await axios.put("config/set", {
|
||||||
requires_restart: detectorChanged ? 1 : 0,
|
requires_restart: 1,
|
||||||
config_data: {
|
config_data: {
|
||||||
detectors: state.detectors,
|
detectors: state.detectors,
|
||||||
model: modelPayload,
|
model: modelPayload,
|
||||||
@ -318,20 +316,14 @@ export default function DetectorsAndModelSettingsView({
|
|||||||
setChildPending({});
|
setChildPending({});
|
||||||
setResetKey((k) => k + 1);
|
setResetKey((k) => k + 1);
|
||||||
|
|
||||||
if (detectorChanged) {
|
toast.success(t("detectorsAndModel.toast.saveSuccess"), {
|
||||||
toast.success(t("detectorsAndModel.toast.saveSuccessRestart"), {
|
position: "top-center",
|
||||||
position: "top-center",
|
action: (
|
||||||
action: (
|
<Button onClick={() => setRestartDialogOpen(true)}>
|
||||||
<Button onClick={() => setRestartDialogOpen(true)}>
|
{t("restart.button", { ns: "components/dialog" })}
|
||||||
{t("restart.button", { ns: "components/dialog" })}
|
</Button>
|
||||||
</Button>
|
),
|
||||||
),
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
toast.success(t("detectorsAndModel.toast.saveSuccess"), {
|
|
||||||
position: "top-center",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const err = error as {
|
const err = error as {
|
||||||
response?: { data?: { message?: string; detail?: string } };
|
response?: { data?: { message?: string; detail?: string } };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user