Skip to content

Commit 4e82f26

Browse files
committed
Fixing small files for v.0.1.1
1 parent 627aef7 commit 4e82f26

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default function RootLayout({
3030
return (
3131
<html lang="en" suppressHydrationWarning>
3232
<body
33+
suppressHydrationWarning
3334
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
3435
>
3536
<ThemeProvider

app/vbr/dashboard/page.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export const dynamic = 'force-dynamic'
44

5-
import { useState, useEffect } from "react"
5+
import { useState, useEffect, useCallback, useRef } from "react"
66
import { DashboardStats } from "@/components/dashboard-stats"
77
import { SessionsOverview } from "@/components/sessions-overview"
88
import { StorageCapacityWidget } from "@/components/storage-capacity-widget"
@@ -15,7 +15,8 @@ import {
1515
LicenseModel,
1616
MalwareEventModel,
1717
SecurityBestPracticeItem,
18-
VeeamServerInfo
18+
VeeamServerInfo,
19+
TransferRateDataPoint
1920
} from "@/lib/types/veeam"
2021
import { calculateTransferRates } from "@/lib/utils/transfer-rate"
2122
import { TransferRateChart } from "@/components/transfer-rate-chart"
@@ -29,18 +30,20 @@ export default function VBRPage() {
2930
const [securityItems, setSecurityItems] = useState<SecurityBestPracticeItem[]>([])
3031
const [sessions, setSessions] = useState<VeeamSession[]>([])
3132
const [timeRange, setTimeRange] = useState<"7d" | "30d">("7d")
32-
const [transferRateData, setTransferRateData] = useState<any[]>([])
33+
const [transferRateData, setTransferRateData] = useState<TransferRateDataPoint[]>([])
3334

3435
const [loading, setLoading] = useState(true)
3536
const [isRefreshing, setIsRefreshing] = useState(false)
3637
const [error, setError] = useState<string | null>(null)
3738

3839
const [lastUpdated, setLastUpdated] = useState<Date | null>(null)
3940

40-
const fetchData = async () => {
41+
const hasLoadedOnce = useRef(false)
42+
43+
const fetchData = useCallback(async () => {
4144
try {
4245
// Only show full loading state on initial load
43-
if (jobs.length === 0) setLoading(true)
46+
if (!hasLoadedOnce.current) setLoading(true)
4447
else setIsRefreshing(true)
4548

4649
setError(null)
@@ -82,21 +85,22 @@ export default function VBRPage() {
8285
setSecurityItems(securityData)
8386
setTransferRateData(calculateTransferRates(sessionsData))
8487
setLastUpdated(new Date())
88+
hasLoadedOnce.current = true
8589
} catch (error) {
8690
console.error("Failed to fetch dashboard data:", error)
8791
setError(error instanceof Error ? error.message : String(error))
8892
} finally {
8993
setLoading(false)
9094
setIsRefreshing(false)
9195
}
92-
}
96+
}, [timeRange])
9397

9498
useEffect(() => {
9599
fetchData()
96100
// Refresh data every 5 minutes
97101
const interval = setInterval(fetchData, 300000)
98102
return () => clearInterval(interval)
99-
}, [timeRange])
103+
}, [fetchData])
100104

101105
// Calculate job stats - count jobs that are currently running
102106
const activeJobs = jobs.filter(j => j.isRunning || j.status === 'Running').length

components/sessions-overview.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as React from "react"
44
import { Bar, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, ResponsiveContainer, Cell } from "recharts" // Added YAxis
55
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"
66
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
7-
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
7+
// Tabs imports removed
88
import { Badge } from "@/components/ui/badge"
99
import { Button } from "@/components/ui/button"
1010
import { Input } from "@/components/ui/input"
@@ -29,7 +29,7 @@ import {
2929
getPaginationRowModel // Added
3030
} from "@tanstack/react-table"
3131
import { VeeamSession } from "@/lib/types/veeam"
32-
import { ArrowUpDown, CheckCircle2, AlertTriangle, XCircle, HelpCircle, Columns, ChevronLeft, ChevronRight, X } from "lucide-react" // Added icons
32+
import { ArrowUpDown, CheckCircle2, AlertTriangle, XCircle, HelpCircle, Columns, ChevronLeft, ChevronRight } from "lucide-react" // Added icons
3333
import { DataTableFacetedFilter } from "@/components/data-table-faceted-filter"
3434
import { Skeleton } from "@/components/ui/skeleton"
3535

@@ -152,13 +152,20 @@ export const columns: ColumnDef<VeeamSession>[] = [
152152
]
153153

154154
// Custom Tooltip Component
155-
const CustomTooltip = ({ active, payload, label }: any) => {
155+
interface TooltipPayload {
156+
name: string
157+
value: number
158+
color?: string
159+
payload?: unknown
160+
}
161+
162+
const CustomTooltip = ({ active, payload, label }: { active?: boolean, payload?: TooltipPayload[], label?: string }) => {
156163
if (active && payload && payload.length) {
157164
return (
158165
<div className="border border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl">
159-
<div className="font-medium text-foreground">{new Date(label).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })}</div>
166+
<div className="font-medium text-foreground">{new Date(label || "").toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })}</div>
160167
<div className="grid gap-1.5">
161-
{payload.map((entry: any, index: number) => {
168+
{payload.map((entry: TooltipPayload, index: number) => {
162169
if (entry.value === 0) return null; // Hide if value is 0
163170
const colorMap: Record<string, string> = {
164171
"Success": "#22c55e",

components/vbr-restore-points-calendar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { format, startOfMonth, endOfMonth, eachDayOfInterval, isSameMonth, isSam
55
import { ChevronLeft, ChevronRight, HardDrive, Database, Calendar as CalendarIcon } from "lucide-react"
66
import { Button } from "@/components/ui/button"
77
import { Badge } from "@/components/ui/badge"
8-
import { Card, CardContent } from "@/components/ui/card"
8+
// Card imports removed
99
import { VeeamRestorePoint } from "@/lib/types/veeam"
1010
import { cn } from "@/lib/utils"
1111

0 commit comments

Comments
 (0)