Add restart functionality to proxy deployment

This commit is contained in:
Andras Bacsai 2024-01-18 12:14:11 +01:00
parent 4631c73809
commit 68fe886fb0
2 changed files with 28 additions and 0 deletions

View File

@ -49,6 +49,14 @@ class Deploy extends Component
{
$this->server->refresh();
}
public function restart() {
try {
$this->stop();
$this->dispatch('checkProxy');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function checkProxy()
{
try {

View File

@ -7,6 +7,15 @@
</p>
</x-slot:modalBody>
</x-modal>
<x-modal yesOrNo modalId="restartProxy" modalTitle="Restart Proxy" action="restart">
<x-slot:modalBody>
<p>This proxy will be stopped and started. It is not reversible. <br>All resources will be unavailable
during the restart.
<br>Please think
again.
</p>
</x-slot:modalBody>
</x-modal>
@if ($server->isFunctional() && data_get($server, 'proxy.type') !== 'NONE')
@if (data_get($server, 'proxy.status') === 'running')
<div class="flex gap-4">
@ -18,6 +27,17 @@
</a>
</button>
@endif
<x-forms.button isModal noStyle modalId="restartProxy"
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg class="w-5 h-5 text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2">
<path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
<path d="M20 4v5h-5" />
</g>
</svg>
Restart Proxy
</x-forms.button>
<x-forms.button isModal noStyle modalId="stopProxy"
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"