- Added api-security-hardening (helmet, rate limits) - Added nodejs-backend-patterns (error handling) - Added observability-monitoring (pino logging) - Added websocket-engineer (socket.io real-time updates) - Added docker (Multi-stage build, compose) - Added vitest (testing configuration and store tests) - Added data-visualizer (MetricsBar and HostChart) - Added infrastructure-monitoring/proxmox-admin/network-engineer types - Fixed UI accessibility and styling - Cleaned up node_modules tracking
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { AlertTriangle, X } from 'lucide-react';
|
|
import { useTopologyStore } from '../store/topologyStore';
|
|
|
|
export default function StaleWarning() {
|
|
const {
|
|
consecutiveFailures,
|
|
lastSuccessfulDiscovery,
|
|
staleWarningDismissed,
|
|
dismissStaleWarning
|
|
} = useTopologyStore();
|
|
|
|
if (consecutiveFailures < 3 || staleWarningDismissed) {
|
|
return null;
|
|
}
|
|
|
|
const formatTime = (date: Date | null) => {
|
|
if (!date) return 'Never';
|
|
return date.toLocaleString();
|
|
};
|
|
|
|
return (
|
|
<div className="bg-amber-900/30 border-b border-amber-700/50 px-4 py-2 flex items-center justify-between">
|
|
<div className="flex items-center gap-3">
|
|
<AlertTriangle className="w-4 h-4 text-amber-400 flex-shrink-0" />
|
|
<span className="text-amber-200 text-sm">
|
|
Data may be stale - Last successful discovery: {formatTime(lastSuccessfulDiscovery)}
|
|
</span>
|
|
<span className="text-amber-400/70 text-xs">
|
|
({consecutiveFailures} consecutive failures)
|
|
</span>
|
|
</div>
|
|
<button
|
|
onClick={dismissStaleWarning}
|
|
className="p-1 hover:bg-amber-800/50 rounded transition-colors"
|
|
title="Dismiss warning"
|
|
>
|
|
<X className="w-4 h-4 text-amber-400" />
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|