Skip to content

Commit

Permalink
Edit Front end settings
Browse files Browse the repository at this point in the history
  • Loading branch information
notAreYouScared committed Jan 2, 2025
1 parent 9d48799 commit d081ba4
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions app/Filament/Server/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Filament\Support\Enums\Alignment;
use GuzzleHttp\Exception\TransferException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Number;

class Settings extends ServerFormPage
{
Expand Down Expand Up @@ -99,21 +100,52 @@ public function form(Form $form): Form
'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' : (config('panel.use_binary_prefix')
? Number::format($server->memory / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
: Number::format($server->memory / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB')),
TextInput::make('disk')
->label('')
->prefix('Disk Space')
->prefixIcon('tabler-device-sd-card')
->columnSpan(1)
->disabled()
->formatStateUsing(fn ($state, Server $server) => !$state ? 'Unlimited' : (config('panel.use_binary_prefix')
? Number::format($server->disk / 1024, maxPrecision: 2, locale: auth()->user()->language) .' GiB'
: Number::format($server->disk / 1000, maxPrecision: 2, locale: auth()->user()->language) . ' GB')),
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')
Expand Down

0 comments on commit d081ba4

Please sign in to comment.