diff --git a/.gitignore b/.gitignore index aa5b95761..32c492054 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,8 @@ pids data/acknowledgements.json data/alert-rules.json data/custom-thresholds.json +data/active-alerts.json +data/notification-history.json # Directory for instrumented libs generated by jscoverage/JSCover lib-cov @@ -100,4 +102,9 @@ pnpm-lock.yaml # Update mechanism backup/ -temp/ ProxmoxVE/ +temp/ + +# Development/test files +docker-compose.zen.yml +toggle-debug.html +zen-mcp-server/ diff --git a/alertManagementModal-cleanup-report.md b/alertManagementModal-cleanup-report.md deleted file mode 100644 index 557d7c97e..000000000 --- a/alertManagementModal-cleanup-report.md +++ /dev/null @@ -1,54 +0,0 @@ -# Alert Management Modal - Duplicate & Unused Code Report - -## 1. Duplicate Functions Found - -### Email Test Functions -- **`testEmailConfiguration()`** (line 1288) - Uses `/api/alerts/test-email` endpoint -- **`testEmailConnection()`** (line 2775) - Uses `/api/test-email` endpoint -- Both functions do the same thing but use different API endpoints -- `setupEmailTestButton()` at line 1281 sets up listener for `testEmailConfiguration` -- Direct event listener at line 1858 sets up listener for `testEmailConnection` - -### Webhook Save Functions -- **`saveWebhookConfiguration()`** at line 2566 - Stub function with TODO comment -- **`saveWebhookConfiguration()`** at line 2891 - Full implementation -- First one is never used, second one is the actual implementation - -## 2. Unused Code - -### Functions That Reference Non-Existent Elements -- `handleWebhookPreset()` (line 2545) references `webhook-url-input` element -- `saveWebhookConfiguration()` (line 2567) references `webhook-url-input` element -- `testWebhookConnection()` (line 2947) references `webhook-url-input` element -- **But the actual input has `name="WEBHOOK_URL"` not `id="webhook-url-input"`** - -## 3. Duplicate Event Handler Registration -- Email test button gets event listener added twice: - - Once in `setupEmailTestButton()` (line 1284) - - Once directly in `initializeConfigureTab()` flow (line 1858) - -## 4. Functions Exposed But May Not Need Global Access -These functions are exposed globally but might only need local scope: -- `deleteCustomAlert` -- `openCustomAlertModal` -- `showAlertDetails` -- `toggleAlert` -- `addWebhookEndpoint` -- `removeWebhookEndpoint` -- `handleEmailProviderSelection` -- `switchTab` - -## 5. Recommendations - -### Remove Duplicates -1. Remove the stub `saveWebhookConfiguration()` at line 2566 -2. Choose one email test function and remove the other -3. Fix webhook functions to use correct selector: `input[name="WEBHOOK_URL"]` - -### Fix Element References -1. Update all references from `webhook-url-input` to use the correct selector -2. Remove duplicate event listener registrations - -### Code Organization -1. Consider if all exposed functions really need global access -2. Consolidate similar functionality into single functions \ No newline at end of file diff --git a/data/active-alerts.json b/data/active-alerts.json deleted file mode 100644 index 52de789f1..000000000 --- a/data/active-alerts.json +++ /dev/null @@ -1,418 +0,0 @@ -{ - "down_primary_desktop_200": { - "id": "alert_1749592617067_einpllnea", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "primary", - "node": "desktop", - "vmid": 200, - "name": "UnraidServer", - "type": "qemu", - "status": "stopped", - "maxmem": 8589934592, - "maxdisk": 0 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798209 - }, - "down_primary_desktop_102": { - "id": "alert_1749592617079_bnzd6fszz", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "primary", - "node": "desktop", - "vmid": 102, - "name": "windows11", - "type": "qemu", - "status": "stopped", - "maxmem": 8589934592, - "maxdisk": 68719476736 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798218 - }, - "down_primary_desktop_400": { - "id": "alert_1749592617079_yo7ti97hw", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "primary", - "node": "desktop", - "vmid": 400, - "name": "ubuntu-gpu-vm", - "type": "qemu", - "status": "stopped", - "maxmem": 2147483648, - "maxdisk": 34359738368 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798220 - }, - "down_primary_desktop_112": { - "id": "alert_1749592617080_2z4b49hac", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "primary", - "node": "desktop", - "vmid": 112, - "name": "pulse", - "type": "lxc", - "status": "stopped", - "maxmem": 1073741824, - "maxdisk": 4294967296 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798222 - }, - "down_primary_desktop_109": { - "id": "alert_1749592617080_x3v4e076s", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "primary", - "node": "desktop", - "vmid": 109, - "name": "pbs2", - "type": "lxc", - "status": "stopped", - "maxmem": 4294967296, - "maxdisk": 10737418240 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798224 - }, - "down_endpoint_2_pi_102": { - "id": "alert_1749592617081_hc5818rzl", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "endpoint_2", - "node": "pi", - "vmid": 102, - "name": "pi-docker", - "type": "lxc", - "status": "stopped", - "maxmem": 536870912, - "maxdisk": 4401922048 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798226 - }, - "down_endpoint_2_pi_100": { - "id": "alert_1749592617081_qwcwii5t0", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "endpoint_2", - "node": "pi", - "vmid": 100, - "name": "pihole", - "type": "lxc", - "status": "stopped", - "maxmem": 536870912, - "maxdisk": 6442450944 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798227 - }, - "down_endpoint_2_pi_101": { - "id": "alert_1749592617081_ahtvzvo4z", - "rule": { - "id": "down", - "name": "System Availability", - "description": "Monitors VM/container availability and uptime", - "metric": "status", - "condition": "equals", - "threshold": "stopped", - "duration": 60000, - "severity": "critical", - "enabled": true, - "tags": [ - "availability", - "guest" - ], - "group": "availability_alerts", - "escalationTime": 900000, - "autoResolve": true, - "suppressionTime": 300000, - "type": "single_metric", - "thresholds": [ - { - "metric": "status", - "condition": "equals", - "threshold": "stopped" - } - ], - "sendEmail": true, - "sendWebhook": false - }, - "guest": { - "endpointId": "endpoint_2", - "node": "pi", - "vmid": 101, - "name": "pi-influxdb", - "type": "lxc", - "status": "stopped", - "maxmem": 536870912, - "maxdisk": 2254438400 - }, - "startTime": 1749592617067, - "lastUpdate": 1749592786712, - "triggeredAt": 1749592617067, - "currentValue": "stopped", - "effectiveThreshold": "stopped", - "state": "active", - "escalated": false, - "acknowledged": true, - "acknowledgedBy": "bulk-operation", - "acknowledgedAt": 1749592798229 - } -} \ No newline at end of file diff --git a/data/notification-history.json b/data/notification-history.json deleted file mode 100644 index e64db8d45..000000000 --- a/data/notification-history.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "alert_1749591633220_knkvykli9": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633221_sq6vvs6r8": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_2i936pxgs": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_snanw4eds": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_f0yvac8pb": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_lfw5cbwws": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_rgwnyb3o8": { - "emailSent": false, - "webhookSent": false, - "channels": [] - }, - "alert_1749591633222_2sbx43jxx": { - "emailSent": false, - "webhookSent": false, - "channels": [] - } -} \ No newline at end of file diff --git a/package.json b/package.json index 8cd8c6222..fa0f552a2 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "axios": "^1.9.0", "axios-retry": "^4.5.0", "compression": "^1.7.5", - "concurrently": "^9.1.2", "cors": "^2.8.5", "dotenv": "^16.5.0", "express": "^5.1.0", @@ -33,7 +32,6 @@ "p-limit": "^6.2.0", "semver": "^7.7.2", "socket.io": "^4.7.2", - "sqlite3": "^5.1.7", "tar": "^7.4.3" }, "_comment_tailwind_v3_reason": "Using Tailwind CSS v3 (3.4.4) due to build inconsistencies observed with v4 (specifically 4.1.4). v4 resulted in incorrectly purged CSS files when built within certain Linux environments (e.g., Proxmox LXC - Debian 12 x86_64), failing to detect dynamically added classes. v3.4.4 builds correctly.", @@ -42,7 +40,6 @@ "autoprefixer": "^10.4.21", "chokidar": "^4.0.3", "concurrently": "^9.1.2", - "conventional-changelog-cli": "^5.0.0", "cross-env": "^7.0.3", "jest": "^29.7.0", "playwright": "^1.52.0", diff --git a/scripts/fix-css.sh b/scripts/fix-css.sh deleted file mode 100755 index 4d46be49f..000000000 --- a/scripts/fix-css.sh +++ /dev/null @@ -1,210 +0,0 @@ -#!/bin/bash -# Pulse CSS Fix Script -# This script fixes CSS issues in broken Pulse installations -# where the frontend shows no styling due to CSS MIME type errors - -set -e - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color - -print_info() { - echo -e "${BLUE}[INFO]${NC} $1" -} - -print_success() { - echo -e "${GREEN}[SUCCESS]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARNING]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# Default installation path -PULSE_DIR="/opt/pulse" - -print_info "Pulse CSS Fix Script" -print_info "This script fixes CSS issues where the frontend has no styling" -echo "" - -# Check if Pulse directory exists -if [ ! -d "$PULSE_DIR" ]; then - print_error "Pulse installation directory not found at $PULSE_DIR" - print_info "Please specify the correct Pulse installation path:" - read -p "Enter Pulse installation path: " PULSE_DIR - - if [ ! -d "$PULSE_DIR" ]; then - print_error "Directory $PULSE_DIR does not exist. Exiting." - exit 1 - fi -fi - -print_info "Using Pulse installation at: $PULSE_DIR" - -# Check if this is a Pulse installation -if [ ! -f "$PULSE_DIR/package.json" ] || [ ! -f "$PULSE_DIR/server/index.js" ]; then - print_error "This doesn't appear to be a valid Pulse installation" - print_error "Missing package.json or server/index.js" - exit 1 -fi - -# Change to Pulse directory -cd "$PULSE_DIR" || { - print_error "Failed to change to $PULSE_DIR" - exit 1 -} - -print_info "Checking current CSS status..." - -# Check if output.css exists and has content -if [ ! -f "src/public/output.css" ]; then - print_warning "output.css file is missing" - CSS_MISSING=1 -elif [ ! -s "src/public/output.css" ]; then - print_warning "output.css file is empty" - CSS_EMPTY=1 -else - # Check if CSS contains actual CSS content (not HTML error page) - if head -1 "src/public/output.css" | grep -q "/dev/null 2>&1; then - # Try to rebuild - if npm run build:css >/dev/null 2>&1; then - print_success "CSS rebuilt successfully using npm run build:css" - - # Verify the rebuild worked - if [ -f "src/public/output.css" ] && [ -s "src/public/output.css" ]; then - if ! head -1 "src/public/output.css" | grep -q "/dev/null 2>&1; then - print_info "Downloading CSS from latest Pulse release..." - - # Get latest release info - LATEST_RELEASE=$(curl -s https://api.github.com/repos/rcourtman/Pulse/releases/latest | grep -o '"tag_name": "[^"]*' | cut -d'"' -f4) - - if [ -n "$LATEST_RELEASE" ]; then - print_info "Latest release: $LATEST_RELEASE" - - # Download and extract just the CSS file - TEMP_DIR=$(mktemp -d) - cd "$TEMP_DIR" - - # Download tarball - if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$LATEST_RELEASE/pulse-${LATEST_RELEASE#v}.tar.gz" -o pulse.tar.gz; then - # Extract just the CSS file - if tar -xzf pulse.tar.gz --wildcards "*/src/public/output.css" 2>/dev/null; then - # Find and copy the CSS file - CSS_FILE=$(find . -name "output.css" -path "*/src/public/*" | head -1) - if [ -n "$CSS_FILE" ] && [ -f "$CSS_FILE" ]; then - cp "$CSS_FILE" "$PULSE_DIR/src/public/output.css" - print_success "CSS downloaded and installed from release $LATEST_RELEASE" - - # Clean up temp directory - cd "$PULSE_DIR" - rm -rf "$TEMP_DIR" - - print_success "CSS fix completed successfully!" - print_info "Please refresh your browser (Ctrl+F5 or Cmd+Shift+R) to see the changes" - exit 0 - else - print_error "Could not find CSS file in downloaded release" - fi - else - print_error "Failed to extract CSS from downloaded release" - fi - else - print_error "Failed to download release tarball" - fi - - # Clean up temp directory - cd "$PULSE_DIR" - rm -rf "$TEMP_DIR" - else - print_error "Could not determine latest release version" - fi -else - print_warning "curl command not found, cannot download CSS" -fi - -# Method 3: Create minimal CSS as last resort -print_warning "All automated fixes failed. Creating minimal CSS as last resort..." - -# Create a basic CSS file that will at least make the page usable -cat > "src/public/output.css" << 'EOF' -/* Minimal CSS for Pulse - Emergency Fix */ -* { box-sizing: border-box; } -body { font-family: system-ui, sans-serif; margin: 0; padding: 20px; background: #f5f5f5; } -.container { max-width: 1200px; margin: 0 auto; } -.card { background: white; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } -.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; } -.btn-primary { background: #3b82f6; color: white; } -.text-red-600 { color: #dc2626; } -.text-green-600 { color: #16a34a; } -.text-yellow-600 { color: #ca8a04; } -.hidden { display: none; } -.flex { display: flex; } -.grid { display: grid; } -.gap-4 { gap: 1rem; } -EOF - -print_warning "Created minimal emergency CSS" -print_warning "This provides basic styling but is not the full Pulse theme" -print_info "Consider running the Pulse installer again or manually rebuilding CSS" - -print_info "Please refresh your browser (Ctrl+F5 or Cmd+Shift+R) to see the changes" -print_info "CSS fix script completed" \ No newline at end of file diff --git a/scripts/test-update.sh b/scripts/test-update.sh deleted file mode 100755 index d19d3e652..000000000 --- a/scripts/test-update.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Test script for update mechanism -# This script enables test mode for the update system - -echo "🧪 Pulse Update Test Mode" -echo "========================" -echo "" -echo "This script will start Pulse in update test mode." -echo "In this mode, the application will simulate an available update" -echo "without requiring a real GitHub release." -echo "" -echo "Press Ctrl+C to stop the server." -echo "" - -# Export test environment variables -export UPDATE_TEST_MODE=true -export UPDATE_TEST_VERSION=99.99.99 - -# Optional: Allow custom test version -if [ "$1" ]; then - export UPDATE_TEST_VERSION=$1 - echo "Using test version: $UPDATE_TEST_VERSION" -else - echo "Using default test version: 99.99.99" -fi - -echo "" -echo "Starting server with update test mode enabled..." -echo "" - -# Start the server -cd "$(dirname "$0")/.." || exit -npm run dev:server \ No newline at end of file diff --git a/src/public/index.html b/src/public/index.html index bd92a4ef3..c5a40ddb2 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -921,7 +921,7 @@
-