mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 15:02:34 +00:00
- 2.x - sites (wip)
- improved ssh error handling - database soft deletes
This commit is contained in:
@ -2,26 +2,18 @@
|
||||
|
||||
namespace App\Web\Pages\Servers\Console;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\Web\Components\Page;
|
||||
use App\Web\Traits\PageHasServer;
|
||||
use App\Web\Pages\Servers\Page;
|
||||
|
||||
class Index extends Page
|
||||
{
|
||||
use PageHasServer;
|
||||
|
||||
protected ?string $live = '';
|
||||
|
||||
protected $listeners = [];
|
||||
|
||||
protected static ?string $slug = 'servers/{server}/console';
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
protected static ?string $title = 'Console';
|
||||
|
||||
public Server $server;
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return auth()->user()?->can('update', static::getServerFromRoute()) ?? false;
|
||||
|
@ -61,15 +61,13 @@ public function form(Form $form): Form
|
||||
$this->running = true;
|
||||
$ssh = $this->server->ssh($this->data['user']);
|
||||
$log = 'console-'.time();
|
||||
defer(function () use ($ssh, $log) {
|
||||
$ssh->exec(command: $this->data['command'], log: $log, stream: true, streamCallback: function ($output) {
|
||||
$this->output .= $output;
|
||||
$this->stream(
|
||||
to: 'output',
|
||||
content: $output,
|
||||
);
|
||||
});
|
||||
})->name($log);
|
||||
$ssh->exec(command: $this->data['command'], log: $log, stream: true, streamCallback: function ($output) {
|
||||
$this->output .= $output;
|
||||
$this->stream(
|
||||
to: 'output',
|
||||
content: $output,
|
||||
);
|
||||
});
|
||||
}),
|
||||
Action::make('stop')
|
||||
->view('web.components.dynamic-widget', [
|
||||
|
Reference in New Issue
Block a user