mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
fix dashes on the name and better error handling (#336)
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
use App\Actions\Database\LinkUser;
|
||||
use App\Models\DatabaseUser;
|
||||
use App\Models\Server;
|
||||
use Exception;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
@ -98,21 +97,14 @@ private function linkAction(): Action
|
||||
->default(fn (DatabaseUser $record) => $record->databases),
|
||||
])
|
||||
->action(function (DatabaseUser $record, array $data) {
|
||||
try {
|
||||
run_action($this, function () use ($record, $data) {
|
||||
app(LinkUser::class)->link($record, $data);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('User linked to databases!')
|
||||
->send();
|
||||
} catch (Exception $e) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title($e->getMessage())
|
||||
->send();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -127,18 +119,10 @@ private function deleteAction(): Action
|
||||
->authorize(fn ($record) => auth()->user()->can('delete', $record))
|
||||
->requiresConfirmation()
|
||||
->action(function (DatabaseUser $record) {
|
||||
try {
|
||||
run_action($this, function () use ($record) {
|
||||
app(DeleteDatabaseUser::class)->delete($this->server, $record);
|
||||
} catch (Exception $e) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title($e->getMessage())
|
||||
->send();
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->dispatch('$refresh');
|
||||
$this->dispatch('$refresh');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user