diff --git a/src/public/js/ui/alertManagementModal.js b/src/public/js/ui/alertManagementModal.js index 979345bfb..068097a92 100644 --- a/src/public/js/ui/alertManagementModal.js +++ b/src/public/js/ui/alertManagementModal.js @@ -228,53 +228,65 @@ PulseApp.ui.alertManagementModal = (() => {

Alert Rules

Manage system and custom alert rules

-
- - -
+ - -
-
-
- + +
+
-

Core monitoring alerts that cannot be deleted

-
-
- -

Loading system alerts...

-
-
- - -
-
-
- + System Alerts + +

Custom Alerts

- User-created + Custom Alerts + + +
+ + +
+ +
+
+
+
+

System Alert Rules

+

Built-in monitoring alerts for CPU, Memory, Disk, and System Down

+
+ Built-in +
+ +
+ +

Loading system alerts...

+
-

Custom threshold and rule-based alerts

-
- -

Loading custom alerts...

+ + +
@@ -444,11 +456,14 @@ PulseApp.ui.alertManagementModal = (() => { } function initializeAlertRulesTab() { - // Set up filter dropdown - const filterSelect = document.getElementById('alert-rules-filter'); - if (filterSelect) { - filterSelect.addEventListener('change', filterAlertRules); - } + // Set up nested tab navigation + const subTabs = document.querySelectorAll('.alert-rules-sub-tab'); + subTabs.forEach(tab => { + tab.addEventListener('click', (e) => { + const targetTab = e.currentTarget.dataset.tab; + switchAlertRulesSubTab(targetTab); + }); + }); // Set up add custom alert button const addCustomBtn = document.getElementById('add-custom-alert-btn'); @@ -460,6 +475,34 @@ PulseApp.ui.alertManagementModal = (() => { loadSystemAlerts(); loadCustomAlerts(); } + + function switchAlertRulesSubTab(tabName) { + // Update tab buttons + const subTabs = document.querySelectorAll('.alert-rules-sub-tab'); + subTabs.forEach(tab => { + const isActive = tab.dataset.tab === tabName; + if (isActive) { + tab.classList.add('active'); + tab.classList.remove('border-transparent', 'text-gray-500', 'dark:text-gray-400'); + tab.classList.add('border-blue-500', 'text-blue-600', 'dark:text-blue-400'); + } else { + tab.classList.remove('active'); + tab.classList.remove('border-blue-500', 'text-blue-600', 'dark:text-blue-400'); + tab.classList.add('border-transparent', 'text-gray-500', 'dark:text-gray-400'); + } + }); + + // Update content visibility + const contentDivs = document.querySelectorAll('.alert-rules-sub-content'); + contentDivs.forEach(div => { + div.classList.add('hidden'); + }); + + const targetContent = document.getElementById(`${tabName}-alert-rules-content`); + if (targetContent) { + targetContent.classList.remove('hidden'); + } + } function initializeNotificationsTab() { // Load email configuration into the email section @@ -538,12 +581,6 @@ PulseApp.ui.alertManagementModal = (() => { } } - function filterAlertRules() { - const filterValue = document.getElementById('alert-rules-filter')?.value; - // TODO: Implement filtering logic - console.log('Filtering alert rules by:', filterValue); - } - function loadSystemAlerts() { const systemAlertsContent = document.getElementById('system-alerts-content'); if (!systemAlertsContent) return;