diff --git a/app/Livewire/Charts/ServerCpu.php b/app/Livewire/Charts/ServerCpu.php deleted file mode 100644 index 5f3283009..000000000 --- a/app/Livewire/Charts/ServerCpu.php +++ /dev/null @@ -1,59 +0,0 @@ -poll || $this->interval <= 10) { - $this->loadData(); - if ($this->interval > 10) { - $this->poll = false; - } - } - } - - public function loadData() - { - try { - $metrics = $this->server->getCpuMetrics($this->interval); - $metrics = collect($metrics)->map(function ($metric) { - return [$metric[0], $metric[1]]; - }); - $this->dispatch("refreshChartData-{$this->chartId}", [ - 'seriesData' => $metrics, - ]); - } catch (\Throwable $e) { - return handleError($e, $this); - } - } - - public function setInterval() - { - if ($this->interval <= 10) { - $this->poll = true; - } - $this->loadData(); - } -} diff --git a/app/Livewire/Charts/ServerMemory.php b/app/Livewire/Server/Charts.php similarity index 53% rename from app/Livewire/Charts/ServerMemory.php rename to app/Livewire/Server/Charts.php index 911f267f6..0921c7fa4 100644 --- a/app/Livewire/Charts/ServerMemory.php +++ b/app/Livewire/Server/Charts.php @@ -1,15 +1,15 @@ poll || $this->interval <= 10) { @@ -37,13 +32,21 @@ class ServerMemory extends Component public function loadData() { try { - $metrics = $this->server->getMemoryMetrics($this->interval); - $metrics = collect($metrics)->map(function ($metric) { + $cpuMetrics = $this->server->getCpuMetrics($this->interval); + $memoryMetrics = $this->server->getMemoryMetrics($this->interval); + $cpuMetrics = collect($cpuMetrics)->map(function ($metric) { return [$metric[0], $metric[1]]; }); - $this->dispatch("refreshChartData-{$this->chartId}", [ - 'seriesData' => $metrics, + $memoryMetrics = collect($memoryMetrics)->map(function ($metric) { + return [$metric[0], $metric[1]]; + }); + $this->dispatch("refreshChartData-{$this->chartId}-cpu", [ + 'seriesData' => $cpuMetrics, ]); + $this->dispatch("refreshChartData-{$this->chartId}-memory", [ + 'seriesData' => $memoryMetrics, + ]); + } catch (\Throwable $e) { return handleError($e, $this); } diff --git a/resources/views/livewire/charts/server-cpu.blade.php b/resources/views/livewire/charts/server-cpu.blade.php deleted file mode 100644 index 3aab224f9..000000000 --- a/resources/views/livewire/charts/server-cpu.blade.php +++ /dev/null @@ -1,116 +0,0 @@ -