feat(domains): add structured URL editing and responsive domain controls

Add reusable domain URL parsing and input components, expose per-domain
redirect and indexing controls, and improve application and service domain
layouts across responsive breakpoints.
This commit is contained in:
Andras Bacsai committed 2026-08-11 00:06:55 +02:00
1 parent 61a2b183d3
commit 32bf1860d4
30 files changed
+693 -292

No files matched your search

+14 -18
View File
@@ -41,10 +41,6 @@ class Domains extends Component
public string $editingDomain = '';
public string $editingIndexing = 'index';
public string $editingDirection = 'both';
public ?string $editingService = null;
/** @var array<int, array{url: string, service: ?string, dns_status: string, dns_message: string, expected_ip: ?string, checked_at?: ?string, is_suggested?: bool, suggested_for?: ?string, suggestion_label?: ?string, needs_force_add?: bool}> */
@@ -103,8 +99,6 @@ class Domains extends Component
return [
'newDomain' => ValidationPatterns::applicationDomainRules(),
'editingDomain' => ValidationPatterns::applicationDomainRules(),
'editingIndexing' => 'string|in:index,noindex',
'editingDirection' => 'string|in:both,www,non-www',
'redirect' => 'string|required|in:both,www,non-www',
'serviceRedirects' => 'array',
'serviceRedirects.*' => 'string|in:both,www,non-www',
@@ -151,6 +145,12 @@ class Domains extends Component
$this->dispatch('success', 'Search engine indexing updated.');
}
public function updateRedirect(string $redirect): void
{
$this->redirect = $redirect;
$this->setRedirect();
}
public function loadDomainState(): void
{
$this->application->refresh();
@@ -912,8 +912,6 @@ class Domains extends Component
$this->editingIndex = $index;
$this->editingDomain = $this->domainRows[$index]['url'];
$this->editingService = $this->domainRows[$index]['service'];
$this->editingDirection = $this->serviceRedirectFor($this->editingService);
$this->editingIndexing = $this->application->isDomainNoindexed($this->editingDomain) ? 'noindex' : 'index';
$this->resetEditDomainDnsGate();
$this->resetErrorBag('editingDomain');
$this->showEditDomainModal = true;
@@ -996,8 +994,6 @@ class Domains extends Component
$this->editingIndex = null;
$this->editingDomain = '';
$this->editingService = null;
$this->editingDirection = 'both';
$this->editingIndexing = 'index';
$this->resetEditDomainDnsGate();
$this->resetErrorBag('editingDomain');
if ($this->pendingAction === 'update') {
@@ -1040,6 +1036,7 @@ class Domains extends Component
$newUrl = $this->splitDomains($normalized)[0];
$oldUrl = $this->domainRows[$this->editingIndex]['url'];
$service = $this->editingService;
$wasNoindexed = $this->application->isDomainNoindexed($oldUrl);
$current = $this->currentDomainList($service);
if ($newUrl !== $oldUrl && $current->contains($newUrl)) {
@@ -1066,20 +1063,13 @@ class Domains extends Component
}
$noindexDomains = $this->application->noindexDomains()->reject(fn (string $domain) => $domain === $oldUrl);
if ($this->editingIndexing === 'noindex') {
if ($wasNoindexed) {
$noindexDomains->push($newUrl);
}
$this->application->setNoindexDomains($noindexDomains);
$this->application->save();
$this->resetDefaultLabels();
if ($this->isCompose && filled($service) && $this->editingDirection !== $this->savedRedirectForService($service)) {
$this->serviceRedirects[$this->serviceRedirectWireKey($service)] = $this->editingDirection;
$this->notifyRedirectUpdate = false;
$this->setServiceRedirect($service);
$this->notifyRedirectUpdate = true;
}
$this->forceSaveDomains = false;
$this->pendingAction = null;
$this->cancelEdit();
@@ -1237,6 +1227,12 @@ class Domains extends Component
}
}
public function updateServiceRedirect(string $serviceName, string $redirect): void
{
$this->serviceRedirects[$this->serviceRedirectWireKey($serviceName)] = $redirect;
$this->setServiceRedirect($serviceName);
}
/**
* @param mixed ...$modalArgs Extra args from modal-confirmation (password, etc.)
*/