Fix run_action helper (#540)

* Fix run_action helper

* upgrade actions

* upgrade actions
This commit is contained in:
Saeed Vaziry
2025-03-05 20:36:18 +01:00
committed by GitHub
parent 5a12ed76bb
commit babf59350b
5 changed files with 23 additions and 20 deletions

View File

@ -67,17 +67,19 @@ function run_action(object $static, Closure $callback): void
try {
$callback();
} catch (SSHError $e) {
$actions = [];
if ($e->getLog()) {
$actions[] = Action::make('View Logs')
->url(App\Web\Pages\Servers\Logs\Index::getUrl([
'server' => $e->getLog()->server_id,
]))
->openUrlInNewTab();
}
Notification::make()
->danger()
->title($e->getMessage())
->body($e->getLog()?->getContent(30))
->actions([
Action::make('View Logs')
->url(App\Web\Pages\Servers\Logs\Index::getUrl([
'server' => $e->getLog()?->server_id,
]))
->openUrlInNewTab(),
])
->actions($actions)
->send();
if (method_exists($static, 'halt')) {