mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-19 01:17:06 +03:00
clean up
This commit is contained in:
parent
3053a33c3d
commit
a782f0137a
@ -52,26 +52,14 @@ export function LogSettingsButton({
|
|||||||
<div className="text-md">Loading</div>
|
<div className="text-md">Loading</div>
|
||||||
<div className="mt-2.5 flex flex-col gap-2.5">
|
<div className="mt-2.5 flex flex-col gap-2.5">
|
||||||
<div className="space-y-1 text-xs text-muted-foreground">
|
<div className="space-y-1 text-xs text-muted-foreground">
|
||||||
By default, logs are loaded in chunks on scroll to save bandwidth,
|
When the log pane is scrolled to the bottom, new logs
|
||||||
and when the log pane is scrolled to the bottom, new logs
|
|
||||||
automatically stream as they are added.
|
automatically stream as they are added.
|
||||||
</div>
|
</div>
|
||||||
<FilterSwitch
|
|
||||||
label="Always load full log"
|
|
||||||
isChecked={logSettings?.alwaysLoadFull ?? false}
|
|
||||||
onCheckedChange={(isChecked) => {
|
|
||||||
setLogSettings({
|
|
||||||
alwaysLoadFull: isChecked,
|
|
||||||
disableStreaming: logSettings?.disableStreaming ?? false,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FilterSwitch
|
<FilterSwitch
|
||||||
label="Disable log streaming"
|
label="Disable log streaming"
|
||||||
isChecked={logSettings?.disableStreaming ?? false}
|
isChecked={logSettings?.disableStreaming ?? false}
|
||||||
onCheckedChange={(isChecked) => {
|
onCheckedChange={(isChecked) => {
|
||||||
setLogSettings({
|
setLogSettings({
|
||||||
alwaysLoadFull: logSettings?.alwaysLoadFull ?? false,
|
|
||||||
disableStreaming: isChecked,
|
disableStreaming: isChecked,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -31,7 +31,6 @@ import {
|
|||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
import { debounce } from "lodash";
|
import { debounce } from "lodash";
|
||||||
import { usePersistence } from "@/hooks/use-persistence";
|
|
||||||
|
|
||||||
function Logs() {
|
function Logs() {
|
||||||
const [logService, setLogService] = useState<LogType>("frigate");
|
const [logService, setLogService] = useState<LogType>("frigate");
|
||||||
@ -64,13 +63,7 @@ function Logs() {
|
|||||||
|
|
||||||
// log settings
|
// log settings
|
||||||
|
|
||||||
// const [logSettings, setLogSettings] = usePersistence<LogSettingsType>(
|
|
||||||
// "logSettings",
|
|
||||||
// { alwaysLoadFull: false, disableStreaming: false },
|
|
||||||
// );
|
|
||||||
|
|
||||||
const [logSettings, setLogSettings] = useState<LogSettingsType>({
|
const [logSettings, setLogSettings] = useState<LogSettingsType>({
|
||||||
alwaysLoadFull: false,
|
|
||||||
disableStreaming: false,
|
disableStreaming: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -120,7 +113,7 @@ function Logs() {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`logs/${logService}`, {
|
const response = await axios.get(`logs/${logService}`, {
|
||||||
params: { start: logSettings.alwaysLoadFull ? 0 : -100 },
|
params: { start: filterSeverity ? 0 : -100 },
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
response.status === 200 &&
|
response.status === 200 &&
|
||||||
@ -141,7 +134,7 @@ function Logs() {
|
|||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [logService, filterLines, logSettings]);
|
}, [logService, filterLines, filterSeverity]);
|
||||||
|
|
||||||
const abortControllerRef = useRef<AbortController | null>(null);
|
const abortControllerRef = useRef<AbortController | null>(null);
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,5 @@ export const logTypes = ["frigate", "go2rtc", "nginx"] as const;
|
|||||||
export type LogType = (typeof logTypes)[number];
|
export type LogType = (typeof logTypes)[number];
|
||||||
|
|
||||||
export type LogSettingsType = {
|
export type LogSettingsType = {
|
||||||
alwaysLoadFull: boolean;
|
|
||||||
disableStreaming: boolean;
|
disableStreaming: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user