Skip to content

Commit a6f7190

Browse files
committed
feat(ui): add Open server links on destination cards
Link primary and additional destination server cards to their server pages via wire:navigate, and cover the markup in a feature test.
1 parent 8ae9c03 commit a6f7190

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

resources/views/livewire/project/shared/destination.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ class="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-xs text-neutral-700 d
3333
</div>
3434

3535
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
36+
<a href="{{ route('server.show', ['server_uuid' => data_get($resource, 'destination.server.uuid')]) }}"
37+
{{ wireNavigate() }} class="button">Open server</a>
3638
<x-status-summary :status="$resource->status" />
3739
@if ($hasAdditionalDestinations)
3840
<x-forms.button canGate="deploy" :canResource="$resource"
@@ -86,6 +88,8 @@ class="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-xs text-neutral-700 d
8688
</div>
8789

8890
<div class="flex flex-wrap items-center gap-2 lg:justify-end">
91+
<a href="{{ route('server.show', ['server_uuid' => data_get($destination, 'server.uuid')]) }}"
92+
{{ wireNavigate() }} class="button">Open server</a>
8993
@if ($destinationStatus->startsWith('running'))
9094
<x-status.running :status="$destinationStatus->value()" />
9195
@elseif ($destinationStatus->startsWith(['starting', 'restarting']))
@@ -211,6 +215,8 @@ class="rounded bg-neutral-100 px-1.5 py-0.5 font-mono text-xs text-neutral-700 d
211215
</div>
212216

213217
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
218+
<a href="{{ route('server.show', ['server_uuid' => data_get($resource, 'destination.server.uuid')]) }}"
219+
{{ wireNavigate() }} class="button">Open server</a>
214220
@if ($primaryStatus->startsWith('running'))
215221
<x-status.running :status="$primaryStatus->value()" />
216222
@elseif ($primaryStatus->startsWith(['starting', 'restarting']))

tests/Feature/ApplicationDestinationStatusBadgeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@
88
->toContain('<x-status-summary :status="$resource->status" />')
99
->not->toContain('<x-status :resource="$resource"');
1010
});
11+
12+
it('links each configured server card to its server page', function () {
13+
$view = file_get_contents(resource_path('views/livewire/project/shared/destination.blade.php'));
14+
15+
expect($view)
16+
->toContain("route('server.show', ['server_uuid' => data_get(\$resource, 'destination.server.uuid')])")
17+
->toContain("route('server.show', ['server_uuid' => data_get(\$destination, 'server.uuid')])")
18+
->toContain('Open server');
19+
});

0 commit comments

Comments
 (0)