From 3f467103094006dcbbf9c76d2725d62ebcb09211 Mon Sep 17 00:00:00 2001 From: Cornelis Terblanche Date: Mon, 8 Jun 2026 18:25:42 +0200 Subject: [PATCH] Refine cloud provider token form --- .../cloud-provider-token-form.blade.php | 95 +++++++++++-------- .../security/cloud-provider-tokens.blade.php | 2 +- tests/Unit/CloudProviderTokenFormViewTest.php | 16 ++++ 3 files changed, 71 insertions(+), 42 deletions(-) create mode 100644 tests/Unit/CloudProviderTokenFormViewTest.php diff --git a/resources/views/livewire/security/cloud-provider-token-form.blade.php b/resources/views/livewire/security/cloud-provider-token-form.blade.php index d5b1b4727..56c53d869 100644 --- a/resources/views/livewire/security/cloud-provider-token-form.blade.php +++ b/resources/views/livewire/security/cloud-provider-token-form.blade.php @@ -3,28 +3,67 @@ @if ($modal_mode) {{-- Modal layout: vertical, compact --}} @if (!isset($provider) || empty($provider) || $provider === '') - + - + @else @endif - + - @if (auth()->user()->currentTeam()->cloudProviderTokens->where('provider', $provider)->isEmpty()) -
+
+ Create an API token in the {{ ucfirst($provider) }} Console. + @if ($provider === 'hetzner') + Choose Project → Security → API Tokens. +

+ Don't have a Hetzner account? Sign up here +
+ (Coolify's affiliate link, only new accounts - supports us (€10) + and gives you €20) + @endif + @if ($provider === 'vultr') + Open Account → API Access. +

+ Don't have a Vultr account? Sign up here +
+ Coolify's affiliate link, only new accounts - supports us + @endif +
+ + Validate & Add Token + @else + {{-- Full page layout: horizontal, spacious --}} +
+
+ + + + + +
+
+ +
+
+
+ +
Create an API token in the {{ ucfirst($provider) }} Console → choose - Project → Security → API Tokens. + href='{{ $provider === 'hetzner' ? 'https://console.hetzner.com/projects' : ($provider === 'vultr' ? 'https://console.vultr.com/user/apiaccess/' : '#') }}' + target='_blank' class='underline dark:text-white'>{{ ucfirst($provider) }} Console. @if ($provider === 'hetzner') + Choose Project → Security → API Tokens.

Don't have a Hetzner account? Sign up here @@ -32,41 +71,15 @@ class='underline dark:text-white'>Sign up here (Coolify's affiliate link, only new accounts - supports us (€10) and gives you €20) @endif -
- @endif - - Validate & Add Token - @else - {{-- Full page layout: horizontal, spacious --}} -
-
- - - - - -
-
- -
-
-
- - @if (auth()->user()->currentTeam()->cloudProviderTokens->where('provider', $provider)->isEmpty()) -
- Create an API token in the Hetzner Console → choose Project → Security → API - Tokens. + @if ($provider === 'vultr') + Open Account → API Access.

- Don't have a Hetzner account? Sign up here
- (Coolify's affiliate link, only new accounts - supports us (€10) - and gives you €20) -
- @endif + Coolify's affiliate link, only new accounts - supports us + @endif +
Validate & Add Token @endif diff --git a/resources/views/livewire/security/cloud-provider-tokens.blade.php b/resources/views/livewire/security/cloud-provider-tokens.blade.php index 6369134a8..ec7bc976f 100644 --- a/resources/views/livewire/security/cloud-provider-tokens.blade.php +++ b/resources/views/livewire/security/cloud-provider-tokens.blade.php @@ -1,6 +1,6 @@

Cloud Provider Tokens

-
Manage API tokens for cloud providers (Hetzner, DigitalOcean, etc.).
+
Manage API tokens for cloud providers (Hetzner, Vultr, etc.).

New Token

@can('create', App\Models\CloudProviderToken::class) diff --git a/tests/Unit/CloudProviderTokenFormViewTest.php b/tests/Unit/CloudProviderTokenFormViewTest.php new file mode 100644 index 000000000..ae6be05c0 --- /dev/null +++ b/tests/Unit/CloudProviderTokenFormViewTest.php @@ -0,0 +1,16 @@ +toContain('') + ->and($view)->toContain('') + ->and($view)->toContain('') + ->and(substr_count($view, 'Open Account → API Access.'))->toBe(2) + ->and(substr_count($view, 'https://console.vultr.com/user/apiaccess/'))->toBe(2) + ->and($view)->not->toContain('') + ->and($view)->not->toContain('cloudProviderTokens->where(\'provider\', $provider)->isEmpty()') + ->and($view)->not->toContain('') + ->and($component)->toContain("'provider' => 'required|string|in:hetzner,digitalocean,vultr'"); +});