feat(domains): add inline indexing and redirect controls

Move domain indexing and redirect settings into domain management views and include noindex changes in deployment configuration diffs.
This commit is contained in:
Andras Bacsai committed 2026-08-10 15:10:30 +02:00
1 parent 8c9a7413d0
commit 69ba001e21
22 files changed
+327 -185

No files matched your search

+41 -4
View File
@@ -90,7 +90,7 @@ beforeEach(function () {
]);
});
it('groups configured domains with their service redirect and excludes services without domains', function () {
it('groups configured domains and shows redirect settings in the edit modal', function () {
$this->apiApp->update([
'fqdn' => 'https://api.example.com,https://admin.example.com',
]);
@@ -100,18 +100,22 @@ it('groups configured domains with their service redirect and excludes services
->assertSee('API')
->assertSee('https://api.example.com')
->assertSee('https://admin.example.com')
->call('startEdit', 0)
->html();
expect($html)
->toContain("service-domain-group-{$this->apiApp->id}")
->toContain("id=\"service-domain-redirect-{$this->apiApp->id}-trigger\"")
->toContain("id=\"edit-service-domain-redirect-{$this->apiApp->id}-trigger\"")
->toContain("serviceRedirects.{$this->apiApp->id}")
->toContain('class="listbox-trigger"')
->toContain('application-settings-section-body is-flush mt-1 w-full scroll-mt-28 overflow-visible')
->not->toContain("<select id=\"service-domain-redirect-{$this->apiApp->id}\"")
->not->toContain("service-domain-redirect-toggle-{$this->apiApp->id}")
->toContain('dark:bg-white/[0.04]')
->toContain('<span>Domain</span>')
->toContain('<span>DNS</span>')
->toContain('<span>Last checked</span>')
->not->toContain("service-domain-group-{$this->webApp->id}")
->and(substr_count($html, '2 domains'))->toBe(1)
->and(strpos($html, '>API</span>'))->toBeLessThan(strpos($html, '<span>Domain</span>'))
->and(substr_count($html, "id=\"service-domain-group-{$this->apiApp->id}\""))->toBe(1);
});
@@ -194,6 +198,7 @@ it('saves the explicitly selected service redirect value', function () {
->call('updateServiceRedirect', $this->webApp->id, 'www')
->assertDispatched('success')
->assertSet('domainRows', fn (array $rows): bool => collect($rows)->pluck('url')->contains('https://www.web.example.com'))
->assertSet('domainRows', fn (array $rows): bool => filled(collect($rows)->firstWhere('url', 'https://www.web.example.com')['checked_at'] ?? null))
->assertSee('https://www.web.example.com');
expect($this->webApp->fresh()->redirect)->toBe('www');
@@ -270,6 +275,8 @@ it('provides client-side search for service domains', function () {
expect($view)
->toContain('x-model="domainSearch"')
->toContain('class="ml-auto flex flex-wrap items-center gap-2"')
->toContain('<div class="relative shrink-0">')
->toContain('placeholder="Search services or domains"')
->toContain('x-show="matchesDomainSearch(')
->toContain('title="No domains found"')
@@ -343,6 +350,8 @@ it('prunes the previous dns status when a service domain is renamed', function (
Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])
->call('startEdit', 0)
->assertSee('Direction')
->assertSee('Search engine indexing')
->set('editingDomain', 'https://renamed.example.com')
->call('updateDomain')
->assertHasNoErrors()
@@ -357,6 +366,15 @@ it('prunes the previous dns status when a service domain is renamed', function (
->and($this->apiApp->domain_dns_statuses['https://renamed.example.com']['status'])->toBe('skipped');
});
it('only shows the domain notification when redirect changes through edit domain', function () {
Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])
->call('startEdit', 0)
->set('editingDirection', 'www')
->call('updateDomain')
->assertDispatched('success', 'Domain updated.')
->assertNotDispatched('success', 'Redirect updated.');
});
it('does not restore stale dns status when a removed service domain is re-added', function () {
$this->apiApp->update([
'domain_dns_statuses' => [
@@ -509,3 +527,22 @@ it('exposes the stack domains route', function () {
->assertSeeLivewire(Domains::class)
->assertSee('Domains');
});
it('updates search engine indexing from the service domains view', function () {
Livewire::test(Domains::class, ['service' => $this->service->fresh(['applications', 'server'])])
->assertSee('Noindex')
->assertSee('Indexable')
->assertSee('x-model="localIndexing"', false)
->assertDontSee('@change="$wire.toggleNoindexDomain', false)
->assertDontSee('@change="$wire.updateServiceRedirect', false)
->assertDontSee('@js(', false)
->call('toggleNoindexDomain', $this->apiApp->id, 'https://api.example.com', 'noindex')
->assertDispatched('configurationChanged')
->assertDispatched('success');
expect($this->apiApp->refresh()->noindexDomains()->all())
->toBe(['https://api.example.com']);
expect(file_get_contents(resource_path('views/livewire/project/service/partials/domain-table.blade.php')))
->not->toContain('<select');
});