Skip to content

Commit 162fb7b

Browse files
committed
fix: refactor run-command
1 parent 4bdb5c9 commit 162fb7b

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

app/Livewire/RunCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Livewire;
44

5+
use App\Models\Server;
56
use Livewire\Attributes\On;
67
use Livewire\Component;
78

@@ -13,12 +14,12 @@ class RunCommand extends Component
1314

1415
public $containers = [];
1516

16-
public function mount($servers)
17+
public function mount()
1718
{
1819
if (! auth()->user()->isAdmin()) {
1920
abort(403);
2021
}
21-
$this->servers = $servers;
22+
$this->servers = Server::isReachable()->get();
2223
$this->containers = $this->getAllActiveContainers();
2324
}
2425

app/Livewire/Terminal/Index.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22

33
namespace App\Livewire\Terminal;
44

5-
use App\Models\Server;
65
use Livewire\Component;
76

87
class Index extends Component
98
{
10-
public $servers = [];
11-
12-
public function mount()
13-
{
14-
$this->servers = Server::isReachable()->get();
15-
}
16-
179
public function render()
1810
{
1911
return view('livewire.terminal.index');

resources/views/livewire/terminal/index.blade.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,5 @@
88
<x-helper
99
helper="If you're having trouble connecting to your server, make sure that the port is open.<br><br><a class='underline' href='https://coolify.io/docs/knowledge-base/server/firewall/#terminal' target='_blank'>Documentation</a>"></x-helper>
1010
</div>
11-
@if ($servers->count() > 0)
12-
<livewire:run-command :servers="$servers" />
13-
@else
14-
<div>
15-
<div>No servers found. Without a server, you won't be able to do much.</div>
16-
</div>
17-
@endif
11+
<livewire:run-command />
1812
</div>

0 commit comments

Comments
 (0)