From 2516a3bd1c56ad9901937932cbb9f13478b816e4 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Fri, 23 May 2025 14:08:21 +0200 Subject: [PATCH] updates --- html/admin.html | 21 ++++++++++++++------- html/launcher.php | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/html/admin.html b/html/admin.html index 45deb64..ccece87 100755 --- a/html/admin.html +++ b/html/admin.html @@ -197,16 +197,17 @@ - - - - - + + + + + + - +
ServiceDescriptionStatusEnabledActionsServiceDescriptionFrequencyStatusEnabledActions
Loading services...Loading services...
@@ -1015,6 +1016,12 @@ function displayServices(services) { descCell.className = 'text-muted small'; row.appendChild(descCell); + // Frequency + const freqCell = document.createElement('td'); + freqCell.textContent = service.frequency || 'Unknown'; + freqCell.className = 'text-primary small fw-bold'; + row.appendChild(freqCell); + // Status const statusCell = document.createElement('td'); const statusBadge = document.createElement('span'); @@ -1061,7 +1068,7 @@ function showServiceError(message) { const tbody = document.getElementById('services-tbody'); tbody.innerHTML = ` - + ${message} diff --git a/html/launcher.php b/html/launcher.php index 873178d..8f21845 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -1027,19 +1027,37 @@ if ($type == "execute_command") { // Get systemd services status if ($type == "get_systemd_services") { try { - // List of NebuleAir services to monitor with descriptions + // List of NebuleAir services to monitor with descriptions and frequencies $services = [ - 'nebuleair-npm-data.timer' => 'Collects particulate matter data from NextPM sensor', - 'nebuleair-envea-data.timer' => 'Reads environmental data from Envea sensors', - 'nebuleair-sara-data.timer' => 'Transmits collected data via 4G cellular modem', - 'nebuleair-bme280-data.timer' => 'Monitors temperature and humidity (BME280)', - 'nebuleair-mppt-data.timer' => 'Tracks solar panel and battery status', - 'nebuleair-db-cleanup-data.timer' => 'Cleans up old data from database' + 'nebuleair-npm-data.timer' => [ + 'description' => 'Collects particulate matter data from NextPM sensor', + 'frequency' => 'Every 10 seconds' + ], + 'nebuleair-envea-data.timer' => [ + 'description' => 'Reads environmental data from Envea sensors', + 'frequency' => 'Every 10 seconds' + ], + 'nebuleair-sara-data.timer' => [ + 'description' => 'Transmits collected data via 4G cellular modem', + 'frequency' => 'Every 60 seconds' + ], + 'nebuleair-bme280-data.timer' => [ + 'description' => 'Monitors temperature and humidity (BME280)', + 'frequency' => 'Every 2 minutes' + ], + 'nebuleair-mppt-data.timer' => [ + 'description' => 'Tracks solar panel and battery status', + 'frequency' => 'Every 2 minutes' + ], + 'nebuleair-db-cleanup-data.timer' => [ + 'description' => 'Cleans up old data from database', + 'frequency' => 'Daily' + ] ]; $serviceStatus = []; - foreach ($services as $service => $description) { + foreach ($services as $service => $serviceInfo) { // Get service active status $activeCmd = "systemctl is-active " . escapeshellarg($service) . " 2>/dev/null"; $activeStatus = trim(shell_exec($activeCmd)); @@ -1057,7 +1075,8 @@ if ($type == "get_systemd_services") { $serviceStatus[] = [ 'name' => $service, 'display_name' => $displayName, - 'description' => $description, + 'description' => $serviceInfo['description'], + 'frequency' => $serviceInfo['frequency'], 'active' => $isActive, 'enabled' => $isEnabled ];