feat(alarm): add alarm snapshot viewing functionality
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user