This commit is contained in:
Andras Bacsai 2023-05-02 19:25:47 +02:00
parent 910e8279a0
commit f723b504a1
2 changed files with 9 additions and 2 deletions

View File

@ -11,6 +11,8 @@ class Form extends Component
public $server_id;
public Server $server;
public $uptime;
public $dockerVersion;
public $dockerComposeVersion;
protected $rules = [
'server.name' => 'required|min:6',
@ -30,9 +32,11 @@ public function installDocker()
"curl https://releases.rancher.com/install-docker/23.0.sh | sh"
]);
}
public function checkConnection()
public function checkServer()
{
$this->uptime = runRemoteCommandSync($this->server, ['uptime']);
$this->dockerVersion = runRemoteCommandSync($this->server, ['docker version|head -2|grep -i version'], false);
$this->dockerComposeVersion = runRemoteCommandSync($this->server, ['docker compose version|head -2|grep -i version'], false);
}
public function submit()
{

View File

@ -21,12 +21,15 @@
<button class="w-16 mt-4" type="submit">
Submit
</button>
<button wire:click.prevent='checkConnection'>Check Connection</button>
<button wire:click.prevent='checkServer'>Check Server</button>
<button wire:click.prevent='installDocker'>Install Docker</button>
</div>
</form>
@isset($uptime)
<p>Connection OK</p>
<p>Uptime: {{ $uptime }}</p>
<p>{{ $dockerVersion }}</p>
<p>{{ $dockerComposeVersion }}</p>
@endisset
</div>