mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 18:01:37 +00:00
[2.x] [Filament] Update deprecated getFormSchema
method to use form()
override (#354)
This commit is contained in:
parent
acdbfa70f5
commit
d4ec4c66ed
@ -55,10 +55,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
->heading('')
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('logs')
|
Action::make('logs')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -46,10 +46,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
->heading('')
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->recordUrl(fn (Script $record) => Executions::getUrl(['script' => $record]))
|
->recordUrl(fn (Script $record) => Executions::getUrl(['script' => $record]))
|
||||||
->actions([
|
->actions([
|
||||||
EditAction::make('edit')
|
EditAction::make('edit')
|
||||||
|
@ -25,8 +25,6 @@ protected function getTableQuery(): Builder
|
|||||||
return CronJob::query()->where('server_id', $this->server->id);
|
return CronJob::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -52,9 +50,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('enable')
|
Action::make('enable')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -26,8 +26,6 @@ protected function getTableQuery(): Builder
|
|||||||
return BackupFile::query()->where('backup_id', $this->backup->id);
|
return BackupFile::query()->where('backup_id', $this->backup->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -54,9 +52,12 @@ protected function applyDefaultSortingToTableQuery(Builder $query): Builder
|
|||||||
return $query->latest('created_at');
|
return $query->latest('created_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('restore')
|
Action::make('restore')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -24,8 +24,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Backup::query()->where('server_id', $this->server->id);
|
return Backup::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -52,9 +50,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('files')
|
Action::make('files')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -27,8 +27,6 @@ protected function getTableQuery(): Builder
|
|||||||
return DatabaseUser::query()->where('server_id', $this->server->id);
|
return DatabaseUser::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -46,9 +44,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
$this->passwordAction(),
|
$this->passwordAction(),
|
||||||
$this->linkAction(),
|
$this->linkAction(),
|
||||||
|
@ -22,8 +22,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Database::query()->where('server_id', $this->server->id);
|
return Database::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -41,9 +39,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('delete')
|
Action::make('delete')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -23,8 +23,6 @@ protected function getTableQuery(): Builder
|
|||||||
return FirewallRule::query()->where('server_id', $this->server->id);
|
return FirewallRule::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -44,9 +42,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('delete')
|
Action::make('delete')
|
||||||
->icon('heroicon-o-trash')
|
->icon('heroicon-o-trash')
|
||||||
|
@ -23,8 +23,6 @@ class LogsList extends Widget
|
|||||||
|
|
||||||
public ?Site $site = null;
|
public ?Site $site = null;
|
||||||
|
|
||||||
public ?string $label = '';
|
|
||||||
|
|
||||||
public bool $remote = false;
|
public bool $remote = false;
|
||||||
|
|
||||||
protected $listeners = ['$refresh'];
|
protected $listeners = ['$refresh'];
|
||||||
@ -63,9 +61,12 @@ protected function applyDefaultSortingToTableQuery(Builder $query): Builder
|
|||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->filters([
|
->filters([
|
||||||
Filter::make('created_at')
|
Filter::make('created_at')
|
||||||
->form([
|
->form([
|
||||||
@ -84,7 +85,6 @@ public function getTable(): Table
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->heading($this->label)
|
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('view')
|
Action::make('view')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -35,8 +35,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Service::query()->where('type', 'php')->where('server_id', $this->server->id);
|
return Service::query()->where('type', 'php')->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -62,9 +60,12 @@ protected function getTableColumns(): array
|
|||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
ActionGroup::make([
|
ActionGroup::make([
|
||||||
$this->installExtensionAction(),
|
$this->installExtensionAction(),
|
||||||
|
@ -28,8 +28,6 @@ protected function getTableQuery(): Builder
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -44,9 +42,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
DeleteAction::make('delete')
|
DeleteAction::make('delete')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -28,8 +28,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Service::query()->where('server_id', $this->server->id);
|
return Service::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = 'Installed Services';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -56,9 +54,12 @@ protected function getTableColumns(): array
|
|||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading('Installed Services')
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
ActionGroup::make([
|
ActionGroup::make([
|
||||||
$this->serviceAction('start', 'heroicon-o-play'),
|
$this->serviceAction('start', 'heroicon-o-play'),
|
||||||
|
@ -34,8 +34,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Queue::query()->where('site_id', $this->site->id);
|
return Queue::query()->where('site_id', $this->site->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -57,9 +55,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
ActionGroup::make([
|
ActionGroup::make([
|
||||||
$this->editAction(),
|
$this->editAction(),
|
||||||
|
@ -24,8 +24,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Ssl::query()->where('site_id', $this->site->id);
|
return Ssl::query()->where('site_id', $this->site->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -47,9 +45,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('logs')
|
Action::make('logs')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
|
@ -22,8 +22,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Site::query()->where('server_id', $this->server->id);
|
return Site::query()->where('server_id', $this->server->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -54,9 +52,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->recordUrl(fn (Site $record) => View::getUrl(parameters: ['server' => $this->server, 'site' => $record]))
|
->recordUrl(fn (Site $record) => View::getUrl(parameters: ['server' => $this->server, 'site' => $record]))
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('settings')
|
Action::make('settings')
|
||||||
|
@ -19,8 +19,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Server::query()->where('project_id', auth()->user()->current_project_id);
|
return Server::query()->where('project_id', auth()->user()->current_project_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -53,9 +51,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->recordUrl(fn (Server $record) => View::getUrl(parameters: ['server' => $record]))
|
->recordUrl(fn (Server $record) => View::getUrl(parameters: ['server' => $record]))
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('settings')
|
Action::make('settings')
|
||||||
|
@ -41,10 +41,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
->heading('')
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
DeleteAction::make('delete')
|
DeleteAction::make('delete')
|
||||||
->modalHeading('Delete Token')
|
->modalHeading('Delete Token')
|
||||||
|
@ -47,10 +47,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
->heading('')
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
EditAction::make('edit')
|
EditAction::make('edit')
|
||||||
->modalHeading('Edit Notification Channel')
|
->modalHeading('Edit Notification Channel')
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
|
|
||||||
@ -33,36 +34,37 @@ public function mount(): void
|
|||||||
$this->timezone = auth()->user()->timezone;
|
$this->timezone = auth()->user()->timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormSchema(): array
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
$rules = UpdateUserProfileInformation::rules(auth()->user());
|
$rules = UpdateUserProfileInformation::rules(auth()->user());
|
||||||
|
|
||||||
return [
|
return $form
|
||||||
Section::make()
|
->schema([
|
||||||
->heading('Profile Information')
|
Section::make()
|
||||||
->description('Update your account\'s profile information and email address.')
|
->heading('Profile Information')
|
||||||
->schema([
|
->description('Update your account\'s profile information and email address.')
|
||||||
TextInput::make('name')
|
->schema([
|
||||||
->label('Name')
|
TextInput::make('name')
|
||||||
->rules($rules['name']),
|
->label('Name')
|
||||||
TextInput::make('email')
|
->rules($rules['name']),
|
||||||
->label('Email')
|
TextInput::make('email')
|
||||||
->rules($rules['email']),
|
->label('Email')
|
||||||
Select::make('timezone')
|
->rules($rules['email']),
|
||||||
->label('Timezone')
|
Select::make('timezone')
|
||||||
->searchable()
|
->label('Timezone')
|
||||||
->options(
|
->searchable()
|
||||||
collect(timezone_identifiers_list())
|
->options(
|
||||||
->mapWithKeys(fn ($timezone) => [$timezone => $timezone])
|
collect(timezone_identifiers_list())
|
||||||
)
|
->mapWithKeys(fn ($timezone) => [$timezone => $timezone])
|
||||||
->rules($rules['timezone']),
|
)
|
||||||
])
|
->rules($rules['timezone']),
|
||||||
->footerActions([
|
])
|
||||||
Action::make('save')
|
->footerActions([
|
||||||
->label('Save')
|
Action::make('save')
|
||||||
->action(fn () => $this->submit()),
|
->label('Save')
|
||||||
]),
|
->action(fn () => $this->submit()),
|
||||||
];
|
]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(): void
|
public function submit(): void
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
|
|
||||||
@ -25,34 +26,35 @@ class UpdatePassword extends Widget implements HasForms
|
|||||||
|
|
||||||
public string $password_confirmation = '';
|
public string $password_confirmation = '';
|
||||||
|
|
||||||
public function getFormSchema(): array
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
$rules = UpdateUserPassword::rules();
|
$rules = UpdateUserPassword::rules();
|
||||||
|
|
||||||
return [
|
return $form
|
||||||
Section::make()
|
->schema([
|
||||||
->heading('Update Password')
|
Section::make()
|
||||||
->description('Ensure your account is using a long, random password to stay secure.')
|
->heading('Update Password')
|
||||||
->schema([
|
->description('Ensure your account is using a long, random password to stay secure.')
|
||||||
TextInput::make('current_password')
|
->schema([
|
||||||
->label('Current Password')
|
TextInput::make('current_password')
|
||||||
->password()
|
->label('Current Password')
|
||||||
->rules($rules['current_password']),
|
->password()
|
||||||
TextInput::make('password')
|
->rules($rules['current_password']),
|
||||||
->label('New Password')
|
TextInput::make('password')
|
||||||
->password()
|
->label('New Password')
|
||||||
->rules($rules['password']),
|
->password()
|
||||||
TextInput::make('password_confirmation')
|
->rules($rules['password']),
|
||||||
->label('Confirm Password')
|
TextInput::make('password_confirmation')
|
||||||
->password()
|
->label('Confirm Password')
|
||||||
->rules($rules['password_confirmation']),
|
->password()
|
||||||
])
|
->rules($rules['password_confirmation']),
|
||||||
->footerActions([
|
])
|
||||||
Action::make('save')
|
->footerActions([
|
||||||
->label('Save')
|
Action::make('save')
|
||||||
->action(fn () => $this->submit()),
|
->label('Save')
|
||||||
]),
|
->action(fn () => $this->submit()),
|
||||||
];
|
]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(): void
|
public function submit(): void
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
|
|
||||||
@ -27,24 +28,25 @@ public function mount(Project $project): void
|
|||||||
$this->project = $project;
|
$this->project = $project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormSchema(): array
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return [
|
return $form
|
||||||
Section::make()
|
->schema([
|
||||||
->heading('Add User')
|
Section::make()
|
||||||
->schema([
|
->heading('Add User')
|
||||||
Select::make('user')
|
->schema([
|
||||||
->name('user')
|
Select::make('user')
|
||||||
->options(fn () => User::query()->pluck('name', 'id'))
|
->name('user')
|
||||||
->searchable()
|
->options(fn () => User::query()->pluck('name', 'id'))
|
||||||
->rules(\App\Actions\Projects\AddUser::rules($this->project)['user']),
|
->searchable()
|
||||||
])
|
->rules(\App\Actions\Projects\AddUser::rules($this->project)['user']),
|
||||||
->footerActions([
|
])
|
||||||
Action::make('add')
|
->footerActions([
|
||||||
->label('Add')
|
Action::make('add')
|
||||||
->action(fn () => $this->submit()),
|
->label('Add')
|
||||||
]),
|
->action(fn () => $this->submit()),
|
||||||
];
|
]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(): void
|
public function submit(): void
|
||||||
|
@ -36,18 +36,23 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table->actions([
|
return $table
|
||||||
Tables\Actions\DeleteAction::make()
|
->heading(null)
|
||||||
->label('Remove')
|
->query($this->getTableQuery())
|
||||||
->modalHeading('Remove user from project')
|
->columns($this->getTableColumns())
|
||||||
->visible(function ($record) {
|
->actions([
|
||||||
return $this->authorize('update', $this->project)->allowed() && $record->id !== auth()->id();
|
Tables\Actions\DeleteAction::make()
|
||||||
})
|
->label('Remove')
|
||||||
->using(function ($record) {
|
->modalHeading('Remove user from project')
|
||||||
$this->project->users()->detach($record);
|
->visible(function ($record) {
|
||||||
}),
|
return $this->authorize('update', $this->project)->allowed() && $record->id !== auth()->id();
|
||||||
])->paginated(false);
|
})
|
||||||
|
->using(function ($record) {
|
||||||
|
$this->project->users()->detach($record);
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->paginated(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@ protected function getTableQuery(): Builder
|
|||||||
return Project::query();
|
return Project::query();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -35,9 +33,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->recordUrl(fn (Project $record) => Settings::getUrl(['project' => $record]))
|
->recordUrl(fn (Project $record) => Settings::getUrl(['project' => $record]))
|
||||||
->actions([
|
->actions([
|
||||||
Action::make('settings')
|
Action::make('settings')
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
|
|
||||||
@ -27,24 +28,25 @@ public function mount(Project $project): void
|
|||||||
$this->name = $project->name;
|
$this->name = $project->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormSchema(): array
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return [
|
return $form
|
||||||
Section::make()
|
->schema([
|
||||||
->heading('Project Information')
|
Section::make()
|
||||||
->schema([
|
->heading('Project Information')
|
||||||
TextInput::make('name')
|
->schema([
|
||||||
->name('name')
|
TextInput::make('name')
|
||||||
->label('Name')
|
->name('name')
|
||||||
->rules(\App\Actions\Projects\UpdateProject::rules($this->project)['name'])
|
->label('Name')
|
||||||
->placeholder('Enter the project name'),
|
->rules(\App\Actions\Projects\UpdateProject::rules($this->project)['name'])
|
||||||
])
|
->placeholder('Enter the project name'),
|
||||||
->footerActions([
|
])
|
||||||
Action::make('save')
|
->footerActions([
|
||||||
->label('Save')
|
Action::make('save')
|
||||||
->action(fn () => $this->submit()),
|
->label('Save')
|
||||||
]),
|
->action(fn () => $this->submit()),
|
||||||
];
|
]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(): void
|
public function submit(): void
|
||||||
|
@ -18,8 +18,6 @@ protected function getTableQuery(): Builder
|
|||||||
return SshKey::query()->where('user_id', auth()->id());
|
return SshKey::query()->where('user_id', auth()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -35,9 +33,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
DeleteAction::make('delete')
|
DeleteAction::make('delete')
|
||||||
->requiresConfirmation()
|
->requiresConfirmation()
|
||||||
|
@ -25,8 +25,6 @@ protected function getTableQuery(): Builder
|
|||||||
return ServerProvider::getByProjectId(auth()->user()->current_project_id);
|
return ServerProvider::getByProjectId(auth()->user()->current_project_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -53,36 +51,40 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table->actions([
|
return $table
|
||||||
EditAction::make('edit')
|
->heading(null)
|
||||||
->label('Edit')
|
->query($this->getTableQuery())
|
||||||
->modalHeading('Edit Server Provider')
|
->columns($this->getTableColumns())
|
||||||
->mutateRecordDataUsing(function (array $data, ServerProvider $record) {
|
->actions([
|
||||||
return [
|
EditAction::make('edit')
|
||||||
'name' => $record->profile,
|
->label('Edit')
|
||||||
'global' => $record->project_id === null,
|
->modalHeading('Edit Server Provider')
|
||||||
];
|
->mutateRecordDataUsing(function (array $data, ServerProvider $record) {
|
||||||
})
|
return [
|
||||||
->form(Edit::form())
|
'name' => $record->profile,
|
||||||
->authorize(fn (ServerProvider $record) => auth()->user()->can('update', $record))
|
'global' => $record->project_id === null,
|
||||||
->using(fn (array $data, ServerProvider $record) => Edit::action($record, $data))
|
];
|
||||||
->modalWidth(MaxWidth::Medium),
|
})
|
||||||
DeleteAction::make('delete')
|
->form(Edit::form())
|
||||||
->label('Delete')
|
->authorize(fn (ServerProvider $record) => auth()->user()->can('update', $record))
|
||||||
->modalHeading('Delete Server Provider')
|
->using(fn (array $data, ServerProvider $record) => Edit::action($record, $data))
|
||||||
->authorize(fn (ServerProvider $record) => auth()->user()->can('delete', $record))
|
->modalWidth(MaxWidth::Medium),
|
||||||
->using(function (array $data, ServerProvider $record) {
|
DeleteAction::make('delete')
|
||||||
try {
|
->label('Delete')
|
||||||
app(DeleteServerProvider::class)->delete($record);
|
->modalHeading('Delete Server Provider')
|
||||||
} catch (Exception $e) {
|
->authorize(fn (ServerProvider $record) => auth()->user()->can('delete', $record))
|
||||||
Notification::make()
|
->using(function (array $data, ServerProvider $record) {
|
||||||
->danger()
|
try {
|
||||||
->title($e->getMessage())
|
app(DeleteServerProvider::class)->delete($record);
|
||||||
->send();
|
} catch (Exception $e) {
|
||||||
}
|
Notification::make()
|
||||||
}),
|
->danger()
|
||||||
]);
|
->title($e->getMessage())
|
||||||
|
->send();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@ protected function getTableQuery(): Builder
|
|||||||
return SourceControl::getByProjectId(auth()->user()->current_project_id);
|
return SourceControl::getByProjectId(auth()->user()->current_project_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -53,45 +51,49 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table->actions([
|
return $table
|
||||||
EditAction::make('edit')
|
->heading(null)
|
||||||
->label('Edit')
|
->query($this->getTableQuery())
|
||||||
->modalHeading('Edit Source Control')
|
->columns($this->getTableColumns())
|
||||||
->fillForm(function (array $data, SourceControl $record) {
|
->actions([
|
||||||
return [
|
EditAction::make('edit')
|
||||||
'provider' => $record->provider,
|
->label('Edit')
|
||||||
'name' => $record->profile,
|
->modalHeading('Edit Source Control')
|
||||||
'token' => $record->provider_data['token'] ?? null,
|
->fillForm(function (array $data, SourceControl $record) {
|
||||||
'username' => $record->provider_data['username'] ?? null,
|
return [
|
||||||
'password' => $record->provider_data['password'] ?? null,
|
'provider' => $record->provider,
|
||||||
'global' => $record->project_id === null,
|
'name' => $record->profile,
|
||||||
];
|
'token' => $record->provider_data['token'] ?? null,
|
||||||
})
|
'username' => $record->provider_data['username'] ?? null,
|
||||||
->form(fn (SourceControl $record) => Edit::form($record))
|
'password' => $record->provider_data['password'] ?? null,
|
||||||
->authorize(fn (SourceControl $record) => auth()->user()->can('update', $record))
|
'global' => $record->project_id === null,
|
||||||
->using(fn (array $data, SourceControl $record) => Edit::action($record, $data))
|
];
|
||||||
->modalWidth(MaxWidth::Medium),
|
})
|
||||||
Action::make('delete')
|
->form(fn (SourceControl $record) => Edit::form($record))
|
||||||
->label('Delete')
|
->authorize(fn (SourceControl $record) => auth()->user()->can('update', $record))
|
||||||
->icon('heroicon-o-trash')
|
->using(fn (array $data, SourceControl $record) => Edit::action($record, $data))
|
||||||
->color('danger')
|
->modalWidth(MaxWidth::Medium),
|
||||||
->requiresConfirmation()
|
Action::make('delete')
|
||||||
->modalHeading('Delete Source Control')
|
->label('Delete')
|
||||||
->authorize(fn (SourceControl $record) => auth()->user()->can('delete', $record))
|
->icon('heroicon-o-trash')
|
||||||
->action(function (array $data, SourceControl $record) {
|
->color('danger')
|
||||||
try {
|
->requiresConfirmation()
|
||||||
app(DeleteSourceControl::class)->delete($record);
|
->modalHeading('Delete Source Control')
|
||||||
|
->authorize(fn (SourceControl $record) => auth()->user()->can('delete', $record))
|
||||||
|
->action(function (array $data, SourceControl $record) {
|
||||||
|
try {
|
||||||
|
app(DeleteSourceControl::class)->delete($record);
|
||||||
|
|
||||||
$this->dispatch('$refresh');
|
$this->dispatch('$refresh');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title($e->getMessage())
|
->title($e->getMessage())
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@ protected function getTableQuery(): Builder
|
|||||||
return StorageProvider::getByProjectId(auth()->user()->current_project_id);
|
return StorageProvider::getByProjectId(auth()->user()->current_project_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -53,36 +51,40 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table->actions([
|
return $table
|
||||||
EditAction::make('edit')
|
->heading(null)
|
||||||
->label('Edit')
|
->query($this->getTableQuery())
|
||||||
->modalHeading('Edit Storage Provider')
|
->columns($this->getTableColumns())
|
||||||
->mutateRecordDataUsing(function (array $data, StorageProvider $record) {
|
->actions([
|
||||||
return [
|
EditAction::make('edit')
|
||||||
'name' => $record->profile,
|
->label('Edit')
|
||||||
'global' => $record->project_id === null,
|
->modalHeading('Edit Storage Provider')
|
||||||
];
|
->mutateRecordDataUsing(function (array $data, StorageProvider $record) {
|
||||||
})
|
return [
|
||||||
->form(Edit::form())
|
'name' => $record->profile,
|
||||||
->authorize(fn (StorageProvider $record) => auth()->user()->can('update', $record))
|
'global' => $record->project_id === null,
|
||||||
->using(fn (array $data, StorageProvider $record) => Edit::action($record, $data))
|
];
|
||||||
->modalWidth(MaxWidth::Medium),
|
})
|
||||||
DeleteAction::make('delete')
|
->form(Edit::form())
|
||||||
->label('Delete')
|
->authorize(fn (StorageProvider $record) => auth()->user()->can('update', $record))
|
||||||
->modalHeading('Delete Storage Provider')
|
->using(fn (array $data, StorageProvider $record) => Edit::action($record, $data))
|
||||||
->authorize(fn (StorageProvider $record) => auth()->user()->can('delete', $record))
|
->modalWidth(MaxWidth::Medium),
|
||||||
->using(function (array $data, StorageProvider $record) {
|
DeleteAction::make('delete')
|
||||||
try {
|
->label('Delete')
|
||||||
app(DeleteStorageProvider::class)->delete($record);
|
->modalHeading('Delete Storage Provider')
|
||||||
} catch (\Exception $e) {
|
->authorize(fn (StorageProvider $record) => auth()->user()->can('delete', $record))
|
||||||
Notification::make()
|
->using(function (array $data, StorageProvider $record) {
|
||||||
->danger()
|
try {
|
||||||
->title($e->getMessage())
|
app(DeleteStorageProvider::class)->delete($record);
|
||||||
->send();
|
} catch (\Exception $e) {
|
||||||
}
|
Notification::make()
|
||||||
}),
|
->danger()
|
||||||
]);
|
->title($e->getMessage())
|
||||||
|
->send();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ protected function getTableColumns(): array
|
|||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->heading('')
|
->heading(null)
|
||||||
->query($this->getTableQuery())
|
->query($this->getTableQuery())
|
||||||
->columns($this->getTableColumns())
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
|
@ -29,8 +29,6 @@ protected function getTableQuery(): Builder
|
|||||||
return User::query();
|
return User::query();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static ?string $heading = '';
|
|
||||||
|
|
||||||
protected function getTableColumns(): array
|
protected function getTableColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -50,9 +48,12 @@ protected function getTableColumns(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTable(): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $this->table
|
return $table
|
||||||
|
->heading(null)
|
||||||
|
->query($this->getTableQuery())
|
||||||
|
->columns($this->getTableColumns())
|
||||||
->actions([
|
->actions([
|
||||||
EditAction::make('edit')
|
EditAction::make('edit')
|
||||||
->authorize(fn ($record) => auth()->user()->can('update', $record))
|
->authorize(fn ($record) => auth()->user()->can('update', $record))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user