feat: Add DNS configuration check and update subdomain management UI
This commit is contained in:
@@ -107,10 +107,16 @@ class Subdomain extends Component
|
||||
'walrus','warthog','weasel','whale','wolf','wolverine','wombat','woodpecker','yak','zebra',
|
||||
];
|
||||
|
||||
public bool $dnsConfigured = false;
|
||||
|
||||
public function mount(Server $server): void
|
||||
{
|
||||
parent::mount($server);
|
||||
$this->loadServerZones();
|
||||
$this->dnsConfigured = TechnitiumDns::isConfigured();
|
||||
|
||||
if ($this->dnsConfigured) {
|
||||
$this->loadServerZones();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,15 @@ class TechnitiumDns
|
||||
private string $baseUrl;
|
||||
private string $token;
|
||||
|
||||
/**
|
||||
* Check whether Technitium DNS credentials are configured.
|
||||
*/
|
||||
public static function isConfigured(): bool
|
||||
{
|
||||
return !empty(config('services.technitium.url'))
|
||||
&& !empty(config('services.technitium.token'));
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->baseUrl = rtrim((string) config('services.technitium.url', ''), '/');
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
<x-ri-arrow-right-s-line class="size-3" />
|
||||
<span class="text-base/70">Subdomain</span>
|
||||
</div>
|
||||
|
||||
@if (!$dnsConfigured)
|
||||
<div class="rounded-xl border border-warning/30 bg-warning/5 p-6 text-center">
|
||||
<x-ri-error-warning-line class="size-8 mx-auto text-warning mb-3" />
|
||||
<h3 class="text-lg font-semibold mb-1">DNS Not Configured</h3>
|
||||
<p class="text-sm text-base/60">Subdomain management is unavailable. The administrator needs to set the <code class="text-xs bg-neutral/30 px-1.5 py-0.5 rounded">TECHNITIUM_DNS_URL</code> and <code class="text-xs bg-neutral/30 px-1.5 py-0.5 rounded">TECHNITIUM_DNS_TOKEN</code> environment variables.</p>
|
||||
</div>
|
||||
@else
|
||||
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<div class="flex items-center gap-2 min-w-0">
|
||||
@@ -470,5 +479,6 @@
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif {{-- dnsConfigured --}}
|
||||
</x-proxmox::layout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user