fix: charts

This commit is contained in:
Andras Bacsai
2024-06-19 09:30:56 +02:00
parent a43de75b42
commit 36f251e710
5 changed files with 40 additions and 44 deletions

View File

@@ -15,13 +15,25 @@ class ServerMemory extends Component
public $categories;
public $interval = 5;
public int $interval = 5;
public bool $poll = true;
public function render()
{
return view('livewire.charts.server-memory');
}
public function pollData()
{
if ($this->poll || $this->interval <= 10) {
$this->loadData();
if ($this->interval > 10) {
$this->poll = false;
}
}
}
public function mount()
{
$this->loadData();
@@ -44,6 +56,9 @@ class ServerMemory extends Component
public function setInterval()
{
if ($this->interval <= 10) {
$this->poll = true;
}
$this->loadData();
}
}