fix: typos and naming

This commit is contained in:
peaklabs-dev
2024-12-03 15:50:45 +01:00
parent 24cd57ca8d
commit fef8d0c62c
2 changed files with 13 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ class Change extends Component
$this->github_app->refresh()->makeVisible('client_secret')->makeVisible('webhook_secret'); $this->github_app->refresh()->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->dispatch('success', 'Github App permissions updated.'); $this->dispatch('success', 'Github App permissions updated.');
} }
// public function check() // public function check()
// { // {
@@ -95,6 +96,7 @@ class Change extends Component
// ray($runners_by_repository); // ray($runners_by_repository);
// } // }
public function mount() public function mount()
{ {
try { try {
@@ -147,7 +149,7 @@ class Change extends Component
} }
} }
public function getUpdatePath() public function getGithubAppNameUpdatePath()
{ {
return "{$this->github_app->html_url}/settings/apps/{$this->github_app->name}"; return "{$this->github_app->html_url}/settings/apps/{$this->github_app->name}";
} }
@@ -172,13 +174,13 @@ class Change extends Component
->toString(); ->toString();
} }
public function syncGithubAppName() public function updateGithubAppName()
{ {
try { try {
$privateKey = PrivateKey::find($this->github_app->private_key_id); $privateKey = PrivateKey::find($this->github_app->private_key_id);
if (! $privateKey) { if (! $privateKey) {
$this->dispatch('error', 'Private key not found for this GitHub App.'); $this->dispatch('error', 'No private key found for this GitHub App.');
return; return;
} }
@@ -201,13 +203,13 @@ class Change extends Component
$privateKey->name = "github-app-{$app_slug}"; $privateKey->name = "github-app-{$app_slug}";
$privateKey->save(); $privateKey->save();
$this->github_app->save(); $this->github_app->save();
$this->dispatch('success', 'Github App name and SSH key name synchronized successfully.'); $this->dispatch('success', 'GitHub App name and SSH key name synchronized successfully.');
} else { } else {
$this->dispatch('info', 'Could not find app slug in GitHub response.'); $this->dispatch('info', 'Could not find App Name (slug) in GitHub response.');
} }
} else { } else {
$error_message = $response->json()['message'] ?? 'Unknown error'; $error_message = $response->json()['message'] ?? 'Unknown error';
$this->dispatch('error', "Failed to fetch Github App information: {$error_message}"); $this->dispatch('error', "Failed to fetch GitHub App information: {$error_message}");
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);

View File

@@ -60,10 +60,12 @@
<div class="flex gap-2"> <div class="flex gap-2">
<div class="flex items-end gap-2 w-full"> <div class="flex items-end gap-2 w-full">
<x-forms.input id="github_app.name" label="App Name" disabled /> <x-forms.input id="github_app.name" label="App Name" disabled />
<x-forms.button wire:click.prevent="syncGithubAppName">Sync Name</x-forms.button> <x-forms.button wire:click.prevent="updateGithubAppName" class="bg-coollabs">
<a href="{{ $this->getUpdatePath() }}"> Sync Name
</x-forms.button>
<a href="{{ $this->getGithubAppNameUpdatePath() }}">
<x-forms.button> <x-forms.button>
Update Rename
<x-external-link /> <x-external-link />
</x-forms.button> </x-forms.button>
</a> </a>