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="
|
x-init="
|
||||||
// Function to restore task details
|
// Function to restore task details
|
||||||
var restoreTaskDetails = function() {
|
let restoreTaskDetails = function() {
|
||||||
if (expanded && !taskDetails && !loading) {
|
if (expanded && !taskDetails && !loading) {
|
||||||
loading = true;
|
loading = true;
|
||||||
$wire.getTaskDetails('{{ $taskUpid }}').then(function(data) {
|
$wire.getTaskDetails('{{ $taskUpid }}').then(function(data) {
|
||||||
@@ -4012,6 +4012,8 @@
|
|||||||
|
|
||||||
@script
|
@script
|
||||||
<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
|
// Extract IP from string, handling ports for both IPv4 and IPv6
|
||||||
window.extractIP = function(ip) {
|
window.extractIP = function(ip) {
|
||||||
if (!ip || typeof ip !== 'string') return ip;
|
if (!ip || typeof ip !== 'string') return ip;
|
||||||
@@ -5009,9 +5011,6 @@
|
|||||||
horizontalAlign: 'right',
|
horizontalAlign: 'right',
|
||||||
floating: true,
|
floating: true,
|
||||||
showForSingleSeries: true,
|
showForSingleSeries: true,
|
||||||
},
|
|
||||||
noData: {
|
|
||||||
text: 'Loading...'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5734,6 +5733,7 @@
|
|||||||
}, 120000);
|
}, 120000);
|
||||||
|
|
||||||
// Clean up intervals, listeners, and charts when component is destroyed
|
// Clean up intervals, listeners, and charts when component is destroyed
|
||||||
|
try {
|
||||||
$cleanup(function() {
|
$cleanup(function() {
|
||||||
clearInterval(_networkAnalysisCheckIntervalId);
|
clearInterval(_networkAnalysisCheckIntervalId);
|
||||||
clearInterval(_statsRefreshIntervalId);
|
clearInterval(_statsRefreshIntervalId);
|
||||||
@@ -5751,6 +5751,7 @@
|
|||||||
});
|
});
|
||||||
cpuChart = null; memoryChart = null; networkChart = null; diskChart = null;
|
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) {
|
window.downloadCSV = window.downloadCSV || function(csvContent, filename) {
|
||||||
var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
var blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
|
||||||
|
|||||||
Reference in New Issue
Block a user