import React from 'react'; import { WidgetContainer } from './WidgetContainer'; import { Card, CardContent, CardHeader } from '@/components/ui/index'; import { Progress } from '@/components/ui/index'; import { AlertCircle, CheckCircle } from 'lucide-react'; interface DatastoreInfo { id: string; name: string; node: string; type: string; status: 'online' | 'under_maintenance' | 'error'; used: number; available: number; total: number; } interface PBSDatastoresWidgetProps { datastores: DatastoreInfo[]; onRefresh?: () => void; isLoading?: boolean; } export function PBSDatastoresWidget({ datastores, onRefresh, isLoading, }: PBSDatastoresWidgetProps) { const onlineCount = datastores.filter((d) => d.status === 'online').length; const maintenanceCount = datastores.filter( (d) => d.status === 'under_maintenance' ).length; return (
{onlineCount}
Online
{maintenanceCount}
Maintenance
{datastores.map((datastore) => (
{datastore.status === 'online' ? ( ) : ( )} {datastore.name}
{datastore.type}
Node {datastore.node}
Status {datastore.status.replace('_', ' ')}
Usage {Math.round((datastore.used / datastore.total) * 100)}%
Used {(datastore.used / (1024 * 1024 * 1024)).toFixed(2)} GB
Available {(datastore.available / (1024 * 1024 * 1024)).toFixed(2)} GB
))}
); }