mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 17:21:04 +00:00
fix: remove livewire:init wrapper from server charts event listeners
The livewire:init event fires before inline scripts execute in Livewire
components, so wrapping Livewire.on() in document.addEventListener('livewire:init')
prevents the callback from ever firing, breaking chart data updates.
This removes the wrapper to match the working pattern in metrics.blade.php.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,10 +109,9 @@
|
|||||||
const serverCpuChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-cpu`),
|
const serverCpuChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-cpu`),
|
||||||
optionsServerCpu);
|
optionsServerCpu);
|
||||||
serverCpuChart.render();
|
serverCpuChart.render();
|
||||||
document.addEventListener('livewire:init', () => {
|
Livewire.on('refreshChartData-{!! $chartId !!}-cpu', (chartData) => {
|
||||||
Livewire.on('refreshChartData-{!! $chartId !!}-cpu', (chartData) => {
|
checkTheme();
|
||||||
checkTheme();
|
serverCpuChart.updateOptions({
|
||||||
serverCpuChart.updateOptions({
|
|
||||||
series: [{
|
series: [{
|
||||||
data: chartData[0].seriesData,
|
data: chartData[0].seriesData,
|
||||||
}],
|
}],
|
||||||
@@ -146,7 +145,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -247,10 +245,9 @@
|
|||||||
const serverMemoryChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-memory`),
|
const serverMemoryChart = new ApexCharts(document.getElementById(`{!! $chartId !!}-memory`),
|
||||||
optionsServerMemory);
|
optionsServerMemory);
|
||||||
serverMemoryChart.render();
|
serverMemoryChart.render();
|
||||||
document.addEventListener('livewire:init', () => {
|
Livewire.on('refreshChartData-{!! $chartId !!}-memory', (chartData) => {
|
||||||
Livewire.on('refreshChartData-{!! $chartId !!}-memory', (chartData) => {
|
checkTheme();
|
||||||
checkTheme();
|
serverMemoryChart.updateOptions({
|
||||||
serverMemoryChart.updateOptions({
|
|
||||||
series: [{
|
series: [{
|
||||||
data: chartData[0].seriesData,
|
data: chartData[0].seriesData,
|
||||||
}],
|
}],
|
||||||
@@ -285,7 +282,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user