Refactor statistics view: update variable declarations for better scope management; enhance error handling in cleanup process; remove redundant noData configuration in chart options
This commit is contained in:
@@ -1246,7 +1246,7 @@
|
||||
}"
|
||||
x-init="
|
||||
// Function to restore task details
|
||||
var restoreTaskDetails = function() {
|
||||
let restoreTaskDetails = function() {
|
||||
if (expanded && !taskDetails && !loading) {
|
||||
loading = true;
|
||||
$wire.getTaskDetails('{{ $taskUpid }}').then(function(data) {
|
||||
@@ -4012,6 +4012,8 @@
|
||||
|
||||
@script
|
||||
<script>
|
||||
let _scriptInit = true; // Must start with let/const for Alpine.evaluate() IIFE wrapping
|
||||
|
||||
// Extract IP from string, handling ports for both IPv4 and IPv6
|
||||
window.extractIP = function(ip) {
|
||||
if (!ip || typeof ip !== 'string') return ip;
|
||||
@@ -5009,9 +5011,6 @@
|
||||
horizontalAlign: 'right',
|
||||
floating: true,
|
||||
showForSingleSeries: true,
|
||||
},
|
||||
noData: {
|
||||
text: 'Loading...'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5734,6 +5733,7 @@
|
||||
}, 120000);
|
||||
|
||||
// Clean up intervals, listeners, and charts when component is destroyed
|
||||
try {
|
||||
$cleanup(function() {
|
||||
clearInterval(_networkAnalysisCheckIntervalId);
|
||||
clearInterval(_statsRefreshIntervalId);
|
||||
@@ -5751,6 +5751,7 @@
|
||||
});
|
||||
cpuChart = null; memoryChart = null; networkChart = null; diskChart = null;
|
||||
});
|
||||
} catch(e) { /* $cleanup may not be available in this Livewire version */ }
|
||||
|
||||
window.downloadCSV = window.downloadCSV || function(csvContent, filename) {
|
||||
var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||
|
||||
Reference in New Issue
Block a user