mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 09:54:44 +02:00
fix 500 when node is not reachable
This commit is contained in:
parent
8c52209d5f
commit
28f971b26e
@ -23,7 +23,7 @@ class NodeCpuChart extends ChartWidget
|
||||
protected function getData(): array
|
||||
{
|
||||
$data = $this->node->statistics();
|
||||
$threads = $this->node->systemInformation()['cpu_count'];
|
||||
$threads = $this->node->systemInformation()['cpu_count'] ?? 0;
|
||||
|
||||
$this->cpuHistory = session()->get('cpuHistory', []);
|
||||
$this->cpuHistory[] = [
|
||||
@ -75,7 +75,7 @@ class NodeCpuChart extends ChartWidget
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
$threads = $this->node->systemInformation()['cpu_count'];
|
||||
$threads = $this->node->systemInformation()['cpu_count'] ?? 0;
|
||||
$data = array_slice(end($this->cpuHistory), -60);
|
||||
|
||||
$cpu = Number::format($data['cpu'], maxPrecision: 2, locale: auth()->user()->language);
|
||||
|
Loading…
x
Reference in New Issue
Block a user