mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 23:54:44 +02:00
wip
This commit is contained in:
parent
7b12f8cb04
commit
9eb1710c3a
@ -237,12 +237,12 @@ class Settings extends Page implements HasSchemas
|
|||||||
$set('TRUSTED_PROXIES', $ips->values()->all());
|
$set('TRUSTED_PROXIES', $ips->values()->all());
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
Select::make('FILAMENT_WIDTH')
|
// Select::make('FILAMENT_WIDTH')
|
||||||
->label(trans('admin/setting.general.display_width'))
|
// ->label(trans('admin/setting.general.display_width'))
|
||||||
->native(false)
|
// ->native(false)
|
||||||
->options(Width::class)
|
// ->options(Width::class->value)
|
||||||
->selectablePlaceholder(false)
|
// ->selectablePlaceholder(false)
|
||||||
->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
// ->default(env('FILAMENT_WIDTH', config('panel.filament.display-width'))),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,19 +125,19 @@ class EditServer extends EditRecord
|
|||||||
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
|
->getOptionLabelFromRecordUsing(fn (User $user) => "$user->username ($user->email)")
|
||||||
->preload()
|
->preload()
|
||||||
->required(),
|
->required(),
|
||||||
|
//
|
||||||
ToggleButtons::make('condition')
|
// ToggleButtons::make('condition')
|
||||||
->label(trans('admin/server.server_status'))
|
// ->label(trans('admin/server.server_status'))
|
||||||
->formatStateUsing(fn (Server $server) => $server->condition)
|
// ->formatStateUsing(fn (Server $server) => $server->condition)
|
||||||
->options(fn ($state) => [$state->value => $state->getLabel()])
|
// ->options(fn ($state) => [$state->value => $state->getLabel()])
|
||||||
->colors(fn ($state) => [$state->value => $state->getColor()])
|
// ->colors(fn ($state) => [$state->value => $state->getColor()])
|
||||||
->icons(fn ($state) => [$state->value => $state->getIcon()])
|
// ->icons(fn ($state) => [$state->value => $state->getIcon()])
|
||||||
->columnSpan([
|
// ->columnSpan([
|
||||||
'default' => 2,
|
// 'default' => 2,
|
||||||
'sm' => 1,
|
// 'sm' => 1,
|
||||||
'md' => 1,
|
// 'md' => 1,
|
||||||
'lg' => 1,
|
// 'lg' => 1,
|
||||||
]),
|
// ]),
|
||||||
|
|
||||||
Textarea::make('description')
|
Textarea::make('description')
|
||||||
->label(trans('admin/server.description'))
|
->label(trans('admin/server.description'))
|
||||||
@ -392,6 +392,7 @@ class EditServer extends EditRecord
|
|||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->schema([
|
->schema([
|
||||||
ToggleButtons::make('oom_killer')
|
ToggleButtons::make('oom_killer')
|
||||||
|
->dehydrated()
|
||||||
->label(trans('admin/server.oom'))->inlineLabel()->inline()
|
->label(trans('admin/server.oom'))->inlineLabel()->inline()
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->options([
|
->options([
|
||||||
@ -827,7 +828,6 @@ class EditServer extends EditRecord
|
|||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.reinstall_failed'))
|
->title(trans('admin/server.notifications.reinstall_failed'))
|
||||||
@ -844,7 +844,6 @@ class EditServer extends EditRecord
|
|||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.install_toggle_failed'))
|
->title(trans('admin/server.notifications.install_toggle_failed'))
|
||||||
@ -875,7 +874,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.server_suspended'))
|
->title(trans('admin/server.notifications.server_suspended'))
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
@ -897,7 +895,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.server_unsuspended'))
|
->title(trans('admin/server.notifications.server_unsuspended'))
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
@ -962,8 +959,6 @@ class EditServer extends EditRecord
|
|||||||
->title(trans('admin/server.notifications.reinstall_started'))
|
->title(trans('admin/server.notifications.reinstall_started'))
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$this->refreshFormData(['status', 'docker']);
|
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title(trans('admin/server.notifications.reinstall_failed'))
|
->title(trans('admin/server.notifications.reinstall_failed'))
|
||||||
@ -1085,7 +1080,7 @@ class EditServer extends EditRecord
|
|||||||
$data['description'] = '';
|
$data['description'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['docker'], $data['status']);
|
unset($data['docker'], $data['condition']);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ use App\Filament\Server\Widgets\ServerOverview;
|
|||||||
use App\Livewire\AlertBanner;
|
use App\Livewire\AlertBanner;
|
||||||
use App\Models\Permission;
|
use App\Models\Permission;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
|
@ -30,32 +30,12 @@ abstract class ServerFormPage extends Page
|
|||||||
|
|
||||||
protected function authorizeAccess(): void {}
|
protected function authorizeAccess(): void {}
|
||||||
|
|
||||||
protected function fillForm(): void
|
protected function fillform(): void
|
||||||
{
|
{
|
||||||
$data = $this->getRecord()->attributesToArray();
|
$data = $this->getRecord()->attributesToArray();
|
||||||
$this->form->fill($data);
|
$this->form->fill($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array<int | string, string | Form>
|
|
||||||
*/
|
|
||||||
protected function getFormSchema(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'schema' => $this->form($this->makeSchema()
|
|
||||||
->model($this->getRecord())
|
|
||||||
->statePath($this->getFormStatePath())
|
|
||||||
->columns($this->hasInlineLabels() ? 1 : 2)
|
|
||||||
->inlineLabel($this->hasInlineLabels()),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormStatePath(): ?string
|
|
||||||
{
|
|
||||||
return 'data';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRecord(): Server
|
public function getRecord(): Server
|
||||||
{
|
{
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
|
@ -23,7 +23,6 @@ use Filament\Resources\Pages\PageRegistration;
|
|||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Support\Enums\Alignment;
|
use Filament\Support\Enums\Alignment;
|
||||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||||
use Illuminate\Http\Client\ConnectionException;
|
|
||||||
use Illuminate\Routing\Route;
|
use Illuminate\Routing\Route;
|
||||||
use Illuminate\Support\Facades\Route as RouteFacade;
|
use Illuminate\Support\Facades\Route as RouteFacade;
|
||||||
use Livewire\Attributes\Locked;
|
use Livewire\Attributes\Locked;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user