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