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