This commit is contained in:
Josh Hawkins 2025-02-10 09:05:06 -06:00
parent 3053a33c3d
commit a782f0137a
3 changed files with 3 additions and 23 deletions

View File

@ -52,26 +52,14 @@ export function LogSettingsButton({
<div className="text-md">Loading</div>
<div className="mt-2.5 flex flex-col gap-2.5">
<div className="space-y-1 text-xs text-muted-foreground">
By default, logs are loaded in chunks on scroll to save bandwidth,
and when the log pane is scrolled to the bottom, new logs
When the log pane is scrolled to the bottom, new logs
automatically stream as they are added.
</div>
<FilterSwitch
label="Always load full log"
isChecked={logSettings?.alwaysLoadFull ?? false}
onCheckedChange={(isChecked) => {
setLogSettings({
alwaysLoadFull: isChecked,
disableStreaming: logSettings?.disableStreaming ?? false,
});
}}
/>
<FilterSwitch
label="Disable log streaming"
isChecked={logSettings?.disableStreaming ?? false}
onCheckedChange={(isChecked) => {
setLogSettings({
alwaysLoadFull: logSettings?.alwaysLoadFull ?? false,
disableStreaming: isChecked,
});
}}

View File

@ -31,7 +31,6 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { debounce } from "lodash";
import { usePersistence } from "@/hooks/use-persistence";
function Logs() {
const [logService, setLogService] = useState<LogType>("frigate");
@ -64,13 +63,7 @@ function Logs() {
// log settings
// const [logSettings, setLogSettings] = usePersistence<LogSettingsType>(
// "logSettings",
// { alwaysLoadFull: false, disableStreaming: false },
// );
const [logSettings, setLogSettings] = useState<LogSettingsType>({
alwaysLoadFull: false,
disableStreaming: false,
});
@ -120,7 +113,7 @@ function Logs() {
setIsLoading(true);
try {
const response = await axios.get(`logs/${logService}`, {
params: { start: logSettings.alwaysLoadFull ? 0 : -100 },
params: { start: filterSeverity ? 0 : -100 },
});
if (
response.status === 200 &&
@ -141,7 +134,7 @@ function Logs() {
} finally {
setIsLoading(false);
}
}, [logService, filterLines, logSettings]);
}, [logService, filterLines, filterSeverity]);
const abortControllerRef = useRef<AbortController | null>(null);

View File

@ -16,6 +16,5 @@ export const logTypes = ["frigate", "go2rtc", "nginx"] as const;
export type LogType = (typeof logTypes)[number];
export type LogSettingsType = {
alwaysLoadFull: boolean;
disableStreaming: boolean;
};