Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

feat(security): add editable cloud credential pages

Andras Bacsaie200d881f55d
diff --git a/app/Livewire/Security/CloudInitScript/Show.php b/app/Livewire/Security/CloudInitScript/Show.php
new file mode 100644
index 0000000000..6e2a3937d2
--- /dev/null
+++ b/app/Livewire/Security/CloudInitScript/Show.php
@@ -0,0 +1,97 @@
+<?php
+
+namespace App\Livewire\Security\CloudInitScript;
+
+use App\Models\CloudInitScript;
+use App\Rules\ValidCloudInitYaml;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Livewire\Component;
+
+class Show extends Component
+{
+ use AuthorizesRequests;
+
+ public CloudInitScript $cloudInitScript;
+
+ public string $name = '';
+
+ public string $script = '';
+
+ protected function rules(): array
+ {
+ return [
+ 'name' => 'required|string|max:255',
+ 'script' => ['required', 'string', new ValidCloudInitYaml],
+ ];
+ }
+
+ protected function messages(): array
+ {
+ return [
+ 'name.required' => 'Script name is required.',
+ 'name.max' => 'Script name cannot exceed 255 characters.',
+ 'script.required' => 'Cloud-init script content is required.',
+ ];
+ }
+
+ public function mount(string $cloud_init_script_uuid): void
+ {
+ try {
+ $this->cloudInitScript = CloudInitScript::ownedByCurrentTeam()
+ ->whereUuid($cloud_init_script_uuid)
+ ->firstOrFail();
+
+ $this->authorize('view', $this->cloudInitScript);
+
+ $this->name = $this->cloudInitScript->name;
+ $this->script = $this->cloudInitScript->script;
+ } catch (AuthorizationException) {
+ abort(403, 'You do not have permission to view this cloud-init script.');
+ } catch (\Throwable) {
+ abort(404);
+ }
+ }
+
+ public function save(): void
+ {
+ $this->authorize('update', $this->cloudInitScript);
+ $this->validate();
+
+ $this->cloudInitScript->update([
+ 'name' => $this->name,
+ 'script' => $this->script,
+ ]);
+
+ auditLog('ui.cloud_init_script.updated', [
+ 'team_id' => currentTeam()->id,
+ 'cloud_init_script_id' => $this->cloudInitScript->id,
+ 'cloud_init_script_name' => $this->cloudInitScript->name,
+ ]);
+
+ $this->dispatch('success', 'Cloud-init script updated successfully.');
+ }
+
+ public function delete(): mixed
+ {
+ $this->authorize('delete', $this->cloudInitScript);
+
+ $scriptId = $this->cloudInitScript->id;
+ $scriptName = $this->cloudInitScript->name;
+
+ $this->cloudInitScript->delete();
+
+ auditLog('ui.cloud_init_script.deleted', [
+ 'team_id' => currentTeam()->id,
+ 'cloud_init_script_id' => $scriptId,
+ 'cloud_init_script_name' => $scriptName,
+ ]);
+
+ return redirectRoute($this, 'security.cloud-init-scripts');
+ }
+
+ public function render()
+ {
+ return view('livewire.security.cloud-init-script.show');
+ }
+}
diff --git a/app/Livewire/Security/CloudInitScripts.php b/app/Livewire/Security/CloudInitScripts.php
index 57b7324d3a..e66a749cfb 100644
--- a/app/Livewire/Security/CloudInitScripts.php
+++ b/app/Livewire/Security/CloudInitScripts.php
@@ -27,6 +27,13 @@ class CloudInitScripts extends Component
public function loadScripts()
{
+ CloudInitScript::ownedByCurrentTeam()
+ ->whereNull('uuid')
+ ->get()
+ ->each(function (CloudInitScript $script): void {
+ $script->forceFill(['uuid' => new_public_id()])->save();
+ });
+
$this->scripts = CloudInitScript::ownedByCurrentTeam()->orderBy('created_at', 'desc')->get();
}
diff --git a/app/Livewire/Security/CloudProviderToken/Show.php b/app/Livewire/Security/CloudProviderToken/Show.php
new file mode 100644
index 0000000000..aa9270be09
--- /dev/null
+++ b/app/Livewire/Security/CloudProviderToken/Show.php
@@ -0,0 +1,177 @@
+<?php
+
+namespace App\Livewire\Security\CloudProviderToken;
+
+use App\Models\CloudProviderToken;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Support\Facades\Http;
+use Livewire\Component;
+
+class Show extends Component
+{
+ use AuthorizesRequests;
+
+ public CloudProviderToken $cloudProviderToken;
+
+ public string $name = '';
+
+ public ?string $description = null;
+
+ protected function rules(): array
+ {
+ return [
+ 'name' => 'required|string|max:255',
+ 'description' => 'nullable|string|max:1000',
+ ];
+ }
+
+ protected function messages(): array
+ {
+ return [
+ 'name.required' => 'Token name is required.',
+ ];
+ }
+
+ public function mount(string $cloud_token_uuid): void
+ {
+ try {
+ $this->cloudProviderToken = CloudProviderToken::ownedByCurrentTeam()
+ ->whereUuid($cloud_token_uuid)
+ ->firstOrFail();
+
+ $this->authorize('view', $this->cloudProviderToken);
+
+ $this->name = $this->cloudProviderToken->name;
+ $this->description = $this->cloudProviderToken->description;
+ } catch (AuthorizationException) {
+ abort(403, 'You do not have permission to view this cloud token.');
+ } catch (\Throwable) {
+ abort(404);
+ }
+ }
+
+ public function save(): void
+ {
+ $this->authorize('update', $this->cloudProviderToken);
+ $this->validate();
+
+ $description = trim($this->description ?? '');
+
+ $this->cloudProviderToken->update([
+ 'name' => $this->name,
+ 'description' => $description === '' ? null : $description,
+ ]);
+
+ auditLog('ui.cloud_token.updated', [
+ 'team_id' => currentTeam()->id,
+ 'cloud_token_uuid' => $this->cloudProviderToken->uuid,
+ 'cloud_token_name' => $this->cloudProviderToken->name,
+ 'provider' => $this->cloudProviderToken->provider,
+ ]);
+
+ $this->dispatch('success', 'Cloud provider token updated.');
+ }
+
+ public function validateToken(): void
+ {
+ $this->authorize('view', $this->cloudProviderToken);
+
+ $isValid = match ($this->cloudProviderToken->provider) {
+ 'hetzner' => $this->validateHetznerToken($this->cloudProviderToken->token),
+ 'digitalocean' => $this->validateDigitalOceanToken($this->cloudProviderToken->token),
+ 'vultr' => $this->validateVultrToken($this->cloudProviderToken->token),
+ default => false,
+ };
+
+ $providerName = $this->providerName();
+
+ $this->dispatch(
+ $isValid ? 'success' : 'error',
+ $isValid
+ ? "{$providerName} token is valid."
+ : "{$providerName} token validation failed. Please check the token."
+ );
+
+ auditLog('ui.cloud_token.validated', [
+ 'team_id' => currentTeam()->id,
+ 'cloud_token_uuid' => $this->cloudProviderToken->uuid,
+ 'cloud_token_name' => $this->cloudProviderToken->name,
+ 'provider' => $this->cloudProviderToken->provider,
+ 'valid' => $isValid,
+ ]);
+ }
+
+ public function delete(): mixed
+ {
+ $this->authorize('delete', $this->cloudProviderToken);
+
+ if ($this->cloudProviderToken->hasServers()) {
+ $serverCount = $this->cloudProviderToken->servers()->count();
+ $this->dispatch('error', "Cannot delete this token. It is currently used by {$serverCount} server(s). Please reassign those servers to a different token first.");
+
+ return null;
+ }
+
+ auditLog('ui.cloud_token.deleted', [
+ 'team_id' => currentTeam()->id,
+ 'cloud_token_uuid' => $this->cloudProviderToken->uuid,
+ 'cloud_token_name' => $this->cloudProviderToken->name,
+ 'provider' => $this->cloudProviderToken->provider,
+ ]);
+
+ $this->cloudProviderToken->delete();
+
+ return redirectRoute($this, 'security.cloud-tokens');
+ }
+
+ public function providerName(): string
+ {
+ return match ($this->cloudProviderToken->provider) {
+ 'digitalocean' => 'DigitalOcean',
+ 'vultr' => 'Vultr',
+ default => 'Hetzner',
+ };
+ }
+
+ private function validateHetznerToken(string $token): bool
+ {
+ try {
+ return Http::withToken($token)
+ ->timeout(10)
+ ->get('https://api.hetzner.cloud/v1/servers?per_page=1')
+ ->successful();
+ } catch (\Throwable) {
+ return false;
+ }
+ }
+
+ private function validateDigitalOceanToken(string $token): bool
+ {
+ try {
+ return Http::withToken($token)
+ ->timeout(10)
+ ->get('https://api.digitalocean.com/v2/account')
+ ->successful();
+ } catch (\Throwable) {
+ return false;
+ }
+ }
+
+ private function validateVultrToken(string $token): bool
+ {
+ try {
+ return Http::withToken($token)
+ ->timeout(10)
+ ->get('https://api.vultr.com/v2/account')
+ ->successful();
+ } catch (\Throwable) {
+ return false;
+ }
+ }
+
+ public function render()
+ {
+ return view('livewire.security.cloud-provider-token.show');
+ }
+}
diff --git a/app/Livewire/Security/CloudProviderTokenForm.php b/app/Livewire/Security/CloudProviderTokenForm.php
index 0a7235447e..c2466c6229 100644
--- a/app/Livewire/Security/CloudProviderTokenForm.php
+++ b/app/Livewire/Security/CloudProviderTokenForm.php
@@ -22,6 +22,8 @@ class CloudProviderTokenForm extends Component
public string $name = '';
+ public ?string $description = null;
+
public function mount()
{
try {
@@ -37,6 +39,7 @@ class CloudProviderTokenForm extends Component
'provider' => 'required|string|in:hetzner,digitalocean,vultr',
'token' => 'required|string',
'name' => 'required|string|max:255',
+ 'description' => 'nullable|string|max:1000',
];
}
@@ -94,11 +97,14 @@ class CloudProviderTokenForm extends Component
return $this->dispatch('error', 'Invalid API token. Please check your token and try again.');
}
+ $description = trim($this->description ?? '');
+
$savedToken = CloudProviderToken::create([
'team_id' => currentTeam()->id,
'provider' => $this->provider,
'token' => $this->token,
'name' => $this->name,
+ 'description' => $description === '' ? null : $description,
]);
auditLog('ui.cloud_token.created', [
@@ -108,7 +114,7 @@ class CloudProviderTokenForm extends Component
'provider' => $savedToken->provider,
]);
- $this->reset(['token', 'name']);
+ $this->reset(['token', 'name', 'description']);
// Dispatch event with token ID so parent components can react
$this->dispatch('tokenAdded', tokenId: $savedToken->id);
diff --git a/app/Livewire/Security/PrivateKey/Create.php b/app/Livewire/Security/PrivateKey/Create.php
index 8b7ba73dd9..8be1011d53 100644
--- a/app/Livewire/Security/PrivateKey/Create.php
+++ b/app/Livewire/Security/PrivateKey/Create.php
@@ -43,22 +43,6 @@ class Create extends Component
);
}
- public function generateNewRSAKey()
- {
- $this->generateNewKey('rsa');
- }
-
- public function generateNewEDKey()
- {
- $this->generateNewKey('ed25519');
- }
-
- private function generateNewKey($type)
- {
- $keyData = PrivateKey::generateNewKeyPair($type);
- $this->setKeyData($keyData);
- }
-
public function updated($property)
{
if ($property === 'value') {
@@ -93,14 +77,6 @@ class Create extends Component
}
}
- private function setKeyData(array $keyData)
- {
- $this->name = $keyData['name'];
- $this->description = $keyData['description'];
- $this->value = $keyData['private_key'];
- $this->publicKey = $keyData['public_key'];
- }
-
private function validatePrivateKey()
{
$validationResult = PrivateKey::validateAndExtractPublicKey($this->value);
diff --git a/app/Livewire/Security/PrivateKey/Index.php b/app/Livewire/Security/PrivateKey/Index.php
index 0362b65fae..540ef5fa1d 100644
--- a/app/Livewire/Security/PrivateKey/Index.php
+++ b/app/Livewire/Security/PrivateKey/Index.php
@@ -10,6 +10,31 @@ class Index extends Component
{
use AuthorizesRequests;
+ public function generatePrivateKey(string $type)
+ {
+ try {
+ $this->authorize('create', PrivateKey::class);
+
+ if (! in_array($type, ['ed25519', 'rsa'], true)) {
+ $this->dispatch('error', 'Invalid private key type.');
+
+ return;
+ }
+
+ $keyData = PrivateKey::generateNewKeyPair($type);
+ $privateKey = PrivateKey::createAndStore([
+ 'name' => $keyData['name'],
+ 'description' => $keyData['description'],
+ 'private_key' => $keyData['private_key'],
+ 'team_id' => currentTeam()->id,
+ ]);
+
+ return redirectRoute($this, 'security.private-key.show', ['private_key_uuid' => $privateKey->uuid]);
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ }
+ }
+
public function render()
{
$privateKeys = PrivateKey::ownedByCurrentTeam(['name', 'uuid', 'is_git_related', 'description', 'team_id'])->get();
diff --git a/app/Livewire/Server/New/ByDigitalOcean.php b/app/Livewire/Server/New/ByDigitalOcean.php
index c131e096ac..7b0151851c 100644
--- a/app/Livewire/Server/New/ByDigitalOcean.php
+++ b/app/Livewire/Server/New/ByDigitalOcean.php
@@ -12,6 +12,7 @@ use App\Rules\ValidCloudInitYaml;
use App\Rules\ValidHostname;
use App\Services\DigitalOceanService;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Collection;
use Livewire\Attributes\Locked;
use Livewire\Component;
@@ -57,6 +58,8 @@ class ByDigitalOcean extends Component
public bool $loading_data = false;
+ public ?string $provider_data_error = null;
+
public bool $enable_ipv6 = true;
public bool $monitoring = true;
@@ -264,6 +267,7 @@ class ByDigitalOcean extends Component
}
$this->loading_data = true;
+ $this->provider_data_error = null;
try {
$digitalOceanService = new DigitalOceanService($token);
@@ -278,10 +282,22 @@ class ByDigitalOcean extends Component
$this->loading_data = false;
} catch (\Throwable $e) {
$this->loading_data = false;
- throw $e;
+ $this->provider_data_error = $this->providerDataErrorMessage('DigitalOcean', $e, 'message');
+ $this->dispatch('error', $this->provider_data_error);
}
}
+ private function providerDataErrorMessage(string $providerName, \Throwable $e, string $jsonMessageKey): string
+ {
+ $details = $e->getMessage();
+
+ if ($e instanceof RequestException && $e->response) {
+ $details = data_get($e->response->json(), $jsonMessageKey) ?: $e->response->body() ?: $details;
+ }
+
+ return "{$providerName} API error: {$details}";
+ }
+
public function getAvailableSizesProperty(): array
{
if (! $this->selected_region) {
diff --git a/app/Livewire/Server/New/ByHetzner.php b/app/Livewire/Server/New/ByHetzner.php
index 31cd89dae8..5ef88acee8 100644
--- a/app/Livewire/Server/New/ByHetzner.php
+++ b/app/Livewire/Server/New/ByHetzner.php
@@ -12,6 +12,7 @@ use App\Rules\ValidCloudInitYaml;
use App\Rules\ValidHostname;
use App\Services\HetznerService;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Http;
use Livewire\Attributes\Locked;
@@ -70,6 +71,8 @@ class ByHetzner extends Component
public bool $loading_data = false;
+ public ?string $provider_data_error = null;
+
public bool $enable_ipv4 = true;
public bool $enable_ipv6 = true;
@@ -310,6 +313,7 @@ class ByHetzner extends Component
}
$this->loading_data = true;
+ $this->provider_data_error = null;
$this->selectedHetznerSshKeyIds = [];
$this->selectedHetznerFirewallIds = [];
$this->selectedHetznerNetworkIds = [];
@@ -353,10 +357,22 @@ class ByHetzner extends Component
$this->loading_data = false;
} catch (\Throwable $e) {
$this->loading_data = false;
- throw $e;
+ $this->provider_data_error = $this->providerDataErrorMessage('Hetzner', $e, 'error.message');
+ $this->dispatch('error', $this->provider_data_error);
}
}
+ private function providerDataErrorMessage(string $providerName, \Throwable $e, string $jsonMessageKey): string
+ {
+ $details = $e->getMessage();
+
+ if ($e instanceof RequestException && $e->response) {
+ $details = data_get($e->response->json(), $jsonMessageKey) ?: $e->response->body() ?: $details;
+ }
+
+ return "{$providerName} API error: {$details}";
+ }
+
private function getCpuVendorInfo(array $serverType): ?string
{
$name = strtolower($serverType['name'] ?? '');
diff --git a/app/Livewire/Server/New/ByVultr.php b/app/Livewire/Server/New/ByVultr.php
index 1246448453..9e6bc3cf25 100644
--- a/app/Livewire/Server/New/ByVultr.php
+++ b/app/Livewire/Server/New/ByVultr.php
@@ -12,6 +12,7 @@ use App\Rules\ValidCloudInitYaml;
use App\Rules\ValidHostname;
use App\Services\VultrService;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
+use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Collection;
use Livewire\Attributes\Locked;
use Livewire\Component;
@@ -57,6 +58,8 @@ class ByVultr extends Component
public bool $loading_data = false;
+ public ?string $provider_data_error = null;
+
public bool $enable_ipv6 = true;
public bool $disable_public_ipv4 = false;
@@ -334,6 +337,7 @@ class ByVultr extends Component
}
$this->loading_data = true;
+ $this->provider_data_error = null;
try {
$vultrService = new VultrService($token);
@@ -357,10 +361,22 @@ class ByVultr extends Component
$this->loading_data = false;
} catch (\Throwable $e) {
$this->loading_data = false;
- throw $e;
+ $this->provider_data_error = $this->providerDataErrorMessage('Vultr', $e, 'error');
+ $this->dispatch('error', $this->provider_data_error);
}
}
+ private function providerDataErrorMessage(string $providerName, \Throwable $e, string $jsonMessageKey): string
+ {
+ $details = $e->getMessage();
+
+ if ($e instanceof RequestException && $e->response) {
+ $details = data_get($e->response->json(), $jsonMessageKey) ?: $e->response->body() ?: $details;
+ }
+
+ return "{$providerName} API error: {$details}";
+ }
+
private function createVultrServer(string $token): array
{
$vultrService = new VultrService($token);
diff --git a/app/Models/CloudInitScript.php b/app/Models/CloudInitScript.php
index 9d2676aca3..671c5e76c5 100644
--- a/app/Models/CloudInitScript.php
+++ b/app/Models/CloudInitScript.php
@@ -2,9 +2,7 @@
namespace App\Models;
-use Illuminate\Database\Eloquent\Model;
-
-class CloudInitScript extends Model
+class CloudInitScript extends BaseModel
{
protected $fillable = [
'team_id',
diff --git a/app/Models/CloudProviderToken.php b/app/Models/CloudProviderToken.php
index 27214f1d1d..ab9897f9a9 100644
--- a/app/Models/CloudProviderToken.php
+++ b/app/Models/CloudProviderToken.php
@@ -13,6 +13,7 @@ class CloudProviderToken extends BaseModel
'provider',
'token',
'name',
+ 'description',
];
protected $hidden = [
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php
index d16213ad72..3f72642a57 100644
--- a/app/Models/PrivateKey.php
+++ b/app/Models/PrivateKey.php
@@ -291,7 +291,7 @@ class PrivateKey extends BaseModel
public function getKeyLocation()
{
- return "/var/www/html/storage/app/ssh/keys/ssh_key@{$this->uuid}";
+ return Storage::disk('ssh-keys')->path("ssh_key@{$this->uuid}");
}
public function updatePrivateKey(array $data)
diff --git a/database/migrations/2026_07_08_102340_add_description_to_cloud_provider_tokens_table.php b/database/migrations/2026_07_08_102340_add_description_to_cloud_provider_tokens_table.php
new file mode 100644
index 0000000000..5d194cd7d0
--- /dev/null
+++ b/database/migrations/2026_07_08_102340_add_description_to_cloud_provider_tokens_table.php
@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ Schema::table('cloud_provider_tokens', function (Blueprint $table) {
+ $table->text('description')->nullable()->after('name');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('cloud_provider_tokens', function (Blueprint $table) {
+ $table->dropColumn('description');
+ });
+ }
+};
diff --git a/database/migrations/2026_07_08_105014_add_uuid_to_cloud_init_scripts_table.php b/database/migrations/2026_07_08_105014_add_uuid_to_cloud_init_scripts_table.php
new file mode 100644
index 0000000000..500fa1fcfa
--- /dev/null
+++ b/database/migrations/2026_07_08_105014_add_uuid_to_cloud_init_scripts_table.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ public function up(): void
+ {
+ Schema::table('cloud_init_scripts', function (Blueprint $table) {
+ $table->string('uuid')->nullable()->unique()->after('id');
+ });
+
+ DB::table('cloud_init_scripts')
+ ->whereNull('uuid')
+ ->orderBy('id')
+ ->each(function (object $script): void {
+ DB::table('cloud_init_scripts')
+ ->where('id', $script->id)
+ ->update(['uuid' => new_public_id()]);
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('cloud_init_scripts', function (Blueprint $table) {
+ $table->dropUnique(['uuid']);
+ $table->dropColumn('uuid');
+ });
+ }
+};
diff --git a/resources/views/livewire/security/cloud-init-script-form.blade.php b/resources/views/livewire/security/cloud-init-script-form.blade.php
index 83bedffab7..2e1eb86eb3 100644
--- a/resources/views/livewire/security/cloud-init-script-form.blade.php
+++ b/resources/views/livewire/security/cloud-init-script-form.blade.php
@@ -5,13 +5,8 @@
helper="Enter your cloud-init script. Supports cloud-config YAML format." required />
<div class="flex justify-end gap-2">
- @if ($modal_mode)
- <x-forms.button type="button" @click="$dispatch('closeModal')">
- Cancel
- </x-forms.button>
- @endif
<x-forms.button type="submit" isHighlighted>
{{ $scriptId ? 'Update Script' : 'Create Script' }}
</x-forms.button>
</div>
-</form>
\ No newline at end of file
+</form>
diff --git a/resources/views/livewire/security/cloud-init-script/show.blade.php b/resources/views/livewire/security/cloud-init-script/show.blade.php
new file mode 100644
index 0000000000..f8cd4263f8
--- /dev/null
+++ b/resources/views/livewire/security/cloud-init-script/show.blade.php
@@ -0,0 +1,28 @@
+<div>
+ <x-slot:title>
+ Cloud-Init Script | Coolify
+ </x-slot>
+ <x-security.navbar />
+ <form class="flex flex-col" wire:submit="save">
+ <div class="flex items-start gap-2">
+ <h2 class="pb-4">Cloud-Init Script</h2>
+ <x-forms.button canGate="update" :canResource="$cloudInitScript" type="submit">
+ Save
+ </x-forms.button>
+ @can('delete', $cloudInitScript)
+ <x-modal-confirmation title="Confirm Script Deletion?" isErrorButton buttonTitle="Delete"
+ submitAction="delete" :actions="[
+ 'This cloud-init script will be permanently deleted.',
+ 'This action cannot be undone.',
+ ]" confirmationText="{{ $cloudInitScript->name }}"
+ confirmationLabel="Please confirm the deletion by entering the script name below"
+ shortConfirmationLabel="Script Name" :confirmWithPassword="false" step2ButtonText="Delete Script" />
+ @endcan
+ </div>
+ <div class="flex flex-col gap-2">
+ <x-forms.input canGate="update" :canResource="$cloudInitScript" id="name" label="Script Name" required />
+ <x-forms.textarea canGate="update" :canResource="$cloudInitScript" id="script" label="Script Content" rows="12"
+ helper="Enter your cloud-init script. Supports cloud-config YAML format." required />
+ </div>
+ </form>
+</div>
diff --git a/resources/views/livewire/security/cloud-init-scripts.blade.php b/resources/views/livewire/security/cloud-init-scripts.blade.php
index e2013a4fb7..4870eeaa60 100644
--- a/resources/views/livewire/security/cloud-init-scripts.blade.php
+++ b/resources/views/livewire/security/cloud-init-scripts.blade.php
@@ -1,48 +1,30 @@
<div>
<x-security.navbar />
- <div class="flex gap-2">
- <h2 class="pb-4">Cloud-Init Scripts</h2>
+ <div class="flex items-center gap-2">
+ <h2>Cloud-Init Scripts</h2>
@can('create', App\Models\CloudInitScript::class)
<x-modal-input buttonTitle="+ Add" title="New Cloud-Init Script">
<livewire:security.cloud-init-script-form />
</x-modal-input>
@endcan
</div>
- <div class="pb-4 text-sm">Manage reusable cloud-init scripts for server initialization. Currently working only with <span class="text-red-500 font-bold">Hetzner's</span> integration.</div>
+ <div class="pb-4 text-sm">Manage reusable cloud-init scripts for server initialization with Hetzner, Vultr, and DigitalOcean integrations.</div>
<div class="grid gap-4 lg:grid-cols-2">
@forelse ($scripts as $script)
- <div wire:key="script-{{ $script->id }}"
- class="flex flex-col gap-1 p-2 border dark:border-coolgray-200 hover:no-underline">
- <div class="flex justify-between items-center">
- <div class="flex-1">
- <div class="font-bold dark:text-white">{{ $script->name }}</div>
- <div class="text-xs text-neutral-500 dark:text-neutral-400">
- Created {{ $script->created_at->diffForHumans() }}
+ @can('view', $script)
+ <a wire:key="script-{{ $script->id }}" class="coolbox group"
+ href="{{ route('security.cloud-init-scripts.show', ['cloud_init_script_uuid' => $script->uuid]) }}" {{ wireNavigate() }}>
+ <div class="flex flex-col justify-center mx-6">
+ <div class="box-title">
+ {{ $script->name }}
+ </div>
+ <div class="box-description">
+ Cloud-init script
</div>
</div>
- </div>
-
- <div class="flex gap-2 mt-2">
- @can('update', $script)
- <x-modal-input buttonTitle="Edit" title="Edit Cloud-Init Script" fullWidth>
- <livewire:security.cloud-init-script-form :scriptId="$script->id"
- wire:key="edit-{{ $script->id }}" />
- </x-modal-input>
- @endcan
-
- @can('delete', $script)
- <x-modal-confirmation title="Confirm Script Deletion?" isErrorButton buttonTitle="Delete"
- submitAction="deleteScript({{ $script->id }})" :actions="[
- 'This cloud-init script will be permanently deleted.',
- 'This action cannot be undone.',
- ]" confirmationText="{{ $script->name }}"
- confirmationLabel="Please confirm the deletion by entering the script name below"
- shortConfirmationLabel="Script Name" :confirmWithPassword="false"
- step2ButtonText="Delete Script" />
- @endcan
- </div>
- </div>
+ </a>
+ @endcan
@empty
<div class="text-neutral-500">No cloud-init scripts found. Create one to get started.</div>
@endforelse
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 93f8e21cfa..e7170e586c 100644
--- a/resources/views/livewire/security/cloud-provider-token-form.blade.php
+++ b/resources/views/livewire/security/cloud-provider-token-form.blade.php
@@ -15,6 +15,9 @@
<x-forms.input required id="name" label="Token Name"
placeholder="e.g., Production {{ $provider === 'digitalocean' ? 'DigitalOcean' : ucfirst($provider) }} token. tip: add project name to identify easier" />
+ <x-forms.textarea id="description" label="Description" rows="3"
+ placeholder="Optional notes about where this token is used" />
+
<x-forms.input required type="password" id="token" label="API Token"
placeholder="Enter your API token" />
@@ -33,7 +36,10 @@
@endif
</div>
- <x-forms.button type="submit">Validate & Add Token</x-forms.button>
+ <x-forms.button type="submit" :showLoadingIndicator="false" wire:loading.attr="disabled" wire:target="addToken">
+ Validate & Add Token
+ <x-loading-on-button wire:loading wire:target="addToken" />
+ </x-forms.button>
@else
{{-- Full page layout: horizontal, spacious --}}
<div class="flex gap-2 items-end flex-wrap">
@@ -47,6 +53,10 @@
<div class="flex-1 min-w-64">
<x-forms.input required id="name" label="Token Name" placeholder="e.g., Production cloud token" />
</div>
+ <div class="flex-1 min-w-64">
+ <x-forms.textarea id="description" label="Description" rows="3"
+ placeholder="Optional notes about where this token is used" />
+ </div>
</div>
<div class="flex-1 min-w-64">
<x-forms.input required type="password" id="token" label="API Token"
@@ -66,7 +76,10 @@
@endif
</div>
</div>
- <x-forms.button type="submit">Validate & Add Token</x-forms.button>
+ <x-forms.button type="submit" :showLoadingIndicator="false" wire:loading.attr="disabled" wire:target="addToken">
+ Validate & Add Token
+ <x-loading-on-button wire:loading wire:target="addToken" />
+ </x-forms.button>
@endif
</form>
</div>
diff --git a/resources/views/livewire/security/cloud-provider-token/show.blade.php b/resources/views/livewire/security/cloud-provider-token/show.blade.php
new file mode 100644
index 0000000000..b814f40515
--- /dev/null
+++ b/resources/views/livewire/security/cloud-provider-token/show.blade.php
@@ -0,0 +1,39 @@
+<div>
+ <x-slot:title>
+ Cloud Token | Coolify
+ </x-slot>
+ <x-security.navbar />
+ <form class="flex flex-col" wire:submit="save">
+ <div class="flex items-start gap-2">
+ <h2 class="pb-4">Cloud Token</h2>
+ <x-forms.button canGate="update" :canResource="$cloudProviderToken" type="submit">
+ Save
+ </x-forms.button>
+ <x-forms.button canGate="view" :canResource="$cloudProviderToken" type="button" wire:click="validateToken"
+ :showLoadingIndicator="false" wire:loading.attr="disabled" wire:target="validateToken">
+ Validate
+ <x-loading-on-button wire:loading wire:target="validateToken" />
+ </x-forms.button>
+ @can('delete', $cloudProviderToken)
+ <x-modal-confirmation title="Confirm Token Deletion?" isErrorButton buttonTitle="Delete"
+ submitAction="delete" :actions="[
+ 'This cloud provider token will be permanently deleted.',
+ 'Any servers using this token will need to be reconfigured.',
+ ]"
+ confirmationText="{{ $cloudProviderToken->name }}"
+ confirmationLabel="Please confirm the deletion by entering the token name below"
+ shortConfirmationLabel="Token Name" :confirmWithPassword="false" step2ButtonText="Delete Token" />
+ @endcan
+ </div>
+ <div class="flex flex-col gap-2">
+ <div class="flex gap-2">
+ <x-forms.input canGate="update" :canResource="$cloudProviderToken" id="name" label="Name" required />
+ <x-forms.input canGate="update" :canResource="$cloudProviderToken" id="description" label="Description" />
+ </div>
+ <div class="flex gap-2">
+ <x-forms.input readonly label="Provider" :value="$this->providerName()" />
+ <x-forms.input readonly label="Created" :value="$cloudProviderToken->created_at->diffForHumans()" />
+ </div>
+ </div>
+ </form>
+</div>
diff --git a/resources/views/livewire/security/cloud-provider-tokens.blade.php b/resources/views/livewire/security/cloud-provider-tokens.blade.php
index ec7bc976f9..17d54e617f 100644
--- a/resources/views/livewire/security/cloud-provider-tokens.blade.php
+++ b/resources/views/livewire/security/cloud-provider-tokens.blade.php
@@ -1,44 +1,87 @@
<div>
- <h2>Cloud Provider Tokens</h2>
- <div class="pb-4">Manage API tokens for cloud providers (Hetzner, Vultr, etc.).</div>
+ <div class="flex items-center gap-2">
+ <h2>Cloud Provider Tokens</h2>
+ @can('create', App\Models\CloudProviderToken::class)
+ <div x-data="{ dropdownOpen: false }" class="relative w-fit" @click.outside="dropdownOpen = false">
+ <x-forms.button isHighlighted @click="dropdownOpen = !dropdownOpen" type="button">
+ + Add
+ <svg class="w-4 h-4 ml-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
+ </svg>
+ </x-forms.button>
+
+ <div x-show="dropdownOpen" @click.away="dropdownOpen=false" x-transition:enter="ease-out duration-200"
+ x-transition:enter-start="-translate-y-2" x-transition:enter-end="translate-y-0"
+ class="absolute top-0 z-50 mt-10 min-w-max" x-cloak>
+ <div
+ class="p-1 mt-1 bg-white border rounded-sm shadow-sm dark:bg-coolgray-200 dark:border-coolgray-300 border-neutral-300">
+ <div class="flex flex-col gap-1">
+ <x-modal-input title="Add Hetzner Token">
+ <x-slot:content>
+ <div class="dropdown-item" @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ Hetzner
+ </div>
+ </x-slot:content>
+ <livewire:security.cloud-provider-token-form :modal_mode="true" provider="hetzner"
+ wire:key="cloud-provider-token-hetzner" />
+ </x-modal-input>
- <h3>New Token</h3>
- @can('create', App\Models\CloudProviderToken::class)
- <livewire:security.cloud-provider-token-form :modal_mode="false" />
- @endcan
+ <x-modal-input title="Add DigitalOcean Token">
+ <x-slot:content>
+ <div class="dropdown-item" @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ DigitalOcean
+ </div>
+ </x-slot:content>
+ <livewire:security.cloud-provider-token-form :modal_mode="true" provider="digitalocean"
+ wire:key="cloud-provider-token-digitalocean" />
+ </x-modal-input>
- <h3 class="py-4">Saved Tokens</h3>
- <div class="grid gap-2 lg:grid-cols-1">
+ <x-modal-input title="Add Vultr Token">
+ <x-slot:content>
+ <div class="dropdown-item" @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ Vultr
+ </div>
+ </x-slot:content>
+ <livewire:security.cloud-provider-token-form :modal_mode="true" provider="vultr"
+ wire:key="cloud-provider-token-vultr" />
+ </x-modal-input>
+ </div>
+ </div>
+ </div>
+ </div>
+ @endcan
+ </div>
+ <div class="pb-4">Manage API tokens for cloud providers (Hetzner, Vultr, etc.).</div>
+ <div class="grid gap-4 lg:grid-cols-2">
@forelse ($tokens as $savedToken)
- <div wire:key="token-{{ $savedToken->id }}"
- class="flex flex-col gap-1 p-2 border dark:border-coolgray-200 hover:no-underline">
- <div class="flex items-center gap-2">
- <span class="px-2 py-1 text-xs font-bold rounded dark:bg-coolgray-300 dark:text-white">
+ <a wire:key="token-{{ $savedToken->id }}" class="coolbox group"
+ href="{{ route('security.cloud-tokens.show', ['cloud_token_uuid' => $savedToken->uuid]) }}" {{ wireNavigate() }}>
+ <div class="flex flex-col justify-center mx-6">
+ <div class="box-title">
+ {{ $savedToken->name }}
+ </div>
+ <div class="box-description">
{{ strtoupper($savedToken->provider) }}
- </span>
- <span class="font-bold dark:text-white">{{ $savedToken->name }}</span>
- </div>
- <div class="text-sm">Created: {{ $savedToken->created_at->diffForHumans() }}</div>
-
- <div class="flex gap-2 pt-2">
- @can('view', $savedToken)
- <x-forms.button wire:click="validateToken({{ $savedToken->id }})" type="button">
- Validate
- </x-forms.button>
- @endcan
-
- @can('delete', $savedToken)
- <x-modal-confirmation title="Confirm Token Deletion?" isErrorButton buttonTitle="Delete"
- submitAction="deleteToken({{ $savedToken->id }})" :actions="[
- 'This cloud provider token will be permanently deleted.',
- 'Any servers using this token will need to be reconfigured.',
- ]"
- confirmationText="{{ $savedToken->name }}"
- confirmationLabel="Please confirm the deletion by entering the token name below"
- shortConfirmationLabel="Token Name" :confirmWithPassword="false" step2ButtonText="Delete Token" />
- @endcan
+ @if ($savedToken->description)
+ · {{ $savedToken->description }}
+ @endif
</div>
</div>
+ </a>
@empty
<div>
<div>No cloud provider tokens found.</div>
diff --git a/resources/views/livewire/security/private-key/create.blade.php b/resources/views/livewire/security/private-key/create.blade.php
index fb03062654..ec845f7430 100644
--- a/resources/views/livewire/security/private-key/create.blade.php
+++ b/resources/views/livewire/security/private-key/create.blade.php
@@ -3,11 +3,6 @@
<div>Private Keys are used to connect to your servers without passwords.</div>
<div class="font-bold">You should not use passphrase protected keys.</div>
</div>
- <div class="flex gap-2 mb-4 w-full">
- <x-forms.button wire:click="generateNewEDKey" isHighlighted class="w-full">Generate new ED25519 SSH
- Key</x-forms.button>
- <x-forms.button wire:click="generateNewRSAKey">Generate new RSA SSH Key</x-forms.button>
- </div>
<form class="flex flex-col gap-2" wire:submit='createPrivateKey'>
<div class="flex gap-2">
<x-forms.input id="name" label="Name" required />
diff --git a/resources/views/livewire/security/private-key/index.blade.php b/resources/views/livewire/security/private-key/index.blade.php
index 4f41dc1b9a..91a5b3a739 100644
--- a/resources/views/livewire/security/private-key/index.blade.php
+++ b/resources/views/livewire/security/private-key/index.blade.php
@@ -1,11 +1,55 @@
<div>
<x-security.navbar />
- <div class="flex gap-2">
- <h2 class="pb-4">Private Keys</h2>
+ <div class="flex items-center gap-2 pb-4">
+ <h2>Private Keys</h2>
@can('create', App\Models\PrivateKey::class)
- <x-modal-input buttonTitle="+ Add" title="New Private Key">
- <livewire:security.private-key.create />
- </x-modal-input>
+ <div x-data="{ dropdownOpen: false }" class="relative w-fit" @click.outside="dropdownOpen = false">
+ <x-forms.button isHighlighted @click="dropdownOpen = !dropdownOpen" type="button">
+ + Add
+ <svg class="w-4 h-4 ml-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round"
+ d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
+ </svg>
+ </x-forms.button>
+
+ <div x-show="dropdownOpen" @click.away="dropdownOpen=false" x-transition:enter="ease-out duration-200"
+ x-transition:enter-start="-translate-y-2" x-transition:enter-end="translate-y-0"
+ class="absolute top-0 z-50 mt-10 min-w-max" x-cloak>
+ <div
+ class="p-1 mt-1 bg-white border rounded-sm shadow-sm dark:bg-coolgray-200 dark:border-coolgray-300 border-neutral-300">
+ <div class="flex flex-col gap-1">
+ <a class="dropdown-item" wire:click="generatePrivateKey('ed25519')"
+ @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ Generate ED25519
+ </a>
+ <a class="dropdown-item" wire:click="generatePrivateKey('rsa')" @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ Generate RSA
+ </a>
+ <x-modal-input title="Add Private Key Manually">
+ <x-slot:content>
+ <div class="dropdown-item" @click="dropdownOpen = false">
+ <svg class="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M12 4.5v15m7.5-7.5h-15" />
+ </svg>
+ Add manually
+ </div>
+ </x-slot:content>
+ <livewire:security.private-key.create />
+ </x-modal-input>
+ </div>
+ </div>
+ </div>
+ </div>
@endcan
@can('create', App\Models\PrivateKey::class)
<x-modal-confirmation title="Confirm unused SSH Key Deletion?" buttonTitle="Delete unused SSH Keys" isErrorButton
diff --git a/resources/views/livewire/security/private-key/show.blade.php b/resources/views/livewire/security/private-key/show.blade.php
index a8bd17d4a6..da94f3c48f 100644
--- a/resources/views/livewire/security/private-key/show.blade.php
+++ b/resources/views/livewire/security/private-key/show.blade.php
@@ -5,8 +5,14 @@
<x-security.navbar />
<div x-data="{ showPrivateKey: false }">
<form class="flex flex-col" wire:submit='changePrivateKey'>
- <div class="flex items-start gap-2">
- <h2 class="pb-4">Private Key</h2>
+ <div class="flex items-center gap-2 pb-4">
+ <h2>Private Key</h2>
+ @if ($isGitRelated)
+ <span
+ class="w-fit rounded-sm border border-coollabs bg-coollabs-50 px-2 py-1 text-xs font-bold text-coollabs-200 dark:border-coollabs-100 dark:bg-coollabs/20 dark:text-white">
+ Used by GitHub App
+ </span>
+ @endif
<x-forms.button canGate="update" :canResource="$private_key" type="submit">
Save
</x-forms.button>
@@ -35,6 +41,7 @@
<div class="pl-1">Public Key</div>
</div>
<x-forms.input canGate="update" :canResource="$private_key" readonly id="public_key" />
+ <span class="block pt-2 pb-4 font-bold dark:text-warning">ACTION REQUIRED: Copy the 'Public Key' to your server's ~/.ssh/authorized_keys file</span>
<div class="flex items-end gap-2 py-2 ">
<div class="pl-1">Private Key <span class='text-helper'>*</span></div>
<div class="text-xs underline cursor-pointer dark:text-white" x-cloak x-show="!showPrivateKey"
@@ -46,11 +53,6 @@
Hide
</div>
</div>
- @if ($isGitRelated)
- <div class="w-48">
- <x-forms.checkbox id="isGitRelated" disabled label="Is used by a Git App?" />
- </div>
- @endif
<div x-cloak x-show="!showPrivateKey">
<x-forms.input canGate="update" :canResource="$private_key" allowToPeak="false" type="password" rows="10" id="privateKeyValue"
required disabled />
diff --git a/resources/views/livewire/server/cloud-provider-token/show.blade.php b/resources/views/livewire/server/cloud-provider-token/show.blade.php
index b98fb735ab..bb6cfb4cb9 100644
--- a/resources/views/livewire/server/cloud-provider-token/show.blade.php
+++ b/resources/views/livewire/server/cloud-provider-token/show.blade.php
@@ -15,8 +15,10 @@
</x-modal-input>
@endcan
<x-forms.button canGate="update" :canResource="$server" isHighlighted
- wire:click.prevent='validateToken'>
+ wire:click.prevent='validateToken' :showLoadingIndicator="false" wire:loading.attr="disabled"
+ wire:target="validateToken">
Validate token
+ <x-loading-on-button wire:loading wire:target="validateToken" />
</x-forms.button>
</div>
<div class="pb-4">Change your server's {{ $providerName }} token.</div>
@@ -26,6 +28,9 @@
class="box-without-bg justify-between dark:bg-coolgray-100 bg-white items-center flex flex-col gap-2">
<div class="flex flex-col w-full">
<div class="box-title">{{ $token->name }}</div>
+ @if ($token->description)
+ <div class="box-description">{{ $token->description }}</div>
+ @endif
<div class="box-description">
Created {{ $token->created_at->diffForHumans() }}
</div>
diff --git a/resources/views/livewire/server/new/by-digital-ocean.blade.php b/resources/views/livewire/server/new/by-digital-ocean.blade.php
index 5cce8d70b9..dc4f1deb52 100644
--- a/resources/views/livewire/server/new/by-digital-ocean.blade.php
+++ b/resources/views/livewire/server/new/by-digital-ocean.blade.php
@@ -60,6 +60,22 @@
<div class="flex items-center justify-center py-8">
<x-loading text="Loading DigitalOcean data..." />
</div>
+ @elseif ($provider_data_error)
+ <div class="flex flex-col gap-4 rounded-lg border border-error bg-error/10 p-4">
+ <div>
+ <h3>Unable to load DigitalOcean details</h3>
+ <p class="text-sm text-neutral-700 dark:text-neutral-300">
+ Coolify could not fetch DigitalOcean data with the selected token. The token may have been
+ deleted, revoked, or no longer has access.
+ </p>
+ </div>
+ <pre class="whitespace-pre-wrap break-words text-sm text-error">{{ $provider_data_error }}</pre>
+ <div>
+ <a class="button" href="{{ route('server.create.type', ['type' => 'digital-ocean']) }}" {{ wireNavigate() }}>
+ Select another token
+ </a>
+ </div>
+ </div>
@else
<form class="flex flex-col w-full gap-2" wire:submit='submit'>
<div>
diff --git a/resources/views/livewire/server/new/by-hetzner.blade.php b/resources/views/livewire/server/new/by-hetzner.blade.php
index 86a3bf3f7f..fafc130131 100644
--- a/resources/views/livewire/server/new/by-hetzner.blade.php
+++ b/resources/views/livewire/server/new/by-hetzner.blade.php
@@ -60,6 +60,22 @@
<div class="flex items-center justify-center py-8">
<x-loading text="Loading Hetzner data..." />
</div>
+ @elseif ($provider_data_error)
+ <div class="flex flex-col gap-4 rounded-lg border border-error bg-error/10 p-4">
+ <div>
+ <h3>Unable to load Hetzner details</h3>
+ <p class="text-sm text-neutral-700 dark:text-neutral-300">
+ Coolify could not fetch Hetzner data with the selected token. The token may have been
+ deleted, revoked, or no longer has access.
+ </p>
+ </div>
+ <pre class="whitespace-pre-wrap break-words text-sm text-error">{{ $provider_data_error }}</pre>
+ <div>
+ <a class="button" href="{{ route('server.create.type', ['type' => 'hetzner']) }}" {{ wireNavigate() }}>
+ Select another token
+ </a>
+ </div>
+ </div>
@else
<form class="flex flex-col w-full gap-2" wire:submit='submit'>
<div>
diff --git a/resources/views/livewire/server/new/by-vultr.blade.php b/resources/views/livewire/server/new/by-vultr.blade.php
index 89e459e82b..d72f585654 100644
--- a/resources/views/livewire/server/new/by-vultr.blade.php
+++ b/resources/views/livewire/server/new/by-vultr.blade.php
@@ -60,6 +60,22 @@
<div class="flex items-center justify-center py-8">
<x-loading text="Loading Vultr data..." />
</div>
+ @elseif ($provider_data_error)
+ <div class="flex flex-col gap-4 rounded-lg border border-error bg-error/10 p-4">
+ <div>
+ <h3>Unable to load Vultr details</h3>
+ <p class="text-sm text-neutral-700 dark:text-neutral-300">
+ Coolify could not fetch Vultr data with the selected token. The token may have been
+ deleted, revoked, or no longer has access.
+ </p>
+ </div>
+ <pre class="whitespace-pre-wrap break-words text-sm text-error">{{ $provider_data_error }}</pre>
+ <div>
+ <a class="button" href="{{ route('server.create.type', ['type' => 'vultr']) }}" {{ wireNavigate() }}>
+ Select another token
+ </a>
+ </div>
+ </div>
@else
<form class="flex flex-col w-full gap-2" wire:submit='submit'>
<div>
diff --git a/routes/web.php b/routes/web.php
index c31140a133..f729af28ef 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -37,7 +37,9 @@ use App\Livewire\Project\Shared\ExecuteContainerCommand;
use App\Livewire\Project\Shared\Logs;
use App\Livewire\Project\Show as ProjectShow;
use App\Livewire\Security\ApiTokens;
+use App\Livewire\Security\CloudInitScript\Show as SecurityCloudInitScriptShow;
use App\Livewire\Security\CloudInitScripts;
+use App\Livewire\Security\CloudProviderToken\Show as SecurityCloudProviderTokenShow;
use App\Livewire\Security\CloudTokens;
use App\Livewire\Security\PrivateKey\Index as SecurityPrivateKeyIndex;
use App\Livewire\Security\PrivateKey\Show as SecurityPrivateKeyShow;
@@ -317,7 +319,9 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/security/private-key/{private_key_uuid}', SecurityPrivateKeyShow::class)->name('security.private-key.show');
Route::get('/security/cloud-tokens', CloudTokens::class)->name('security.cloud-tokens');
+ Route::get('/security/cloud-tokens/{cloud_token_uuid}', SecurityCloudProviderTokenShow::class)->name('security.cloud-tokens.show');
Route::get('/security/cloud-init-scripts', CloudInitScripts::class)->name('security.cloud-init-scripts');
+ Route::get('/security/cloud-init-scripts/{cloud_init_script_uuid}', SecurityCloudInitScriptShow::class)->name('security.cloud-init-scripts.show');
Route::get('/security/api-tokens', ApiTokens::class)->name('security.api-tokens');
});
diff --git a/tests/Feature/Authorization/SecurityPageAuthorizationTest.php b/tests/Feature/Authorization/SecurityPageAuthorizationTest.php
index 94975f3c2b..7faaf83d1f 100644
--- a/tests/Feature/Authorization/SecurityPageAuthorizationTest.php
+++ b/tests/Feature/Authorization/SecurityPageAuthorizationTest.php
@@ -15,7 +15,11 @@ use Livewire\Livewire;
uses(RefreshDatabase::class);
beforeEach(function () {
- InstanceSettings::updateOrCreate(['id' => 0]);
+ if (! InstanceSettings::query()->whereKey(0)->exists()) {
+ $settings = new InstanceSettings;
+ $settings->id = 0;
+ $settings->save();
+ }
$this->team = Team::factory()->create();
diff --git a/tests/Feature/CloudProviderTokenShowTest.php b/tests/Feature/CloudProviderTokenShowTest.php
new file mode 100644
index 0000000000..8aa200ded0
--- /dev/null
+++ b/tests/Feature/CloudProviderTokenShowTest.php
@@ -0,0 +1,48 @@
+<?php
+
+use App\Livewire\Server\CloudProviderToken\Show;
+use App\Models\CloudProviderToken;
+use App\Models\InstanceSettings;
+use App\Models\Server;
+use App\Models\Team;
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Once;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function () {
+ if (! InstanceSettings::query()->whereKey(0)->exists()) {
+ $settings = new InstanceSettings;
+ $settings->id = 0;
+ $settings->save();
+ }
+
+ Once::flush();
+
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->team->members()->attach($this->user->id, ['role' => 'owner']);
+
+ session(['currentTeam' => $this->team]);
+ $this->actingAs($this->user);
+});
+
+test('server cloud provider token cards show token descriptions', function () {
+ $server = Server::factory()->create([
+ 'team_id' => $this->team->id,
+ 'hetzner_server_id' => 12345,
+ ]);
+
+ CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'provider' => 'hetzner',
+ 'name' => 'Production Hetzner',
+ 'description' => 'Used for production servers in the EU region.',
+ ]);
+
+ Livewire::test(Show::class, ['server_uuid' => $server->uuid])
+ ->assertSee('Production Hetzner')
+ ->assertSee('Used for production servers in the EU region.');
+});
diff --git a/tests/Feature/Security/CloudInitScriptsTest.php b/tests/Feature/Security/CloudInitScriptsTest.php
new file mode 100644
index 0000000000..e161d6aa43
--- /dev/null
+++ b/tests/Feature/Security/CloudInitScriptsTest.php
@@ -0,0 +1,122 @@
+<?php
+
+use App\Livewire\Security\CloudInitScript\Show;
+use App\Livewire\Security\CloudInitScriptForm;
+use App\Livewire\Security\CloudInitScripts;
+use App\Models\CloudInitScript;
+use App\Models\InstanceSettings;
+use App\Models\Team;
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Once;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function () {
+ InstanceSettings::unguarded(fn () => InstanceSettings::query()->create([
+ 'id' => 0,
+ ]));
+
+ Once::flush();
+
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->team->members()->attach($this->user->id, ['role' => 'owner']);
+
+ $this->actingAs($this->user);
+ session(['currentTeam' => $this->team]);
+});
+
+test('cloud-init scripts page lists every supported cloud provider integration', function () {
+ Livewire::test(CloudInitScripts::class)
+ ->assertSee('Hetzner')
+ ->assertSee('Vultr')
+ ->assertSee('DigitalOcean')
+ ->assertDontSee('Currently working only with Hetzner');
+});
+
+test('cloud-init script form does not show a cancel button in the modal', function () {
+ Livewire::test(CloudInitScriptForm::class)
+ ->assertSee('Create Script')
+ ->assertDontSee('Cancel');
+});
+
+test('cloud-init script cards link to the script detail page without inline actions or created time', function () {
+ $script = CloudInitScript::query()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Docker Host Setup',
+ 'script' => "#cloud-config\npackages:\n - htop\n",
+ ]);
+
+ Livewire::test(CloudInitScripts::class)
+ ->assertSee('Docker Host Setup')
+ ->assertSee(route('security.cloud-init-scripts.show', ['cloud_init_script_uuid' => $script->uuid]), false)
+ ->assertDontSee('Created')
+ ->assertDontSee('Edit')
+ ->assertDontSee('Delete');
+});
+
+test('cloud-init script detail page shows editable script fields', function () {
+ $script = CloudInitScript::query()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Docker Host Setup',
+ 'script' => "#cloud-config\npackages:\n - htop\n",
+ ]);
+
+ $this->get(route('security.cloud-init-scripts.show', ['cloud_init_script_uuid' => $script->uuid]))
+ ->assertSuccessful()
+ ->assertSee('Cloud-Init Script')
+ ->assertSee('Docker Host Setup')
+ ->assertSee('Save')
+ ->assertSee('Delete');
+});
+
+test('cloud-init script detail page updates a script', function () {
+ $script = CloudInitScript::query()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Docker Host Setup',
+ 'script' => "#cloud-config\npackages:\n - htop\n",
+ ]);
+
+ Livewire::test(Show::class, ['cloud_init_script_uuid' => $script->uuid])
+ ->set('name', 'Updated Host Setup')
+ ->set('script', "#cloud-config\npackages:\n - curl\n")
+ ->call('save')
+ ->assertHasNoErrors()
+ ->assertDispatched('success');
+
+ $script->refresh();
+
+ expect($script->name)->toBe('Updated Host Setup')
+ ->and($script->script)->toContain('curl');
+});
+
+test('cloud-init script detail page deletes a script', function () {
+ $script = CloudInitScript::query()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Docker Host Setup',
+ 'script' => "#cloud-config\npackages:\n - htop\n",
+ ]);
+
+ Livewire::test(Show::class, ['cloud_init_script_uuid' => $script->uuid])
+ ->call('delete')
+ ->assertRedirectToRoute('security.cloud-init-scripts');
+
+ $this->assertModelMissing($script);
+});
+
+test('cloud-init scripts page backfills missing script uuids before rendering links', function () {
+ $script = CloudInitScript::query()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Legacy Script',
+ 'script' => "#cloud-config\npackages:\n - htop\n",
+ ]);
+
+ CloudInitScript::query()->whereKey($script->id)->update(['uuid' => null]);
+
+ Livewire::test(CloudInitScripts::class)
+ ->assertSee('Legacy Script');
+
+ expect($script->refresh()->uuid)->not->toBeNull();
+});
diff --git a/tests/Feature/Security/CloudProviderTokenFormTest.php b/tests/Feature/Security/CloudProviderTokenFormTest.php
index 3ac91bbb1b..666a9b1207 100644
--- a/tests/Feature/Security/CloudProviderTokenFormTest.php
+++ b/tests/Feature/Security/CloudProviderTokenFormTest.php
@@ -1,6 +1,8 @@
<?php
use App\Livewire\Security\CloudProviderTokenForm;
+use App\Livewire\Security\CloudProviderTokens;
+use App\Models\CloudProviderToken;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Models\User;
@@ -52,3 +54,36 @@ test('adding a digitalocean token from a modal closes the modal and refreshes di
->and($dispatches->contains(fn (array $dispatch) => $dispatch['name'] === 'tokenAdded'
&& data_get($dispatch, 'to') === 'security.cloud-provider-tokens'))->toBeTrue();
});
+
+test('adding a cloud provider token stores an optional description', function () {
+ Http::fake([
+ 'https://api.hetzner.cloud/v1/servers' => Http::response([], 200),
+ ]);
+
+ Livewire::test(CloudProviderTokenForm::class)
+ ->set('provider', 'hetzner')
+ ->set('name', 'Production Hetzner')
+ ->set('description', 'Used for production servers in the EU region.')
+ ->set('token', 'hetzner-token')
+ ->call('addToken')
+ ->assertHasNoErrors();
+
+ $this->assertDatabaseHas('cloud_provider_tokens', [
+ 'team_id' => $this->team->id,
+ 'provider' => 'hetzner',
+ 'name' => 'Production Hetzner',
+ 'description' => 'Used for production servers in the EU region.',
+ ]);
+});
+
+test('saved cloud provider tokens show descriptions when present', function () {
+ CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Production Hetzner',
+ 'description' => 'Used for production servers in the EU region.',
+ ]);
+
+ Livewire::test(CloudProviderTokens::class)
+ ->assertSee('Production Hetzner')
+ ->assertSee('Used for production servers in the EU region.');
+});
diff --git a/tests/Feature/Security/CloudProviderTokenShowTest.php b/tests/Feature/Security/CloudProviderTokenShowTest.php
new file mode 100644
index 0000000000..cb527913f0
--- /dev/null
+++ b/tests/Feature/Security/CloudProviderTokenShowTest.php
@@ -0,0 +1,106 @@
+<?php
+
+use App\Livewire\Security\CloudProviderToken\Show;
+use App\Livewire\Security\CloudProviderTokens;
+use App\Models\CloudProviderToken;
+use App\Models\InstanceSettings;
+use App\Models\Team;
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Once;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function () {
+ if (! InstanceSettings::query()->whereKey(0)->exists()) {
+ $settings = new InstanceSettings;
+ $settings->id = 0;
+ $settings->save();
+ }
+
+ Once::flush();
+
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->team->members()->attach($this->user->id, ['role' => 'owner']);
+
+ session(['currentTeam' => $this->team]);
+ $this->actingAs($this->user);
+});
+
+test('saved cloud token cards link to the token detail page', function () {
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Production Hetzner',
+ ]);
+
+ Livewire::test(CloudProviderTokens::class)
+ ->assertSee(route('security.cloud-tokens.show', ['cloud_token_uuid' => $token->uuid]), false);
+});
+
+test('cloud token detail page shows editable name and description fields', function () {
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Production Hetzner',
+ 'description' => 'Used for production servers.',
+ ]);
+
+ $this->get(route('security.cloud-tokens.show', ['cloud_token_uuid' => $token->uuid]))
+ ->assertSuccessful()
+ ->assertSee('Cloud Token')
+ ->assertSee('Production Hetzner')
+ ->assertSee('Used for production servers.')
+ ->assertSee('Validate')
+ ->assertSee('Delete');
+});
+
+test('cloud token detail page updates name and description', function () {
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Production Hetzner',
+ 'description' => 'Used for production servers.',
+ ]);
+
+ Livewire::test(Show::class, ['cloud_token_uuid' => $token->uuid])
+ ->set('name', 'Renamed Hetzner')
+ ->set('description', 'Used for staging servers.')
+ ->call('save')
+ ->assertHasNoErrors()
+ ->assertDispatched('success');
+
+ $this->assertDatabaseHas('cloud_provider_tokens', [
+ 'id' => $token->id,
+ 'name' => 'Renamed Hetzner',
+ 'description' => 'Used for staging servers.',
+ ]);
+});
+
+test('cloud token detail page validates the token', function () {
+ Http::fake([
+ 'https://api.hetzner.cloud/v1/servers?per_page=1' => Http::response([], 200),
+ ]);
+
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'provider' => 'hetzner',
+ ]);
+
+ Livewire::test(Show::class, ['cloud_token_uuid' => $token->uuid])
+ ->call('validateToken')
+ ->assertDispatched('success');
+});
+
+test('cloud token detail page deletes unused tokens', function () {
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'name' => 'Production Hetzner',
+ ]);
+
+ Livewire::test(Show::class, ['cloud_token_uuid' => $token->uuid])
+ ->call('delete')
+ ->assertRedirectToRoute('security.cloud-tokens');
+
+ $this->assertModelMissing($token);
+});
diff --git a/tests/Feature/Security/PrivateKeyDropdownTest.php b/tests/Feature/Security/PrivateKeyDropdownTest.php
new file mode 100644
index 0000000000..6152e0c2b9
--- /dev/null
+++ b/tests/Feature/Security/PrivateKeyDropdownTest.php
@@ -0,0 +1,97 @@
+<?php
+
+use App\Livewire\Security\PrivateKey\Create;
+use App\Livewire\Security\PrivateKey\Index;
+use App\Models\InstanceSettings;
+use App\Models\PrivateKey;
+use App\Models\Team;
+use App\Models\User;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\Config;
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Storage;
+use Illuminate\Support\Once;
+use Livewire\Livewire;
+
+uses(RefreshDatabase::class);
+
+beforeEach(function () {
+ if (! InstanceSettings::query()->whereKey(0)->exists()) {
+ $settings = new InstanceSettings;
+ $settings->id = 0;
+ $settings->save();
+ }
+ Once::flush();
+
+ $this->team = Team::factory()->create();
+ $this->user = User::factory()->create();
+ $this->team->members()->attach($this->user->id, ['role' => 'owner']);
+
+ session(['currentTeam' => $this->team]);
+ $this->actingAs($this->user);
+
+ Log::spy();
+ Config::set('cache.default', 'array');
+ Storage::fake('ssh-keys');
+});
+
+test('private key index shows highlighted add dropdown actions', function () {
+ Livewire::test(Index::class)
+ ->assertSee('+ Add')
+ ->assertSee('Generate ED25519')
+ ->assertSee('Generate RSA')
+ ->assertSee('Add manually')
+ ->assertDontSee('Manage your SSH keys for your servers and integrations.');
+});
+
+test('generating a private key from the index stores it and redirects to details', function () {
+ $component = Livewire::test(Index::class)
+ ->call('generatePrivateKey', 'ed25519');
+
+ $privateKey = PrivateKey::query()->firstOrFail();
+
+ expect($privateKey->team_id)->toBe($this->team->id)
+ ->and($privateKey->public_key)->toStartWith('ssh-ed25519');
+
+ $component->assertRedirect(route('security.private-key.show', [
+ 'private_key_uuid' => $privateKey->uuid,
+ ]));
+});
+
+test('manual private key form does not expose key generation controls', function () {
+ Livewire::test(Create::class)
+ ->assertDontSee('Generate new ED25519 SSH Key')
+ ->assertDontSee('Generate new RSA SSH Key');
+});
+
+test('private key details view reminds users to install the public key', function () {
+ $view = file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php'));
+
+ expect($view)->toContain("ACTION REQUIRED: Copy the 'Public Key' to your server's ~/.ssh/authorized_keys file");
+});
+
+test('github app private key shows a highlighted badge under the title', function () {
+ $privateKey = PrivateKey::factory()->create([
+ 'team_id' => $this->team->id,
+ 'is_git_related' => true,
+ ]);
+
+ $this->get(route('security.private-key.show', [
+ 'private_key_uuid' => $privateKey->uuid,
+ ]))
+ ->assertSuccessful()
+ ->assertSee('Used by GitHub App')
+ ->assertDontSee('Is used by a Git App?');
+});
+
+test('github app badge appears before the save button in the title row', function () {
+ $view = file_get_contents(resource_path('views/livewire/security/private-key/show.blade.php'));
+
+ $badgePosition = strpos($view, 'Used by GitHub App');
+ $saveButtonPosition = strpos($view, '<x-forms.button canGate="update" :canResource="$private_key" type="submit">');
+
+ expect($view)->toContain('<div class="flex items-center gap-2 pb-4">')
+ ->and($view)->toContain('Used by GitHub App')
+ ->and($view)->toContain('<x-forms.button canGate="update" :canResource="$private_key" type="submit">')
+ ->and($badgePosition)->toBeLessThan($saveButtonPosition);
+});
diff --git a/tests/Feature/Server/NewServerProviderTokenUrlTest.php b/tests/Feature/Server/NewServerProviderTokenUrlTest.php
index b5c23b9299..320d020e1e 100644
--- a/tests/Feature/Server/NewServerProviderTokenUrlTest.php
+++ b/tests/Feature/Server/NewServerProviderTokenUrlTest.php
@@ -129,6 +129,33 @@ test('provider token pages defer provider api data loading until wire init', fun
'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'Loading DigitalOcean data...', 'wire:init="loadDigitalOceanData"'],
]);
+test('provider token pages render api error details when a selected token is invalid', function (string $component, string $provider, string $type, string $loadMethod, string $providerName, string $apiMessage) {
+ $token = CloudProviderToken::factory()->create([
+ 'team_id' => $this->team->id,
+ 'provider' => $provider,
+ 'name' => $providerName.' Token',
+ ]);
+
+ Http::fake([
+ '*' => Http::response($apiMessage, 401),
+ ]);
+
+ Livewire::test($component, ['selectedTokenUuid' => $token->uuid])
+ ->call($loadMethod)
+ ->assertSet('loading_data', false)
+ ->assertSet('provider_data_error', "{$providerName} API error: {$apiMessage}")
+ ->assertDispatched('error')
+ ->assertSee("Unable to load {$providerName} details")
+ ->assertSee($apiMessage)
+ ->assertSee('href="'.route('server.create.type', ['type' => $type]).'"', false)
+ ->assertSee('wire:navigate', false)
+ ->assertDontSee('wire:click="previousStep"', false);
+})->with([
+ 'hetzner' => [ByHetzner::class, 'hetzner', 'hetzner', 'loadHetznerData', 'Hetzner', 'the token you have provided is invalid'],
+ 'vultr' => [ByVultr::class, 'vultr', 'vultr', 'loadVultrData', 'Vultr', 'Invalid API key'],
+ 'digital-ocean' => [ByDigitalOcean::class, 'digitalocean', 'digital-ocean', 'loadDigitalOceanData', 'DigitalOcean', 'Unable to authenticate you'],
+]);
+
test('back button on token specific provider creation pages returns to provider token selection', function (string $provider, string $type) {
$token = CloudProviderToken::factory()->create([
'team_id' => $this->team->id,
diff --git a/tests/Unit/CloudProviderTokenFormViewTest.php b/tests/Unit/CloudProviderTokenFormViewTest.php
index 64be1328ba..26f7e83f61 100644
--- a/tests/Unit/CloudProviderTokenFormViewTest.php
+++ b/tests/Unit/CloudProviderTokenFormViewTest.php
@@ -27,3 +27,40 @@ it('keeps provider affiliate links on server provider views', function () {
->and($vultrView)->toContain('https://coolify.io/vultr')
->and($digitalOceanView)->toContain('https://coolify.io/digitalocean');
});
+
+it('uses a provider dropdown and modal forms on cloud provider tokens page', function () {
+ $view = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-tokens.blade.php');
+
+ expect($view)->toContain('+ Add')
+ ->and($view)->toContain('<div class="flex items-center gap-2">')
+ ->and($view)->toContain('<div class="grid gap-4 lg:grid-cols-2">')
+ ->and($view)->toContain('class="coolbox group"')
+ ->and($view)->toContain('<div class="box-title">')
+ ->and($view)->toContain('<div class="box-description">')
+ ->and($view)->toContain('<x-forms.button isHighlighted @click="dropdownOpen = !dropdownOpen" type="button">')
+ ->and($view)->toContain('Add Hetzner Token')
+ ->and($view)->toContain('Add DigitalOcean Token')
+ ->and($view)->toContain('Add Vultr Token')
+ ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="hetzner"')
+ ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="digitalocean"')
+ ->and($view)->toContain('<livewire:security.cloud-provider-token-form :modal_mode="true" provider="vultr"')
+ ->and($view)->not->toContain('<h3>New Token</h3>')
+ ->and($view)->not->toContain(':modal_mode="false"')
+ ->and($view)->not->toContain('wire:click="validateToken')
+ ->and($view)->not->toContain('submitAction="deleteToken')
+ ->and($view)->not->toContain('Created {{ $savedToken->created_at->diffForHumans() }}');
+});
+
+it('shows explicit loading spinners and disables cloud token action buttons while requests run', function () {
+ $tokenFormView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token-form.blade.php');
+ $tokenShowView = file_get_contents(__DIR__.'/../../resources/views/livewire/security/cloud-provider-token/show.blade.php');
+ $serverTokenView = file_get_contents(__DIR__.'/../../resources/views/livewire/server/cloud-provider-token/show.blade.php');
+
+ expect(substr_count($tokenFormView, 'wire:loading.attr="disabled" wire:target="addToken"'))->toBe(2)
+ ->and(substr_count($tokenFormView, '<x-loading-on-button wire:loading wire:target="addToken" />'))->toBe(2)
+ ->and($tokenShowView)->toContain('wire:loading.attr="disabled" wire:target="validateToken"')
+ ->and($tokenShowView)->toContain('<x-loading-on-button wire:loading wire:target="validateToken" />')
+ ->and($serverTokenView)->toContain('wire:loading.attr="disabled"')
+ ->and($serverTokenView)->toContain('wire:target="validateToken"')
+ ->and($serverTokenView)->toContain('<x-loading-on-button wire:loading wire:target="validateToken" />');
+});