diff --git a/app/Livewire/Security/ApiTokens.php b/app/Livewire/Security/ApiTokens.php index 1a0ca51ef..40752630e 100644 --- a/app/Livewire/Security/ApiTokens.php +++ b/app/Livewire/Security/ApiTokens.php @@ -17,18 +17,16 @@ class ApiTokens extends Component public array $permissions = ['read-only']; - public $instanceSettings; + public $isApiEnabled; public function render() { - return view('livewire.security.api-tokens', [ - 'instanceSettings' => $this->instanceSettings, - ]); + return view('livewire.security.api-tokens'); } public function mount() { - $this->instanceSettings = InstanceSettings::get(); + $this->isApiEnabled = InstanceSettings::get()->is_api_enabled; $this->tokens = auth()->user()->tokens->sortByDesc('created_at'); } diff --git a/resources/views/livewire/security/api-tokens.blade.php b/resources/views/livewire/security/api-tokens.blade.php index 3da3a2dbe..ed201e3ab 100644 --- a/resources/views/livewire/security/api-tokens.blade.php +++ b/resources/views/livewire/security/api-tokens.blade.php @@ -1,71 +1,80 @@
API Tokens | Coolify - - -
-

API Tokens

- @if (!$instanceSettings->is_api_enabled) - API is disabled. If you want to use the API, please enable it in the Coolify Instance Settings. - @else + + +
+

API Tokens

+ @if (!$isApiEnabled) +
API is disabled. If you want to use the API, please enable it in the Settings menu.
+ @else
Tokens are created with the current team as scope. You will only have access to this team's resources.
+
+

New Token

+
+
+ + Create New Token
-

New Token

- -
- - Create New Token -
-
- Permissions - : -
- @if ($permissions) +
+ Permissions + : +
+ @if ($permissions) @foreach ($permissions as $permission) - @if ($permission === '*') -
All (root/admin access), be careful!
- @else -
{{ $permission }}
- @endif + @if ($permission === '*') +
All (root/admin access), be careful!
+ @else +
{{ $permission }}
+ @endif @endforeach - @endif -
+ @endif
-

Token Permissions

-
- - -
- - @if (session()->has('token')) +
+

Token Permissions

+
+ + +
+ + @if (session()->has('token'))
Please copy this token now. For your security, it won't be shown again.
{{ session('token') }}
- @endif -

Issued Tokens

-
- @forelse ($tokens as $token) + @endif +

Issued Tokens

+
+ @forelse ($tokens as $token)
Description: {{ $token->name }}
Last used: {{ $token->last_used_at ? $token->last_used_at->diffForHumans() : 'Never' }}
@if ($token->abilities) - Abilities: - @foreach ($token->abilities as $ability) -
{{ $ability }}
- @endforeach + Abilities: + @foreach ($token->abilities as $ability) +
{{ $ability }}
+ @endforeach @endif
- +
- @empty + @empty
No API tokens found.
- @endforelse -
- @endif + @endforelse +
+ @endif