import { Alert, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import { ExternalLink } from "lucide-react"; import { SectionCard } from "../components/SectionCard"; import { useWidgetData } from "../hooks/useWidgets"; import type { WidgetInstance } from "../types"; import { getWidgetDefinition } from "./registry"; interface Props { widget: WidgetInstance; } export function GrafanaLinkWidget({ widget }: Props) { const def = getWidgetDefinition(widget.widget_type); const { data, isLoading } = useWidgetData( widget.id, def?.refreshInterval ?? 0, ); const url = data?.data?.url as string | undefined; return ( {isLoading && !data ? ( ) : data?.error ? ( {data.error} ) : url ? ( ) : ( No Grafana URL configured. )} ); }