mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-28 07:11:53 +03:00
Some checks failed
CI / AMD64 Build (push) Has been cancelled
CI / ARM Build (push) Has been cancelled
CI / Jetson Jetpack 6 (push) Has been cancelled
CI / AMD64 Extra Build (push) Has been cancelled
CI / ARM Extra Build (push) Has been cancelled
CI / Synaptics Build (push) Has been cancelled
CI / Assemble and push default build (push) Has been cancelled
* refactor go2rtc docs * clarify go2rtc language in live * add export docs * Move around config items to reflect reference config is now for advanced users * Remove outdated ipv6 section * Fix broken links * live usage docs * review usage docs * history usage * explore usage * add usage sidebar and move related text to usage sections * update links * update live * move exports to usage * fix anchors * Make starts of usage pages consistent * refactor network config * Adjustments for review * Add AI details to history page * describe alerts vs detections in review usage * simplify --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
169 lines
5.0 KiB
TypeScript
169 lines
5.0 KiB
TypeScript
import { LogLine } from "@/types/log";
|
|
import { isDesktop } from "react-device-detect";
|
|
import {
|
|
Sheet,
|
|
SheetContent,
|
|
SheetDescription,
|
|
SheetHeader,
|
|
SheetTitle,
|
|
} from "../ui/sheet";
|
|
import {
|
|
Drawer,
|
|
DrawerContent,
|
|
DrawerDescription,
|
|
DrawerHeader,
|
|
DrawerTitle,
|
|
} from "../ui/drawer";
|
|
import { LogChip } from "../indicators/Chip";
|
|
import { useMemo } from "react";
|
|
import { Link } from "react-router-dom";
|
|
import { useTranslation } from "react-i18next";
|
|
import { useDocDomain } from "@/hooks/use-doc-domain";
|
|
|
|
type LogInfoDialogProps = {
|
|
logLine?: LogLine;
|
|
setLogLine: (log: LogLine | undefined) => void;
|
|
};
|
|
export default function LogInfoDialog({
|
|
logLine,
|
|
setLogLine,
|
|
}: LogInfoDialogProps) {
|
|
const { t } = useTranslation(["views/system"]);
|
|
const Overlay = isDesktop ? Sheet : Drawer;
|
|
const Content = isDesktop ? SheetContent : DrawerContent;
|
|
const Header = isDesktop ? SheetHeader : DrawerHeader;
|
|
const Title = isDesktop ? SheetTitle : DrawerTitle;
|
|
const Description = isDesktop ? SheetDescription : DrawerDescription;
|
|
|
|
const helpfulLinks = useHelpfulLinks(logLine?.content);
|
|
|
|
return (
|
|
<Overlay
|
|
open={logLine != undefined}
|
|
onOpenChange={(open) => {
|
|
if (!open) {
|
|
setLogLine(undefined);
|
|
}
|
|
}}
|
|
>
|
|
<Content
|
|
className={isDesktop ? "" : "max-h-[75dvh] overflow-hidden p-2 pb-4"}
|
|
>
|
|
<Header className="sr-only">
|
|
<Title>Log Details</Title>
|
|
<Description>Log details</Description>
|
|
</Header>
|
|
{logLine && (
|
|
<div className="flex size-full flex-col gap-5">
|
|
<div className="flex w-min flex-col gap-1.5">
|
|
<div className="text-sm text-primary/40">
|
|
{t("logs.type.label")}
|
|
</div>
|
|
<LogChip severity={logLine.severity} />
|
|
</div>
|
|
<div className="flex flex-col gap-1.5">
|
|
<div className="text-sm text-primary/40">
|
|
{t("logs.type.timestamp")}
|
|
</div>
|
|
<div className="text-sm">{logLine.dateStamp}</div>
|
|
</div>
|
|
<div className="flex flex-col gap-1.5">
|
|
<div className="text-sm text-primary/40">
|
|
{t("logs.type.tag")}
|
|
</div>
|
|
<div className="text-sm">{logLine.section}</div>
|
|
</div>
|
|
<div className="flex flex-col gap-1.5">
|
|
<div className="text-sm text-primary/40">
|
|
{t("logs.type.message")}
|
|
</div>
|
|
<div className="text-sm">
|
|
{logLine.content.split("\n").map((line) => (
|
|
<>
|
|
{line}
|
|
<br />
|
|
</>
|
|
))}
|
|
</div>
|
|
</div>
|
|
{helpfulLinks.length > 0 && (
|
|
<div className="flex flex-col gap-1.5">
|
|
<div className="text-sm text-primary/40">Helpful Links</div>
|
|
{helpfulLinks.map((tip) => (
|
|
<Link to={tip.link} target="_blank" rel="noopener noreferrer">
|
|
<div className="text-sm text-selected hover:underline">
|
|
{tip.text}
|
|
</div>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
</Content>
|
|
</Overlay>
|
|
);
|
|
}
|
|
|
|
function useHelpfulLinks(content: string | undefined) {
|
|
const { getLocaleDocUrl } = useDocDomain();
|
|
return useMemo(() => {
|
|
if (!content) {
|
|
return [];
|
|
}
|
|
|
|
const links = [];
|
|
if (/Could not clear [\d.]* currently [\d.]*/.exec(content)) {
|
|
links.push({
|
|
link: getLocaleDocUrl(
|
|
"configuration/record#will-frigate-delete-old-recordings-if-my-storage-runs-out",
|
|
),
|
|
text: "Frigate Automatic Storage Cleanup",
|
|
});
|
|
}
|
|
|
|
if (/Did not detect hwaccel/.exec(content)) {
|
|
links.push({
|
|
link: getLocaleDocUrl("configuration/hardware_acceleration_video"),
|
|
text: "Setup Hardware Acceleration",
|
|
});
|
|
}
|
|
|
|
if (
|
|
content.includes(
|
|
"/usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so init failed",
|
|
) ||
|
|
content.includes(
|
|
"/usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed",
|
|
) ||
|
|
content.includes(
|
|
"/usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so init failed",
|
|
) ||
|
|
content.includes("No VA display found for device /dev/dri/renderD128")
|
|
) {
|
|
links.push({
|
|
link: getLocaleDocUrl("configuration/hardware_acceleration_video"),
|
|
text: "Verify Hardware Acceleration Setup",
|
|
});
|
|
}
|
|
|
|
if (content.includes("No EdgeTPU was detected")) {
|
|
links.push({
|
|
link: getLocaleDocUrl("troubleshooting/edgetpu"),
|
|
text: "Troubleshoot Coral",
|
|
});
|
|
}
|
|
|
|
if (content.includes("The current SHM size of")) {
|
|
links.push({
|
|
link: getLocaleDocUrl(
|
|
"frigate/installation/#calculating-required-shm-size",
|
|
),
|
|
text: "Calculate Correct SHM Size",
|
|
});
|
|
}
|
|
|
|
return links;
|
|
}, [content, getLocaleDocUrl]);
|
|
}
|