feat(alarm): add alarm snapshot viewing functionality

This commit is contained in:
2026-01-21 15:16:25 +08:00
parent 1c7190bbb0
commit 294b0e1abb
3 changed files with 47 additions and 2 deletions

View File

@@ -24,6 +24,10 @@ const Dashboard: React.FC = () => {
const [recentAlerts, setRecentAlerts] = useState<Alert[]>([]);
const [cameraStatus, setCameraStatus] = useState<any[]>([]);
const handleViewSnapshot = (alert: Alert) => {
window.open(`/api/alarms/${alert.id}/snapshot`, '_blank');
};
useEffect(() => {
fetchStats();
fetchAlerts();
@@ -139,7 +143,7 @@ const Dashboard: React.FC = () => {
description={formatTime(alert.created_at)}
/>
{alert.snapshot_path && (
<Button type="link" size="small">
<Button type="link" size="small" onClick={() => handleViewSnapshot(alert)}>
</Button>
)}