mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 16:17:10 +00:00
feat(security): add editable cloud credential pages
Add dedicated show/edit pages for cloud provider tokens and cloud-init scripts, including descriptions and UUID routes. Generate private keys directly from the index and surface cloud provider API loading errors in server creation flows.
This commit is contained in:
1 parent
7236cb8228
commit
e200d881f5
36 files changed
+1196
-126
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user