diff --git a/client/src/pages/Alerts.jsx b/client/src/pages/Alerts.jsx index 24fa682..a514e67 100644 --- a/client/src/pages/Alerts.jsx +++ b/client/src/pages/Alerts.jsx @@ -7,7 +7,9 @@ import { BellIcon, CheckCircleIcon, XCircleIcon, - ExclamationTriangleIcon + ExclamationTriangleIcon, + ChevronDownIcon, + ChevronRightIcon } from '@heroicons/react/24/outline'; import { EditAlertModal, DetectionDetailsModal } from '../components/AlertModals'; @@ -22,6 +24,7 @@ const Alerts = () => { const [editingRule, setEditingRule] = useState(null); const [showDetectionModal, setShowDetectionModal] = useState(false); const [selectedDetection, setSelectedDetection] = useState(null); + const [expandedGroups, setExpandedGroups] = useState(new Set()); useEffect(() => { fetchAlertData(); @@ -76,6 +79,16 @@ const Alerts = () => { return groupedArrays; }; + const toggleGroupExpansion = (groupIndex) => { + const newExpanded = new Set(expandedGroups); + if (newExpanded.has(groupIndex)) { + newExpanded.delete(groupIndex); + } else { + newExpanded.add(groupIndex); + } + setExpandedGroups(newExpanded); + }; + const handleDeleteRule = async (ruleId) => { if (window.confirm('Are you sure you want to delete this alert rule?')) { try { @@ -371,8 +384,15 @@ const Alerts = () => {
) : ( -| {t('alerts.status')} | @@ -397,14 +417,30 @@ const Alerts = () => {|
|---|---|
|
+ {relatedAlerts.length > 0 && (
+
+ )}
{getStatusIcon(primaryAlert.status)}
{primaryAlert.status}
{relatedAlerts.length > 0 && (
-
+
+
)}
|
@@ -413,7 +449,7 @@ const Alerts = () => {
{primaryAlert.alert_type}
- {relatedAlerts.map((alert, idx) => (
+ {!expandedGroups.has(groupIndex) && relatedAlerts.map((alert, idx) => (
{alert.alert_type}
@@ -423,7 +459,7 @@ const Alerts = () => {
{primaryAlert.recipient}
- {relatedAlerts.length > 0 && relatedAlerts.some(a => a.recipient !== primaryAlert.recipient) && (
+ {!expandedGroups.has(groupIndex) && relatedAlerts.length > 0 && relatedAlerts.some(a => a.recipient !== primaryAlert.recipient) && (
+{relatedAlerts.filter(a => a.recipient !== primaryAlert.recipient).length} others
@@ -483,8 +519,8 @@ const Alerts = () => {
|
|
@@ -563,6 +599,7 @@ const Alerts = () => {
|