mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 21:04:44 +02:00
Fix Node
graph not rendering correctly (#1253)
* use round instead of `Number::format` * remove unused * also replace `Number::format` in cpu & memory charts --------- Co-authored-by: Boy132 <mail@boy132.de>
This commit is contained in:
parent
b444112085
commit
e67e0830eb
@ -23,7 +23,7 @@ class NodeCpuChart extends ChartWidget
|
|||||||
$cpu = collect(cache()->get("nodes.{$this->node->id}.cpu_percent"))
|
$cpu = collect(cache()->get("nodes.{$this->node->id}.cpu_percent"))
|
||||||
->slice(-10)
|
->slice(-10)
|
||||||
->map(fn ($value, $key) => [
|
->map(fn ($value, $key) => [
|
||||||
'cpu' => Number::format($value * $threads, maxPrecision: 2),
|
'cpu' => round($value * $threads, 2),
|
||||||
'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'),
|
'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'),
|
||||||
])
|
])
|
||||||
->all();
|
->all();
|
||||||
|
@ -20,7 +20,7 @@ class NodeMemoryChart extends ChartWidget
|
|||||||
{
|
{
|
||||||
$memUsed = collect(cache()->get("nodes.{$this->node->id}.memory_used"))->slice(-10)
|
$memUsed = collect(cache()->get("nodes.{$this->node->id}.memory_used"))->slice(-10)
|
||||||
->map(fn ($value, $key) => [
|
->map(fn ($value, $key) => [
|
||||||
'memory' => Number::format(config('panel.use_binary_prefix') ? $value / 1024 / 1024 / 1024 : $value / 1000 / 1000 / 1000, maxPrecision: 2),
|
'memory' => round(config('panel.use_binary_prefix') ? $value / 1024 / 1024 / 1024 : $value / 1000 / 1000 / 1000, 2),
|
||||||
'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'),
|
'timestamp' => Carbon::createFromTimestamp($key, auth()->user()->timezone ?? 'UTC')->format('H:i:s'),
|
||||||
])
|
])
|
||||||
->all();
|
->all();
|
||||||
|
@ -4,7 +4,6 @@ namespace App\Filament\Admin\Resources\NodeResource\Widgets;
|
|||||||
|
|
||||||
use App\Models\Node;
|
use App\Models\Node;
|
||||||
use Filament\Widgets\ChartWidget;
|
use Filament\Widgets\ChartWidget;
|
||||||
use Illuminate\Support\Number;
|
|
||||||
|
|
||||||
class NodeStorageChart extends ChartWidget
|
class NodeStorageChart extends ChartWidget
|
||||||
{
|
{
|
||||||
@ -46,8 +45,8 @@ class NodeStorageChart extends ChartWidget
|
|||||||
|
|
||||||
$unused = $total - $used;
|
$unused = $total - $used;
|
||||||
|
|
||||||
$used = Number::format($used, maxPrecision: 2);
|
$used = round($used, 2);
|
||||||
$unused = Number::format($unused, maxPrecision: 2);
|
$unused = round($unused, 2);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'datasets' => [
|
'datasets' => [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user