diff --git a/config.json.dist b/config.json.dist index 183cb23..d65faab 100755 --- a/config.json.dist +++ b/config.json.dist @@ -2,6 +2,7 @@ "loop_log": true, "boot_log": true, "deviceID": "XXXX", + "deviceName": "NebuleAir-proXXX", "SaraR4_baudrate": 115200, "NextPM_ports": [ "ttyAMA5" diff --git a/html/admin.html b/html/admin.html index e0c5dd2..4f3308c 100755 --- a/html/admin.html +++ b/html/admin.html @@ -39,12 +39,12 @@
+ @@ -133,7 +133,15 @@ window.onload = function() { console.log("Getting config file (onload)"); //get device ID const deviceID = data.deviceID.trim().toUpperCase(); - document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //get device Name + const deviceName = data.deviceName; + + const elements = document.querySelectorAll('.sideBar_sensorName'); + elements.forEach((element) => { + element.innerText = deviceName; + }); + //get local RTC $.ajax({ diff --git a/html/index.html b/html/index.html index 32c7583..127d29d 100755 --- a/html/index.html +++ b/html/index.html @@ -100,16 +100,29 @@ }) .catch(error => console.error(`Error loading ${file}:`, error)); }); + + }); + window.onload = function() { + fetch('../config.json') // Replace 'deviceID.txt' with 'config.json' .then(response => response.json()) // Parse response as JSON .then(data => { console.log("Getting config file (onload)"); //get device ID const deviceID = data.deviceID.trim().toUpperCase(); - document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + + + //get device Name + const deviceName = data.deviceName; + + const elements = document.querySelectorAll('.sideBar_sensorName'); + elements.forEach((element) => { + element.innerText = deviceName; + }); //get local RTC $.ajax({ diff --git a/html/launcher.php b/html/launcher.php index 378fd56..bf21f6c 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -12,6 +12,12 @@ if ($type == "git_pull") { echo $output; } +if ($type == "clear_loopLogs") { + $command = 'truncate -s 0 /var/www/nebuleair_pro_4g/logs/loop.log'; + $output = shell_exec($command); + echo $output; +} + if ($type == "linux_disk") { $command = 'df -h /'; $output = shell_exec($command); diff --git a/html/logs.html b/html/logs.html index ca53b13..ad5340c 100755 --- a/html/logs.html +++ b/html/logs.html @@ -56,7 +56,8 @@
- Loop logs + Loop logs +
@@ -172,6 +173,14 @@ window.onload = function() { //get device ID const deviceID = data.deviceID.trim().toUpperCase(); document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //get device Name + const deviceName = data.deviceName; + + const elements = document.querySelectorAll('.sideBar_sensorName'); + elements.forEach((element) => { + element.innerText = deviceName; + }); + //get local RTC $.ajax({ @@ -191,6 +200,27 @@ window.onload = function() { }) .catch(error => console.error('Error loading config.json:', error)); } + + +function clear_loopLogs(){ + console.log("Clearing loop logs"); + + $.ajax({ + url: 'launcher.php?type=clear_loopLogs', + method: 'GET', // Use GET or POST depending on your needs + success: function(response) { + // Handle success response if needed + console.log(response); + //alert(response); + // Reload the page after the device update + location.reload(); // This will reload the page + + }, + error: function(xhr, status, error) { + console.error('AJAX request failed:', status, error); + } + }); + } diff --git a/html/saraR4.html b/html/saraR4.html index 90f0a50..832e846 100755 --- a/html/saraR4.html +++ b/html/saraR4.html @@ -594,7 +594,16 @@ window.onload = function() { .then(data => { //get device ID const deviceID = data.deviceID.trim().toUpperCase(); - document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + + //get device Name + const deviceName = data.deviceName; + + const elements = document.querySelectorAll('.sideBar_sensorName'); + elements.forEach((element) => { + element.innerText = deviceName; + }); + //get SARA_R4 connection status const SARA_statusElement = document.getElementById("modem-status"); diff --git a/html/sidebar.html b/html/sidebar.html index 57478ba..f94d94e 100755 --- a/html/sidebar.html +++ b/html/sidebar.html @@ -40,5 +40,12 @@ Admin + + + + \ No newline at end of file diff --git a/html/topbar.html b/html/topbar.html index 4c2d4ef..fc8606a 100755 --- a/html/topbar.html +++ b/html/topbar.html @@ -8,8 +8,9 @@ +
diff --git a/html/wifi.html b/html/wifi.html index 88048e8..8281fa9 100755 --- a/html/wifi.html +++ b/html/wifi.html @@ -292,7 +292,16 @@ function get_internet(){ console.log("Getting config file (onload)"); //get device ID const deviceID = data.deviceID.trim().toUpperCase(); - document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + //document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; + + //get device Name + const deviceName = data.deviceName; + + const elements = document.querySelectorAll('.sideBar_sensorName'); + elements.forEach((element) => { + element.innerText = deviceName; + }); + //get wifi connection status const WIFI_statusElement = document.getElementById("wifi-status");