mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(server): list the active private key first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ef27d1a94d
commit
64b748008e
@@ -30,7 +30,10 @@ class Show extends Component
|
||||
|
||||
private function loadPrivateKeys(): void
|
||||
{
|
||||
$this->privateKeys = PrivateKey::where('team_id', $this->server->team_id)->get()->where('is_git_related', false);
|
||||
$this->privateKeys = PrivateKey::where('team_id', $this->server->team_id)->get()
|
||||
->where('is_git_related', false)
|
||||
->sortBy(fn (PrivateKey $privateKey) => $privateKey->id !== $this->server->private_key_id)
|
||||
->values();
|
||||
}
|
||||
|
||||
public function setPrivateKey($privateKeyId)
|
||||
@@ -51,6 +54,7 @@ class Show extends Component
|
||||
throw new \Exception($error);
|
||||
}
|
||||
});
|
||||
$this->loadPrivateKeys();
|
||||
$this->dispatch('success', 'Private key updated successfully.');
|
||||
$this->dispatch('refreshServerShow');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -135,4 +135,13 @@ describe('after the user switches the session team', function () {
|
||||
|
||||
expect($this->server->fresh()->private_key_id)->toBe($this->sameTeamKey->id);
|
||||
});
|
||||
|
||||
test('lists the active key first', function () {
|
||||
expect($this->component->get('privateKeys')->first()->id)->toBe($this->currentPrivateKey->id);
|
||||
|
||||
$keys = $this->component->call('setPrivateKey', $this->sameTeamKey->id)->get('privateKeys');
|
||||
|
||||
expect($keys->first()->id)->toBe($this->sameTeamKey->id)
|
||||
->and($keys->pluck('id'))->toContain($this->currentPrivateKey->id);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user