Merge branch 'main' of github.com:pelican-dev/panel

This commit is contained in:
Lance Pioch 2024-05-07 20:00:08 -04:00
commit 4e838201c6
4 changed files with 22347 additions and 1796 deletions

View File

@ -6,6 +6,7 @@ use Illuminate\Console\Command;
use App\Models\Schedule; use App\Models\Schedule;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use App\Services\Schedules\ProcessScheduleService; use App\Services\Schedules\ProcessScheduleService;
use Carbon\Carbon;
class ProcessRunnableCommand extends Command class ProcessRunnableCommand extends Command
{ {
@ -23,7 +24,7 @@ class ProcessRunnableCommand extends Command
->whereRelation('server', fn (Builder $builder) => $builder->whereNull('status')) ->whereRelation('server', fn (Builder $builder) => $builder->whereNull('status'))
->where('is_active', true) ->where('is_active', true)
->where('is_processing', false) ->where('is_processing', false)
->whereRaw('next_run_at <= NOW()') ->whereDate('next_run_at', '<=', Carbon::now()->toDateString())
->get(); ->get();
if ($schedules->count() < 1) { if ($schedules->count() < 1) {

View File

@ -481,130 +481,70 @@ class CreateServer extends CreateRecord
]), ]),
Forms\Components\Section::make('Resource Management') Forms\Components\Section::make('Resource Management')
// ->hiddenOn('create')
->collapsed() ->collapsed()
->icon('tabler-server-cog') ->icon('tabler-server-cog')
->iconColor('primary') ->iconColor('primary')
->columns([ ->columns(2)
->columnSpan(([
'default' => 2, 'default' => 2,
'sm' => 4, 'sm' => 4,
'md' => 4, 'md' => 4,
'lg' => 4, 'lg' => 6,
]) ]))
->schema([ ->schema([
Forms\Components\ToggleButtons::make('unlimited_mem')
->label('Memory')
->afterStateUpdated(fn (Forms\Set $set) => $set('memory', 0))
->inlineLabel()->inline()
->live()
->formatStateUsing(fn (Forms\Get $get) => $get('memory') <= 0)
->options([
true => 'Unlimited',
false => 'Limited',
])
->colors([
true => 'primary',
false => 'warning',
])
->columnSpan(2),
Forms\Components\TextInput::make('memory') Forms\Components\TextInput::make('memory')
->disabled(fn (Forms\Get $get) => $get('unlimited_mem')) ->default(0)
->label('Memory Limit') ->label('Allocated Memory')
->suffix('MB') ->suffix('MB')
->required() ->required()
->inlineLabel()
->columnSpan(2)
->numeric(), ->numeric(),
Forms\Components\ToggleButtons::make('unlimited_disk') Forms\Components\TextInput::make('swap')
->label('Disk Space') ->default(0)
->inlineLabel()->inline() ->label('Swap Memory')
->live() ->suffix('MB')
->afterStateUpdated(fn (Forms\Set $set) => $set('disk', 0)) ->helperText('0 disables swap and -1 allows unlimited swap')
->formatStateUsing(fn (Forms\Get $get) => $get('disk') <= 0) ->minValue(-1)
->options([ ->required()
true => 'Unlimited', ->numeric(),
false => 'Limited',
])
->colors([
true => 'primary',
false => 'warning',
])
->columnSpan(2),
Forms\Components\TextInput::make('disk') Forms\Components\TextInput::make('disk')
->disabled(fn (Forms\Get $get) => $get('unlimited_disk')) ->default(0)
->label('Disk Space Limit') ->label('Disk Space Limit')
->suffix('MB') ->suffix('MB')
->required() ->required()
->inlineLabel()
->columnSpan(2)
->numeric(), ->numeric(),
Forms\Components\ToggleButtons::make('unlimited_cpu')
->label('CPU')
->inlineLabel()->inline()
->afterStateUpdated(fn (Forms\Set $set) => $set('cpu', 0))
->live()
->formatStateUsing(fn (Forms\Get $get) => $get('cpu') <= 0)
->options([
true => 'Unlimited',
false => 'Limited',
])
->colors([
true => 'primary',
false => 'warning',
])
->columnSpan(2),
Forms\Components\TextInput::make('cpu') Forms\Components\TextInput::make('cpu')
->disabled(fn (Forms\Get $get) => $get('unlimited_cpu')) ->default(0)
->label('CPU Limit') ->label('CPU Limit')
->suffix('%') ->suffix('%')
->required() ->required()
->inlineLabel()
->columnSpan(2)
->numeric(), ->numeric(),
Forms\Components\Hidden::make('io') Forms\Components\TextInput::make('threads')
->hint('Advanced')
->hintColor('danger')
->helperText('Examples: 0, 0-1,3, or 0,1,3,4')
->label('CPU Pinning')
->suffixIcon('tabler-cpu')
->maxLength(191),
Forms\Components\TextInput::make('io')
->helperText('The IO performance relative to other running containers') ->helperText('The IO performance relative to other running containers')
->label('Block IO Proportion') ->label('Block IO Proportion')
->required(),
// ->numeric()
// ->minValue(0)
// ->maxValue(1000)
// ->step(10)
Forms\Components\ToggleButtons::make('swap_support')
->label('Enable Swap Memory')
->columnSpan(2)
->inlineLabel()->inline()
->formatStateUsing(fn (Forms\Get $get) => $get('swap') <= 0)
->options([
'unlimited' => 'Unlimited',
'limited' => 'Limited',
'disabled' => 'Disabled',
])
->colors([
'unlimited' => 'primary',
'limited' => 'warning',
'disabled' => 'danger',
]),
Forms\Components\TextInput::make('swap')
->disabled(fn (Forms\Get $get) => $get('swap_support'))
->label('Swap Memory')
->suffix('MB')
->minValue(-1)
->columnSpan(2)
->inlineLabel()
->required() ->required()
->minValue(0)
->maxValue(1000)
->step(10)
->default(0)
->numeric(), ->numeric(),
Forms\Components\ToggleButtons::make('oom_disabled') Forms\Components\ToggleButtons::make('oom_disabled')
->label('OOM Killer') ->label('OOM Killer')
->inline() ->inline()
->columnSpan(2) ->default(false)
->options([ ->options([
false => 'Disabled', false => 'Disabled',
true => 'Enabled', true => 'Enabled',
@ -612,7 +552,12 @@ class CreateServer extends CreateRecord
->colors([ ->colors([
false => 'success', false => 'success',
true => 'danger', true => 'danger',
]), ])
->icons([
false => 'tabler-sword-off',
true => 'tabler-sword',
])
->required(),
]), ]),
]); ]);
} }

20150
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

3861
yarn.lock

File diff suppressed because it is too large Load Diff