Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: metrics parsing

Andras Bacsaia43de75b42af
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 744b383b5f..1dedf80458 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -5,8 +5,6 @@ namespace App\Models;
use App\Actions\Server\InstallDocker;
use App\Enums\ProxyTypes;
use App\Jobs\PullSentinelImageJob;
-use App\Notifications\Server\Revived;
-use App\Notifications\Server\Unreachable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Support\Collection;
@@ -503,9 +501,27 @@ $schema://$host {
return [(int) $time, (float) $value];
});
- })->toArray();
+ });
+ if ($mins === 30 || $mins === 60) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 5 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
+ if ($mins === 720) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 10 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
+ if ($mins === 10080) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 20 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
- return $parsedCollection;
+ return $parsedCollection->toArray();
}
}
@@ -529,9 +545,27 @@ $schema://$host {
return [(int) $time, (float) $usedPercent];
});
- })->toArray();
+ });
+ if ($mins === 30 || $mins === 60) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 5 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
+ if ($mins === 720) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 10 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
+ if ($mins === 10080) {
+ $parsedCollection = $parsedCollection->filter(function ($item, $key) {
+ return $key % 20 === 0;
+ });
+ $parsedCollection = $parsedCollection->values();
+ }
- return $parsedCollection;
+ return $parsedCollection->toArray();
}
}
diff --git a/resources/views/livewire/charts/server-cpu.blade.php b/resources/views/livewire/charts/server-cpu.blade.php
index a39679fd82..ff85f94f1d 100644
--- a/resources/views/livewire/charts/server-cpu.blade.php
+++ b/resources/views/livewire/charts/server-cpu.blade.php
@@ -14,14 +14,13 @@
<script>
checkTheme();
const optionsServerCpu = {
+ stroke: {
+ curve: 'straight',
+ },
chart: {
height: '150px',
id: '{!! $chartId !!}',
type: 'area',
- stroke: {
- curve: 'straight',
- },
-
toolbar: {
show: false,
tools: {
diff --git a/resources/views/livewire/charts/server-memory.blade.php b/resources/views/livewire/charts/server-memory.blade.php
index a112744ecd..1b29e20b66 100644
--- a/resources/views/livewire/charts/server-memory.blade.php
+++ b/resources/views/livewire/charts/server-memory.blade.php
@@ -14,14 +14,13 @@
<script>
checkTheme();
const optionsServerMemory = {
+ stroke: {
+ curve: 'straight',
+ },
chart: {
height: '150px',
id: '{!! $chartId !!}',
type: 'area',
- stroke: {
- curve: 'straight',
- },
-
toolbar: {
show: false,
tools: {
@@ -122,7 +121,6 @@
});
});
});
-
</script>
</div>