mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-05 16:02:34 +00:00
tests
This commit is contained in:
@ -5,6 +5,8 @@
|
||||
use App\Actions\ServerProvider\DeleteServerProvider;
|
||||
use App\Models\ServerProvider;
|
||||
use App\Web\Pages\Settings\ServerProviders\Actions\Edit;
|
||||
use Exception;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
@ -70,7 +72,14 @@ public function getTable(): Table
|
||||
->modalHeading('Delete Server Provider')
|
||||
->authorize(fn (ServerProvider $record) => auth()->user()->can('delete', $record))
|
||||
->using(function (array $data, ServerProvider $record) {
|
||||
app(DeleteServerProvider::class)->delete($record);
|
||||
try {
|
||||
app(DeleteServerProvider::class)->delete($record);
|
||||
} catch (Exception $e) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title($e->getMessage())
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
@ -5,8 +5,10 @@
|
||||
use App\Actions\SourceControl\DeleteSourceControl;
|
||||
use App\Models\SourceControl;
|
||||
use App\Web\Pages\Settings\SourceControls\Actions\Edit;
|
||||
use Exception;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\Action;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
@ -71,14 +73,24 @@ public function getTable(): Table
|
||||
->authorize(fn (SourceControl $record) => auth()->user()->can('update', $record))
|
||||
->using(fn (array $data, SourceControl $record) => Edit::action($record, $data))
|
||||
->modalWidth(MaxWidth::Medium),
|
||||
DeleteAction::make('delete')
|
||||
Action::make('delete')
|
||||
->label('Delete')
|
||||
->icon('heroicon-o-trash')
|
||||
->color('danger')
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Delete Source Control')
|
||||
->authorize(fn (SourceControl $record) => auth()->user()->can('delete', $record))
|
||||
->using(function (array $data, SourceControl $record) {
|
||||
app(DeleteSourceControl::class)->delete($record);
|
||||
->action(function (array $data, SourceControl $record) {
|
||||
try {
|
||||
app(DeleteSourceControl::class)->delete($record);
|
||||
|
||||
$this->dispatch('$refresh');
|
||||
$this->dispatch('$refresh');
|
||||
} catch (Exception $e) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title($e->getMessage())
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use App\Enums\StorageProvider;
|
||||
use App\Web\Components\Page;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
|
||||
class Index extends Page
|
||||
@ -34,16 +34,19 @@ public function getWidgets(): array
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
Action::make('connect')
|
||||
->label('Connect')
|
||||
->icon('heroicon-o-wifi')
|
||||
->modalHeading('Connect to a Storage Provider')
|
||||
->modalSubmitActionLabel('Connect')
|
||||
->createAnother(false)
|
||||
->form(Actions\Create::form())
|
||||
->authorize('create', StorageProvider::class)
|
||||
->modalWidth(MaxWidth::ExtraLarge)
|
||||
->using(fn (array $data) => Actions\Create::action($data)),
|
||||
->action(function (array $data) {
|
||||
Actions\Create::action($data);
|
||||
|
||||
$this->dispatch('$refresh');
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
use App\Actions\StorageProvider\DeleteStorageProvider;
|
||||
use App\Models\StorageProvider;
|
||||
use App\Web\Pages\Settings\StorageProviders\Actions\Edit;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Actions\EditAction;
|
||||
@ -71,7 +72,14 @@ public function getTable(): Table
|
||||
->modalHeading('Delete Storage Provider')
|
||||
->authorize(fn (StorageProvider $record) => auth()->user()->can('delete', $record))
|
||||
->using(function (array $data, StorageProvider $record) {
|
||||
app(DeleteStorageProvider::class)->delete($record);
|
||||
try {
|
||||
app(DeleteStorageProvider::class)->delete($record);
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title($e->getMessage())
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user