|
1 | 1 | <div>
|
2 | 2 | <x-slot:title>
|
3 | 3 | API Tokens | Coolify
|
4 |
| - </x-slot> |
5 |
| - <x-security.navbar /> |
6 |
| - <div class="pb-4 "> |
7 |
| - <h2>API Tokens</h2> |
8 |
| - @if (!$instanceSettings->is_api_enabled) |
9 |
| - <strong>API is disabled. If you want to use the API, please enable it in the Coolify Instance Settings.</strong> |
10 |
| - @else |
| 4 | + </x-slot> |
| 5 | + <x-security.navbar /> |
| 6 | + <div class="pb-4"> |
| 7 | + <h2>API Tokens</h2> |
| 8 | + @if (!$isApiEnabled) |
| 9 | + <div>API is disabled. If you want to use the API, please enable it in the Settings menu.</div> |
| 10 | + @else |
11 | 11 | <div>Tokens are created with the current team as scope. You will only have access to this team's resources.
|
12 | 12 | </div>
|
| 13 | + </div> |
| 14 | + <h3>New Token</h3> |
| 15 | + <form class="flex flex-col gap-2 pt-4" wire:submit='addNewToken'> |
| 16 | + <div class="flex gap-2 items-end"> |
| 17 | + <x-forms.input required id="description" label="Description" /> |
| 18 | + <x-forms.button type="submit">Create New Token</x-forms.button> |
13 | 19 | </div>
|
14 |
| - <h3>New Token</h3> |
15 |
| - <form class="flex flex-col gap-2 pt-4" wire:submit='addNewToken'> |
16 |
| - <div class="flex items-end gap-2"> |
17 |
| - <x-forms.input required id="description" label="Description" /> |
18 |
| - <x-forms.button type="submit">Create New Token</x-forms.button> |
19 |
| - </div> |
20 |
| - <div class="flex"> |
21 |
| - Permissions |
22 |
| - <x-helper class="px-1" helper="These permissions will be granted to the token." /><span class="pr-1">:</span> |
23 |
| - <div class="flex gap-1 font-bold dark:text-white"> |
24 |
| - @if ($permissions) |
| 20 | + <div class="flex"> |
| 21 | + Permissions |
| 22 | + <x-helper class="px-1" helper="These permissions will be granted to the token." /><span |
| 23 | + class="pr-1">:</span> |
| 24 | + <div class="flex gap-1 font-bold dark:text-white"> |
| 25 | + @if ($permissions) |
25 | 26 | @foreach ($permissions as $permission)
|
26 |
| - @if ($permission === '*') |
27 |
| - <div>All (root/admin access), be careful!</div> |
28 |
| - @else |
29 |
| - <div>{{ $permission }}</div> |
30 |
| - @endif |
| 27 | + @if ($permission === '*') |
| 28 | + <div>All (root/admin access), be careful!</div> |
| 29 | + @else |
| 30 | + <div>{{ $permission }}</div> |
| 31 | + @endif |
31 | 32 | @endforeach
|
32 |
| - @endif |
33 |
| - </div> |
34 |
| - </div> |
35 |
| - <h4>Token Permissions</h4> |
36 |
| - <div class="w-64"> |
37 |
| - <x-forms.checkbox label="Read-only" wire:model.live="readOnly"></x-forms.checkbox> |
38 |
| - <x-forms.checkbox label="View Sensitive Data" wire:model.live="viewSensitiveData"></x-forms.checkbox> |
| 33 | + @endif |
39 | 34 | </div>
|
40 |
| - </form> |
41 |
| - @if (session()->has('token')) |
| 35 | + </div> |
| 36 | + <h4>Token Permissions</h4> |
| 37 | + <div class="w-64"> |
| 38 | + <x-forms.checkbox label="Read-only" wire:model.live="readOnly"></x-forms.checkbox> |
| 39 | + <x-forms.checkbox label="View Sensitive Data" wire:model.live="viewSensitiveData"></x-forms.checkbox> |
| 40 | + </div> |
| 41 | + </form> |
| 42 | + @if (session()->has('token')) |
42 | 43 | <div class="py-4 font-bold dark:text-warning">Please copy this token now. For your security, it won't be shown
|
43 | 44 | again.
|
44 | 45 | </div>
|
45 | 46 | <div class="pb-4 font-bold dark:text-white"> {{ session('token') }}</div>
|
46 |
| - @endif |
47 |
| - <h3 class="py-4">Issued Tokens</h3> |
48 |
| - <div class="grid gap-2 lg:grid-cols-1"> |
49 |
| - @forelse ($tokens as $token) |
| 47 | + @endif |
| 48 | + <h3 class="py-4">Issued Tokens</h3> |
| 49 | + <div class="grid gap-2 lg:grid-cols-1"> |
| 50 | + @forelse ($tokens as $token) |
50 | 51 | <div class="flex flex-col gap-1 p-2 border dark:border-coolgray-200 hover:no-underline">
|
51 | 52 | <div>Description: {{ $token->name }}</div>
|
52 | 53 | <div>Last used: {{ $token->last_used_at ? $token->last_used_at->diffForHumans() : 'Never' }}</div>
|
53 | 54 | <div class="flex gap-1">
|
54 | 55 | @if ($token->abilities)
|
55 |
| - Abilities: |
56 |
| - @foreach ($token->abilities as $ability) |
57 |
| - <div class="font-bold dark:text-white">{{ $ability }}</div> |
58 |
| - @endforeach |
| 56 | + Abilities: |
| 57 | + @foreach ($token->abilities as $ability) |
| 58 | + <div class="font-bold dark:text-white">{{ $ability }}</div> |
| 59 | + @endforeach |
59 | 60 | @endif
|
60 | 61 | </div>
|
61 | 62 |
|
62 |
| - <x-modal-confirmation title="Confirm API Token Revocation?" isErrorButton buttonTitle="Revoke token" submitAction="revoke({{ data_get($token, 'id') }})" :actions="['This API Token will be revoked and permanently deleted.', 'Any API call made with this token will fail.']" confirmationText="{{ $token->name }}" confirmationLabel="Please confirm the execution of the actions by entering the API Token Description below" shortConfirmationLabel="API Token Description" :confirmWithPassword="false" step2ButtonText="Revoke API Token" /> |
| 63 | + <x-modal-confirmation title="Confirm API Token Revocation?" isErrorButton buttonTitle="Revoke token" |
| 64 | + submitAction="revoke({{ data_get($token, 'id') }})" :actions="[ |
| 65 | + 'This API Token will be revoked and permanently deleted.', |
| 66 | + 'Any API call made with this token will fail.', |
| 67 | + ]" |
| 68 | + confirmationText="{{ $token->name }}" |
| 69 | + confirmationLabel="Please confirm the execution of the actions by entering the API Token Description below" |
| 70 | + shortConfirmationLabel="API Token Description" :confirmWithPassword="false" |
| 71 | + step2ButtonText="Revoke API Token" /> |
63 | 72 | </div>
|
64 |
| - @empty |
| 73 | + @empty |
65 | 74 | <div>
|
66 | 75 | <div>No API tokens found.</div>
|
67 | 76 | </div>
|
68 |
| - @endforelse |
69 |
| - </div> |
70 |
| - @endif |
| 77 | + @endforelse |
| 78 | + </div> |
| 79 | + @endif |
71 | 80 | </div>
|
0 commit comments