Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM serversideup/php:beta-8.1-fpm-nginx

ENV PHP_POOL_NAME=speedtest-tracker_php
ENV PHP_POST_MAX_SIZE=1G
ENV PHP_UPLOAD_MAX_FILE_SIZE=1G

# Install addition packages
RUN apt-get update && apt-get install -y \
Expand Down
45 changes: 41 additions & 4 deletions _ide_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* A helper file for Laravel, to provide autocomplete information to your IDE
* Generated for Laravel 9.34.0.
* Generated for Laravel 9.36.3.
*
* This file should not be included in your code, only analyzed by your IDE!
*
Expand Down Expand Up @@ -12756,6 +12756,7 @@ public static function flushMacros()
* @method static \Illuminate\Routing\RouteRegistrar scopeBindings()
* @method static \Illuminate\Routing\RouteRegistrar where(array $where)
* @method static \Illuminate\Routing\RouteRegistrar withoutMiddleware(array|string $middleware)
* @method static \Illuminate\Routing\RouteRegistrar withoutScopedBindings()
* @see \Illuminate\Routing\Router
*/
class Route {
Expand Down Expand Up @@ -18428,7 +18429,19 @@ public static function assertPageActionShouldNotOpenUrlInNewTab($name, $record =
/**
*
*
* @see \Filament\Testing\TestsPageActions::assertPageActionHeld()
* @see \Filament\Testing\TestsPageActions::assertPageActionHalted()
* @param string $name
* @return static
* @static
*/
public static function assertPageActionHalted($name)
{
return \Livewire\Testing\TestableLivewire::assertPageActionHalted($name);
}
/**
*
*
* @see \Filament\Testing\TestsPageActions::assertPageActionHalted()
* @param string $name
* @return static
* @static
Expand Down Expand Up @@ -18879,7 +18892,19 @@ public static function assertTableActionShouldNotOpenUrlInNewTab($name, $record
/**
*
*
* @see \Filament\Tables\Testing\TestsActions::assertTableActionHeld()
* @see \Filament\Tables\Testing\TestsActions::assertTableActionHalted()
* @param string $name
* @return static
* @static
*/
public static function assertTableActionHalted($name)
{
return \Livewire\Testing\TestableLivewire::assertTableActionHalted($name);
}
/**
*
*
* @see \Filament\Tables\Testing\TestsActions::assertTableActionHalted()
* @param string $name
* @return static
* @static
Expand Down Expand Up @@ -19135,7 +19160,19 @@ public static function assertTableBulkActionDoesNotHaveColor($name, $color, $rec
/**
*
*
* @see \Filament\Tables\Testing\TestsBulkActions::assertTableBulkActionHeld()
* @see \Filament\Tables\Testing\TestsBulkActions::assertTableBulkActionHalted()
* @param string $name
* @return static
* @static
*/
public static function assertTableBulkActionHalted($name)
{
return \Livewire\Testing\TestableLivewire::assertTableBulkActionHalted($name);
}
/**
*
*
* @see \Filament\Tables\Testing\TestsBulkActions::assertTableBulkActionHalted()
* @param string $name
* @return static
* @static
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Resources/ResultResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static function table(Table $table): Table
TextColumn::make('id')
->label('ID'),
ViewColumn::make('download')
->view('tables.columns.bytes-column'),
->view('tables.columns.bits-column'),
ViewColumn::make('upload')
->view('tables.columns.bytes-column'),
->view('tables.columns.bits-column'),
TextColumn::make('ping'),
ViewColumn::make('server_id')
->label('Server ID')
Expand Down
6 changes: 6 additions & 0 deletions app/Filament/Resources/ResultResource/Pages/ListResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

use App\Filament\Resources\ResultResource;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;

class ListResults extends ListRecords
{
protected static string $resource = ResultResource::class;

protected function getTableQuery(): Builder
{
return parent::getTableQuery()->orderBy('id', 'desc');
}

protected function getHeaderWidgets(): array
{
return ResultResource::getWidgets();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class StatsOverview extends BaseWidget
protected function getCards(): array
{
return [
Card::make('Latest download', formatBytes(Result::latest()->first()?->download ?: 0)),
Card::make('Latest upload', formatBytes(Result::latest()->first()?->upload ?: 0)),
Card::make('Latest download', formatBits(formatBytesToBits(Result::latest()->first()?->download ?: 0)).'ps'),
Card::make('Latest upload', formatBits(formatBytesToBits(Result::latest()->first()?->upload ?: 0)).'ps'),
Card::make('Latest ping', round(Result::latest()->first()?->ping ?: 0, 2)),
];
}
Expand Down
37 changes: 34 additions & 3 deletions app/helpers.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
<?php

if (! function_exists('formatBits')) {
function formatBits(int $bits, $precision = 2)
{
if ($bits > 0) {
$i = floor(log($bits) / log(1024));

$sizes = ['B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb'];

return sprintf('%.02F', round($bits / pow(1024, $i), $precision)) * 1 .' '.@$sizes[$i];
}

return 0;
}
}

if (! function_exists('formatBytes')) {
function formatBytes(int $bytes, $precision = 2)
{
$base = log($bytes, 1024);
$suffixes = ['', 'Kbps', 'Mbps', 'Gbps', 'Tbps'];
if ($bytes > 0) {
$i = floor(log($bytes) / log(1024));

$sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

return sprintf('%.02F', round($bytes / pow(1024, $i), $precision)) * 1 .' '.@$sizes[$i];
}

return 0;
}
}

if (! function_exists('formatBytesToBits')) {
function formatBytestoBits(int $bytes)
{
if ($bytes > 0) {
return $bytes * 8;
}

return round(pow(1024, $base - floor($base)), $precision).' '.$suffixes[floor($base)];
return 0;
}
}
Loading