fix dashes on the name and better error handling (#336)

This commit is contained in:
Saeed Vaziry
2024-11-02 22:44:02 +01:00
committed by GitHub
parent f743611b22
commit 6639fac9c0
16 changed files with 53 additions and 96 deletions

View File

@ -5,7 +5,6 @@
use App\Actions\FirewallRule\CreateRule;
use App\Models\FirewallRule;
use App\Web\Pages\Servers\Page;
use Exception;
use Filament\Actions\Action;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
@ -69,18 +68,16 @@ protected function getHeaderActions(): array
->rules(CreateRule::rules()['mask']),
])
->action(function (array $data) {
try {
run_action($this, function () use ($data) {
app(CreateRule::class)->create($this->server, $data);
} catch (Exception $e) {
$this->dispatch('$refresh');
Notification::make()
->danger()
->title($e->getMessage())
->success()
->title('Firewall rule created!')
->send();
throw $e;
}
$this->dispatch('$refresh');
});
}),
];
}