mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 12:14:45 +02:00
Change limits section on front end (#853)
* Edit Front end settings * Use helpers --------- Co-authored-by: Lance Pioch <git@lance.sh>
This commit is contained in:
parent
8f51502c6d
commit
7a5dd87385
@ -20,6 +20,7 @@ use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\Alignment;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Number;
|
||||
|
||||
class Settings extends ServerFormPage
|
||||
{
|
||||
@ -99,21 +100,48 @@ class Settings extends ServerFormPage
|
||||
'lg' => 3,
|
||||
])
|
||||
->schema([
|
||||
TextInput::make('cpu')
|
||||
->label('')
|
||||
->prefix('CPU')
|
||||
->prefixIcon('tabler-cpu')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'Unlimited' : Number::format($server->cpu, locale: auth()->user()->language) . '%'),
|
||||
TextInput::make('memory')
|
||||
->label('')
|
||||
->prefix('Memory')
|
||||
->prefixIcon('tabler-device-desktop-analytics')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'Unlimited' : convert_bytes_to_readable($server->memory * 2 ** 20)),
|
||||
TextInput::make('disk')
|
||||
->label('')
|
||||
->prefix('Disk Space')
|
||||
->prefixIcon('tabler-device-sd-card')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'Unlimited' : convert_bytes_to_readable($server->disk * 2 ** 20)),
|
||||
TextInput::make('backup_limit')
|
||||
->label('Backup Limit')
|
||||
->label('')
|
||||
->prefix('Backups')
|
||||
->prefixIcon('tabler-file-zip')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No Backups can be created' : $server->backups->count() . ' of ' . $state),
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No Backups' : $server->backups->count() . ' of ' . $state),
|
||||
TextInput::make('database_limit')
|
||||
->label('Database Limit')
|
||||
->label('')
|
||||
->prefix('Databases')
|
||||
->prefixIcon('tabler-database')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No Databases can be created' : $server->databases->count() . ' of ' . $state),
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No Databases' : $server->databases->count() . ' of ' . $state),
|
||||
TextInput::make('allocation_limit')
|
||||
->label('Allocation Limit')
|
||||
->label('')
|
||||
->prefix('Allocations')
|
||||
->prefixIcon('tabler-network')
|
||||
->columnSpan(1)
|
||||
->disabled()
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No additional Allocations can be created' : $server->allocations->count() . ' of ' . $state),
|
||||
->formatStateUsing(fn ($state, Server $server) => !$state ? 'No Additional Allocations' : $server->allocations->count() . ' of ' . $state),
|
||||
]),
|
||||
]),
|
||||
Section::make('Node Information')
|
||||
|
Loading…
x
Reference in New Issue
Block a user