A free open source IT asset/license management system
Tabbed UI
snipe6ada1a646f96
diff --git a/resources/views/livewire/oauth-clients.blade.php b/resources/views/livewire/oauth-clients.blade.phpindex 87a948c839..767251193d 100644--- a/resources/views/livewire/oauth-clients.blade.php+++ b/resources/views/livewire/oauth-clients.blade.php@@ -1,210 +1,145 @@<div>- <div class="box box-default">-- <div class="box-header">- <h2 class="box-title">- <x-icon type="oauth"/>- {{ trans('admin/settings/general.oauth_clients') }}- </h2>- @if ($authorizationError)- <div class="alert alert-danger">- <p>{{ trans('admin/users/message.insufficient_permissions') }}- <br>- {{ $authorizationError }}- </p>- </div>- @endif-- <div class="box-tools pull-right">- <a class="btn btn-primary"- wire:click="$dispatch('openModal')"- onclick="$('#modal-create-client').modal('show');">- {{ trans('general.create') }}- </a>- </div>- </div>-- <div class="box-body">- <!-- Current Clients -->- @if($clients->count() === 0)- <p>- {{ trans('admin/settings/general.oauth_no_clients') }}- </p>- @endif-- @if ($clients->count() > 0)- <table data-cookie-id-table="OAuthClientsTable"- data-id-table="OAuthClientsTable"- data-side-pagination="client"- data-sort-order="desc"- data-sort-name="created_at"- id="OAuthClientsTable"- class="table table-striped snipe-table">- <thead>+ @if ($authorizationError)+ <div class="alert alert-danger">+ <p>+ {{ trans('admin/users/message.insufficient_permissions') }}+ <br>+ {{ $authorizationError }}+ </p>+ </div>+ @endif++ @if ($this->showOauthClients())++ @if($clients->count() === 0)+ <p>{{ trans('admin/settings/general.oauth_no_clients') }}</p>+ @else+ <div id="OAuthClientsToolbar" class="pull-left" style="min-width: 280px; padding-top: 10px;"></div>+ <table+ data-cookie-id-table="OAuthClientsTable"+ data-id-table="OAuthClientsTable"+ data-toolbar="#OAuthClientsToolbar"+ data-side-pagination="client"+ data-sort-order="desc"+ data-buttons="oauthButtons"+ data-sort-name="created_at"+ id="OAuthClientsTable"+ class="table table-striped snipe-table"+ >+ <thead>+ <tr>+ <th data-field="id" data-sortable="true">{{ trans('general.id') }}</th>+ <th data-field="name" data-sortable="true">{{ trans('general.name') }}</th>+ <th data-field="redirect" data-sortable="true">{{ trans('admin/settings/general.oauth_redirect_url') }}</th>+ <th data-field="secret" data-sortable="true">{{ trans('admin/settings/general.oauth_secret') }}</th>+ <th data-field="created_at" data-sortable="true">{{ trans('general.created_at') }}</th>+ <th data-field="updated_at" data-sortable="true">{{ trans('general.updated_at') }}</th>+ <th>+ <span class="sr-only">{{ trans('general.actions') }}</span>+ </th>+ </tr>+ </thead>+ <tbody>+ @foreach($clients as $client)<tr>- <th>{{ trans('general.id') }}</th>- <th data-sortable="true">{{ trans('general.name') }}</th>- <th data-sortable="true">{{ trans('admin/settings/general.oauth_redirect_url') }}</th>- <th data-sortable="true">{{ trans('admin/settings/general.oauth_secret') }}</th>- <th data-sortable="true">{{ trans('general.created_at') }}</th>- <th data-sortable="true">{{ trans('general.updated_at') }}</th>- <th>- <span class="sr-only">- {{ trans('general.actions') }}- </span>- </th>+ <td>{{ $client->id }}</td>+ <td>{{ $client->name }}</td>+ <td><code>{{ $client->redirect }}</code></td>+ <td><code>{{ $client->secret }}</code></td>+ <td>{{ $client->created_at ? Helper::getFormattedDateObject($client->created_at, 'datetime', false) : '' }}</td>+ <td>+ @if ($client->created_at != $client->updated_at)+ {{ $client->updated_at ? Helper::getFormattedDateObject($client->updated_at, 'datetime', false) : '' }}+ @endif+ </td>+ <td class="text-right">+ <a class="action-link btn btn-sm btn-warning" wire:click="editClient('{{ $client->id }}')" onclick="$('#modal-edit-client').modal('show');">+ <i class="fas fa-pencil-alt" aria-hidden="true"></i>+ <span class="sr-only">{{ trans('general.update') }}</span>+ </a>+ <a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')">+ <i class="fas fa-trash" aria-hidden="true"></i>+ <span class="sr-only">{{ trans('general.delete') }}</span>+ </a>+ </td></tr>- </thead>- <tbody>- @foreach($clients as $client)- <tr>- <!-- ID -->- <td>- {{ $client->id }}- </td>-- <!-- Name -->- <td>- {{ $client->name }}- </td>-- <!-- Redirect -->- <td>- <code>{{ $client->redirect }}</code>- </td>-- <!-- Secret -->- <td>- <code>{{ $client->secret }}</code>- </td>-- <td>- {{ $client->created_at ? Helper::getFormattedDateObject($client->created_at, 'datetime', false) : '' }}- </td>-- <td>- @if ($client->created_at != $client->updated_at)- {{ $client->updated_at ? Helper::getFormattedDateObject($client->updated_at, 'datetime', false) : '' }}- @endif- </td>-- <!-- Edit / Delete Button -->- <td class="text-right">-- <a class="action-link btn btn-sm btn-warning"- wire:click="editClient('{{ $client->id }}')"- onclick="$('#modal-edit-client').modal('show');">- <i class="fas fa-pencil-alt" aria-hidden="true"></i>- <span class="sr-only">- {{ trans('general.update') }}- </span>- </a>-- <a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')">- <i class="fas fa-trash" aria-hidden="true"></i>- <span class="sr-only">- {{ trans('general.delete') }}- </span>+ @endforeach+ </tbody>+ </table>+ @endif+ @endif++ @if ($this->showAuthorizedApplications())+ @if($authorizedApplications->count() === 0)+ <p>{{ trans('admin/settings/general.oauth_no_clients') }}</p>+ @else+ <div id="AuthorizedAppsToolbar" class="pull-left" style="min-width: 280px; padding-top: 10px;"></div>+ <table+ data-cookie-id-table="AuthorizedAppsTable"+ data-id-table="AuthorizedAppsTable"+ data-toolbar="#AuthorizedAppsToolbar"+ data-side-pagination="client"+ data-sort-order="desc"+ data-sort-name="created_at"+ id="AuthorizedAppsTable"+ class="table table-striped snipe-table"+ >+ <thead>+ <tr>+ <th data-field="name" data-sortable="true">{{ trans('general.name') }}</th>+ <th data-field="client_owner" data-sortable="true">{{ trans('general.user') }}</th>+ <th data-field="personal_access_token" data-sortable="true">{{ trans('account/general.personal_access_token') }}</th>+ <th data-field="oauth_scopes" data-sortable="true">{{ trans('admin/settings/general.oauth_scopes') }}</th>+ <th data-field="created_at" data-sortable="true">{{ trans('general.created_at') }}</th>+ <th data-field="expires" data-sortable="true">{{ trans('general.expires') }}</th>+ <th>+ <span class="sr-only">{{ trans('general.actions') }}</span>+ </th>+ </tr>+ </thead>+ <tbody>+ @foreach($authorizedApplications as $application)+ <tr>+ <td>{{ $application->client_name }}</td>+ <td>+ @php+ $ownerLabel = $application->client_owner_display_name ?: $application->client_owner_username;+ $ownerSoftDeleted = $application->client_owner_deleted_at !== null;+ @endphp+ @if($application->client_owner_id && $ownerLabel)+ <a href="{{ route('users.show', $application->client_owner_id) }}">+ @if($ownerSoftDeleted)+ <del>{{ $ownerLabel }}</del>+ @else+ {{ $ownerLabel }}+ @endif</a>- </td>- </tr>- @endforeach- </tbody>- </table>- @endif- </div>- </div>---- <div>- @if ($authorized_tokens->count() > 0)- <div>- <div class="box box-default">- <div class="box-header">- <h2 class="box-title">- {{ trans('admin/settings/general.oauth_authorized_apps') }}- </h2>- </div>-- <div class="box-body">- <!-- Authorized Tokens -->- <table data-cookie-id-table="AuthorizedAppsTable"- data-id-table="AuthorizedAppsTable"- data-toolbar="#AuthorizedAppsToolbar"- data-side-pagination="client"- data-sort-order="desc"- data-sort-name="created_at"- id="AuthorizedAppsTable"- class="table table-striped snipe-table">- <thead>- <tr>- <th data-sortable="true">{{ trans('general.name') }}</th>- <th data-sortable="true"> {{ trans('account/general.personal_access_token') }}</th>- <th data-sortable="true">{{ trans('admin/settings/general.oauth_scopes') }}</th>- <th data-sortable="true">{{ trans('general.created_at') }}</th>- <th data-sortable="true">{{ trans('general.expires') }}</th>- <th>- <span class="sr-only">- {{ trans('general.actions') }}- </span>- </th>- </tr>- </thead>-- <tbody>- @foreach($authorized_tokens as $token)- <tr>- <!-- Client Name -->- <td>- {{ $token->client->name }}- </td>-- <td>- {{ $token->name }}- </td>-- <!-- Scopes -->- <td>- @if(!$token->scopes)- <span class="label label-default">- {{ trans('admin/settings/general.no_scopes') }}- </span>- @endif- </td>-- <td>- {{ $token->created_at ? Helper::getFormattedDateObject($token->created_at, 'datetime', false) : '' }}- </td>-- <td>- {{ $token->expires_at ? Helper::getFormattedDateObject($token->expires_at, 'datetime', false) : '' }}- </td>- <!-- Revoke Button -->- <td>- <a class="btn btn-sm btn-danger pull-right"- wire:click="deleteToken('{{ $token->id }}')"- >- <i class="fas fa-trash" aria-hidden="true"></i>- <span class="sr-only">- {{ trans('general.delete') }}- </span>- </a>- </td>- </tr>- @endforeach- </tbody>- </table>- </div>- </div>- </div>- @endif----+ @else+ {{ trans('general.na') }}+ @endif+ </td>+ <td>{{ $application->token_name }}</td>+ <td>+ @if(!$application->scopes)+ <span class="label label-default">{{ trans('admin/settings/general.no_scopes') }}</span>+ @endif+ </td>+ <td>{{ $application->created_at ? Helper::getFormattedDateObject($application->created_at, 'datetime', false) : '' }}</td>+ <td>{{ $application->expires_at ? Helper::getFormattedDateObject($application->expires_at, 'datetime', false) : '' }}</td>+ <td>+ <a class="btn btn-sm btn-danger pull-right" wire:click="deleteToken('{{ $application->token_id }}')">+ <i class="fas fa-trash" aria-hidden="true"></i>+ <span class="sr-only">{{ trans('general.delete') }}</span>+ </a>+ </td>+ </tr>+ @endforeach+ </tbody>+ </table>+ @endif+ @endif- <!-- Create Client Modal -->+ @if ($this->showOauthClients())<div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog" wire:ignore.self><div class="modal-dialog"><div class="modal-content">@@ -292,10 +227,7 @@</div></div></div>-</div>-- <!-- Edit Client Modal --><div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog" wire:ignore.self><div class="modal-dialog"><div class="modal-content">@@ -384,6 +316,7 @@</div></div></div>+<script>document.addEventListener('DOMContentLoaded', function() {Livewire.on('openModal', () => {@@ -401,14 +334,6 @@window.addEventListener('clientUpdated', function() {$('#modal-edit-client').modal('hide');});---</script>+ @endif</div>--@section('moar_scripts')- @include ('partials.bootstrap-table')-@endsection--diff --git a/resources/views/settings/api.blade.php b/resources/views/settings/api.blade.phpindex 33b91d73ba..5b00a88bcd 100644--- a/resources/views/settings/api.blade.php+++ b/resources/views/settings/api.blade.php@@ -6,16 +6,124 @@@parent@stop-@section('header_right')- <a href="{{ route('settings.index') }}" class="btn btn-default pull-right">{{ trans('general.back') }}</a>-@stop{{-- Page content --}}@section('content')@if (!config('app.lock_passwords'))- <div id="app">- <livewire:oauth-clients />- </div>+ <x-container>+ <x-page-column>+ <x-tabs>+ <x-slot:tabnav>+ <x-tabs.nav-item+ class="active"+ name="authorized-applications"+ :label="trans('admin/settings/general.oauth_authorized_apps')"+ />+ <x-tabs.nav-item+ name="personal-access-tokens"+ :label="trans('admin/settings/general.oauth_personal_access_tokens')"+ :count="($personalAccessTokens ?? collect())->count()"+ />+ <x-tabs.nav-item+ name="oauth-clients"+ :label="trans('admin/settings/general.oauth_clients')"+ />+ </x-slot:tabnav>++ <x-slot:tabpanes>+ <x-tabs.pane name="authorized-applications">+ <div class="oauth-tab-content">+ <livewire:oauth-clients section="authorized-applications"/>+ </div>+ </x-tabs.pane>++ <x-tabs.pane name="personal-access-tokens">+ @if(($personalAccessTokens ?? collect())->isEmpty())+ <p class="text-muted">{{ trans('admin/settings/general.oauth_personal_access_tokens_none') }}</p>+ @else+ <div id="PersonalAccessTokensToolbar" class="pull-left" style="min-width: 280px; padding-top: 10px;"></div>+ <div class="table-responsive">+ <table+ class="table table-striped snipe-table"+ data-toolbar="#PersonalAccessTokensToolbar"+ data-toggle="table"+ data-sort-name="created_at"+ data-sort-order="desc"+ >+ <thead>+ <tr>+ <th data-field="name" data-sortable="true">{{ trans('general.name') }}</th>+ <th data-field="user" data-sortable="true">{{ trans('general.user') }}</th>+ <th data-field="client" data-sortable="true">{{ trans('admin/settings/general.oauth_client') }}</th>+ <th data-field="status" data-sortable="true">{{ trans('general.status') }}</th>+ <th data-field="created_at" data-sortable="true">{{ trans('general.created_at') }}</th>+ <th data-field="expires_at" data-sortable="true">{{ trans('general.expires') }}</th>+ <th data-field="actions" data-sortable="false">+ <span class="sr-only">{{ trans('general.actions') }}</span>+ </th>+ </tr>+ </thead>+ <tbody>+ @foreach($personalAccessTokens as $token)+ <tr>+ <td>{{ $token->name ?: $token->id }}</td>+ <td>+ @if($token->existing_user_id)+ @php+ $profileLabel = $token->display_name ?: $token->username;+ $isSoftDeletedUser = $token->user_deleted_at !== null;+ @endphp+ <a href="{{ route('users.show', $token->token_user_id) }}">+ @if($isSoftDeletedUser)+ <del>{{ $profileLabel }}</del>+ @else+ {{ $profileLabel }}+ @endif+ </a>+ @else+ {{ trans('admin/settings/general.oauth_deleted_user', ['id' => $token->token_user_id]) }}+ @endif+ </td>+ <td>{{ $token->client_name }}</td>+ <td>+ @if((int) $token->revoked === 1)+ <span class="label label-danger">{{ trans('admin/settings/general.oauth_token_status_revoked') }}</span>+ @else+ <span class="label label-success">{{ trans('admin/settings/general.oauth_token_status_active') }}</span>+ @endif+ </td>+ <td>{{ $token->created_at ? \App\Helpers\Helper::getFormattedDateObject($token->created_at, 'datetime', false) : '' }}</td>+ <td>{{ $token->expires_at ? \App\Helpers\Helper::getFormattedDateObject($token->expires_at, 'datetime', false) : '' }}</td>+ <td class="text-right">+ @if((int) $token->revoked === 1)+ <form method="POST" action="{{ route('settings.oauth.tokens.unrevoke', ['token' => $token->id]) }}" style="display: inline;">+ @csrf+ <button type="submit" class="btn btn-sm btn-success">{{ trans('admin/settings/general.oauth_unrevoke') }}</button>+ </form>+ @else+ <form method="POST" action="{{ route('settings.oauth.tokens.revoke', ['token' => $token->id]) }}" style="display: inline;">+ @csrf+ <button type="submit" class="btn btn-sm btn-danger">{{ trans('admin/settings/general.oauth_revoke') }}</button>+ </form>+ @endif+ </td>+ </tr>+ @endforeach+ </tbody>+ </table>+ </div>+ @endif+ </x-tabs.pane>++ <x-tabs.pane name="oauth-clients">+ <div class="oauth-tab-content">+ <livewire:oauth-clients section="oauth-clients"/>+ </div>+ </x-tabs.pane>+ </x-slot:tabpanes>+ </x-tabs>+ </x-page-column>+ </x-container>@else<p class="text-warning"><i class="fas fa-lock" aria-hidden="true"></i> {{ trans('general.feature_disabled') }}</p>@endif@@ -23,4 +131,5 @@@stop@section('moar_scripts')+ @include ('partials.bootstrap-table', ['simple_view' => true])@endsection