fix: only show traefik dashboard if its available
This commit is contained in:
parent
250d7cbc53
commit
ca2c75ce19
@ -6,6 +6,7 @@
|
|||||||
use App\Actions\Proxy\SaveConfiguration;
|
use App\Actions\Proxy\SaveConfiguration;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Proxy extends Component
|
class Proxy extends Component
|
||||||
{
|
{
|
||||||
@ -71,6 +72,12 @@ public function loadProxyConfiguration()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->proxy_settings = CheckConfiguration::run($this->server);
|
$this->proxy_settings = CheckConfiguration::run($this->server);
|
||||||
|
if (Str::of($this->proxy_settings)->contains('--api.dashboard=true') && Str::of($this->proxy_settings)->contains('--api.insecure=true')) {
|
||||||
|
$this->emit('traefikDashboardAvailable', true);
|
||||||
|
} else {
|
||||||
|
$this->emit('traefikDashboardAvailable', false);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Server\Proxy;
|
namespace App\Http\Livewire\Server\Proxy;
|
||||||
|
|
||||||
use App\Actions\Proxy\SaveConfiguration;
|
|
||||||
use App\Actions\Proxy\StartProxy;
|
use App\Actions\Proxy\StartProxy;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@ -10,9 +9,16 @@
|
|||||||
class Deploy extends Component
|
class Deploy extends Component
|
||||||
{
|
{
|
||||||
public Server $server;
|
public Server $server;
|
||||||
public $proxy_settings = null;
|
public bool $traefikDashboardAvailable = false;
|
||||||
protected $listeners = ['proxyStatusUpdated'];
|
public ?string $currentRoute = null;
|
||||||
|
protected $listeners = ['proxyStatusUpdated', 'traefikDashboardAvailable'];
|
||||||
|
|
||||||
|
public function mount() {
|
||||||
|
$this->currentRoute = request()->route()->getName();
|
||||||
|
}
|
||||||
|
public function traefikDashboardAvailable(bool $data) {
|
||||||
|
$this->traefikDashboardAvailable = $data;
|
||||||
|
}
|
||||||
public function proxyStatusUpdated()
|
public function proxyStatusUpdated()
|
||||||
{
|
{
|
||||||
$this->server->refresh();
|
$this->server->refresh();
|
||||||
|
@ -10,12 +10,14 @@
|
|||||||
@if ($server->isFunctional() && data_get($server, 'proxy.type') !== 'NONE')
|
@if ($server->isFunctional() && data_get($server, 'proxy.type') !== 'NONE')
|
||||||
@if (data_get($server, 'proxy.status') !== 'exited')
|
@if (data_get($server, 'proxy.status') !== 'exited')
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<button>
|
@if ($currentRoute === 'server.proxy' && $traefikDashboardAvailable)
|
||||||
<a target="_blank" href="http://{{ $server->ip }}:8080">
|
<button>
|
||||||
Traefik Dashboard
|
<a target="_blank" href="http://{{ $server->ip }}:8080">
|
||||||
<x-external-link />
|
Traefik Dashboard
|
||||||
</a>
|
<x-external-link />
|
||||||
</button>
|
</a>
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
<x-forms.button isModal noStyle modalId="stopProxy"
|
<x-forms.button isModal noStyle modalId="stopProxy"
|
||||||
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
|
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" stroke-width="2"
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2"
|
||||||
|
Loading…
Reference in New Issue
Block a user