"use client"; import { useState, useRef, useEffect } from "react"; import { useTheme } from "next-themes"; import SectionHeader from "@/components/landing/section-header"; import { Button } from "@/components/ui/button"; type Section = "overview" | "resources" | "kubernetes" | "network"; const sections: { id: Section; label: string; panels: number }[] = [ { id: "overview", label: "Overview", panels: 8 }, { id: "resources", label: "Resources", panels: 8 }, { id: "kubernetes", label: "Kubernetes", panels: 4 }, { id: "network", label: "Network", panels: 6 }, ]; // Loading Skeleton 컴포넌트 const LoadingSkeleton = () => (
Loading dashboard...
); export default function GrafanaPage() { const [activeSection, setActiveSection] = useState
("overview"); const { theme } = useTheme(); const sectionRef = useRef(null); // Grafana iframe URL 생성 함수 const getGrafanaUrl = (panelId: number, themeType: "dark" | "light") => { const baseUrl = "https://grafana0213.kro.kr/d-solo/k8s_views_global/kubernetes-views-global"; return `${baseUrl}?orgId=1&refresh=30s&theme=${themeType}&panelId=${panelId}`; }; // iframe 래퍼 컴포넌트 const GrafanaPanel = ({ panelId }: { panelId: number }) => { const [loaded, setLoaded] = useState(false); return (
{/* {(!loaded || isLoading) && } */} {theme === "dark" ? (