Fix weird layout in admin oauth [sc-25673]

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-17 15:44:07 +01:00
parent afc78524fc
commit 27063d5bae
3 changed files with 106 additions and 73 deletions

View file

@ -287,8 +287,18 @@ return [
'zerofill_count' => 'Length of asset tags, including zerofill', 'zerofill_count' => 'Length of asset tags, including zerofill',
'username_format_help' => 'This setting will only be used by the import process if a username is not provided and we have to generate a username for you.', 'username_format_help' => 'This setting will only be used by the import process if a username is not provided and we have to generate a username for you.',
'oauth_title' => 'OAuth API Settings', 'oauth_title' => 'OAuth API Settings',
'oauth_clients' => 'OAuth Clients',
'oauth' => 'OAuth', 'oauth' => 'OAuth',
'oauth_help' => 'Oauth Endpoint Settings', 'oauth_help' => 'Oauth Endpoint Settings',
'oauth_no_clients' => 'You have not created any OAuth clients yet.',
'oauth_secret' => 'Secret',
'oauth_authorized_apps' => 'Authorized Applications',
'oauth_redirect_url' => 'Redirect URL',
'oauth_name_help' => ' Something your users will recognize and trust.',
'oauth_scopes' => 'Scopes',
'oauth_callback_url' => 'Your application authorization callback URL.',
'create_client' => 'Create Client',
'no_scopes' => 'No scopes',
'asset_tag_title' => 'Update Asset Tag Settings', 'asset_tag_title' => 'Update Asset Tag Settings',
'barcode_title' => 'Update Barcode Settings', 'barcode_title' => 'Update Barcode Settings',
'barcodes' => 'Barcodes', 'barcodes' => 'Barcodes',

View file

@ -1,79 +1,84 @@
<div> <div>
<div class="panel panel-default"> <div class="box box-default">
<div class="panel-heading">
<div style="display: flex; justify-content: space-between; align-items: center;"> <div class="box-header">
<h2> <h2 class="box-title">
OAuth Clients {{ trans('admin/settings/general.oauth_clients') }}
</h2> </h2>
@if($authorizationError) @if ($authorizationError)
<div class="alert alert-danger"> <div class="alert alert-danger">
<p><strong>Whoops!</strong> Something went wrong!</p> <p>{{ trans('admin/users/message.insufficient_permissions') }}
<br> <br>
{{ $authorizationError }} {{ $authorizationError }}
</p>
</div> </div>
@endif @endif
<a class="button button-small" <div class="box-tools pull-right">
wire:click="$emit('openModal')" <a class="btn btn-primary"
onclick="$('#modal-create-client').modal('show');" wire:click="$emit('openModal')"
> onclick="$('#modal-create-client').modal('show');">
Create New Client {{ trans('general.create') }}
</a> </a>
</div>
</div> </div>
</div>
<div class="panel-body"> <div class="box-body">
<!-- Current Clients --> <!-- Current Clients -->
@if($clients->count() === 0) @if($clients->count() === 0)
<p class="m-b-none"> <p>
You have not created any OAuth clients. {{ trans('admin/settings/general.oauth_no_clients') }}
</p> </p>
@endif @endif
@if($clients->count() > 0) @if ($clients->count() > 0)
<table class="table table-borderless m-b-none"> <table class="table table-striped snipe-table">
<thead> <thead>
<tr> <tr>
<th>Client ID</th> <th>{{ trans('general.id') }}</th>
<th>Name</th> <th>{{ trans('general.name') }}</th>
<th>Secret</th> <th>{{ trans('admin/settings/general.oauth_redirect_url') }}</th>
<th><span class="sr-only">Edit</span></th> <th>{{ trans('admin/settings/general.oauth_secret') }}</th>
<th><span class="sr-only">Delete</span></th> <th><span class="sr-only">{{ trans('general.actions') }}</span></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach($clients as $client) @foreach($clients as $client)
<tr> <tr>
<!-- ID --> <!-- ID -->
<td style="vertical-align: middle;"> <td>
{{ $client->id }} {{ $client->id }}
</td> </td>
<!-- Name --> <!-- Name -->
<td style="vertical-align: middle;"> <td>
{{ $client->name }} {{ $client->name }}
</td> </td>
<!-- Redirect -->
<td>
{{ $client->redirect }}
</td>
<!-- Secret --> <!-- Secret -->
<td style="vertical-align: middle;"> <td>
<code>{{ $client->secret }}</code> <code>{{ $client->secret }}</code>
</td> </td>
<!-- Edit Button --> <!-- Edit / Delete Button -->
<td style="vertical-align: middle;"> <td class="text-right">
<a class="action-link btn"
wire:click="editClient('{{ $client->id }}')" <a class="action-link btn btn-sm btn-warning"
onclick="$('#modal-edit-client').modal('show');" wire:click="editClient('{{ $client->id }}')"
> onclick="$('#modal-edit-client').modal('show');">
Edit <i class="fas fa-pencil-alt" aria-hidden="true"></i><span class="sr-only">{{ trans('general.update') }}</span>
</a> </a>
</td>
<!-- Delete Button -->
<td style="vertical-align: middle;" class="text-right">
<a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')"> <a class="action-link btn btn-danger btn-sm" wire:click="deleteClient('{{ $client->id }}')">
<i class="fas fa-trash"></i> <i class="fas fa-trash" aria-hidden="true"></i>
<span class="sr-only">
{{ trans('general.delete') }}
</span>
</a> </a>
</td> </td>
</tr> </tr>
@ -82,20 +87,28 @@
</table> </table>
@endif @endif
</div> </div>
</div>
<div> <div>
@if ($authorized_tokens->count() > 0) @if ($authorized_tokens->count() > 0)
<div> <div>
<div class="panel panel-default"> <div class="box box-default">
<h2 class="panel-heading">Authorized Applications</h2> <div class="box-header">
<h2>
{{ trans('admin/settings/general.oauth_authorized_apps') }}
</h2>
</div>
<div class="panel-body"> <div class="box-body">
<!-- Authorized Tokens --> <!-- Authorized Tokens -->
<table class="table table-borderless m-b-none"> <table class="table table-striped snipe-table">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>{{ trans('general.name') }}</th>
<th>Scopes</th> <th>{{ trans('admin/settings/general.oauth_scopes') }}</th>
<th><span class="sr-only">Delete</span></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -103,23 +116,28 @@
@foreach($authorized_tokens as $token) @foreach($authorized_tokens as $token)
<tr> <tr>
<!-- Client Name --> <!-- Client Name -->
<td style="vertical-align: middle;"> <td>
{{ $token->client->name }} {{ $token->client->name }}
</td> </td>
<!-- Scopes --> <!-- Scopes -->
<td style="vertical-align: middle;"> <td>
@if(!$token->scopes) @if(!$token->scopes)
<span class="label label-default">No Scopes</span> <span class="label label-default">
{{ trans('admin/settings/general.no_scopes') }}
</span>
@endif @endif
</td> </td>
<!-- Revoke Button --> <!-- Revoke Button -->
<td style="vertical-align: middle;"> <td>
<a class="btn btn-sm btn-danger" <a class="btn btn-sm btn-danger pull-right"
wire:click="deleteToken('{{ $token->id }}')" wire:click="deleteToken('{{ $token->id }}')"
> >
<i class="fas fa-trash"></i> <i class="fas fa-trash" aria-hidden="true"></i>
<span class="sr-only">
{{ trans('general.delete') }}
</span>
</a> </a>
</td> </td>
</tr> </tr>
@ -130,8 +148,10 @@
</div> </div>
</div> </div>
@endif @endif
</div>
</div>
<!-- Create Client Modal --> <!-- Create Client Modal -->
<div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog" wire:ignore.self> <div class="modal fade" id="modal-create-client" tabindex="-1" role="dialog" wire:ignore.self>
@ -141,7 +161,7 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2 class="modal-title"> <h2 class="modal-title">
Create Client {{ trans('admin/settings/general.create_client') }}
</h2> </h2>
</div> </div>
@ -166,7 +186,9 @@
<form class="form-horizontal" role="form"> <form class="form-horizontal" role="form">
<!-- Name --> <!-- Name -->
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label" for="create-client-name">Name</label> <label class="col-md-3 control-label" for="create-client-name">
{{ trans('general.name') }}
</label>
<div class="col-md-7"> <div class="col-md-7">
<input id="create-client-name" <input id="create-client-name"
@ -175,18 +197,17 @@
class="form-control" class="form-control"
wire:model="name" wire:model="name"
wire:keydown.enter="createClient" wire:keydown.enter="createClient"
autofocus autofocus>
>
<span class="help-block"> <span class="help-block">
Something your users will recognize and trust. {{ trans('admin/settings/general.oauth_name_help') }}
</span> </span>
</div> </div>
</div> </div>
<!-- Redirect URL --> <!-- Redirect URL -->
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label" for="redirect">Redirect URL</label> <label class="col-md-3 control-label" for="redirect">{{ trans('admin/settings/general.oauth_redirect_url') }}</label>
<div class="col-md-7"> <div class="col-md-7">
<input type="text" <input type="text"
@ -198,7 +219,7 @@
> >
<span class="help-block"> <span class="help-block">
Your application's authorization callback URL. {{ trans('admin/settings/general.oauth_callback_url') }}
</span> </span>
</div> </div>
</div> </div>
@ -218,6 +239,8 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Edit Client Modal --> <!-- Edit Client Modal -->
<div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog" wire:ignore.self> <div class="modal fade" id="modal-edit-client" tabindex="-1" role="dialog" wire:ignore.self>
@ -225,9 +248,8 @@
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"> <h4 class="modal-title">
Edit Client {{ trans('general.update') }}
</h4> </h4>
</div> </div>
@ -268,14 +290,14 @@
> >
<span class="help-block"> <span class="help-block">
Something your users will recognize and trust. {{ trans('admin/settings/general.oauth_name_help') }}
</span> </span>
</div> </div>
</div> </div>
<!-- Redirect URL --> <!-- Redirect URL -->
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label" for="redirect">Redirect URL</label> <label class="col-md-3 control-label" for="redirect">{{ trans('admin/settings/general.oauth_redirect_url') }}</label>
<div class="col-md-7"> <div class="col-md-7">
<input <input
@ -288,7 +310,7 @@
> >
<span class="help-block"> <span class="help-block">
Your application's authorization callback URL. {{ trans('admin/settings/general.oauth_callback_url') }}
</span> </span>
</div> </div>
</div> </div>
@ -330,4 +352,5 @@
</script> </script>
</div> </div>

View file

@ -35,7 +35,7 @@
</td> </td>
<td class="col-md-1"><i class="fas fa-barcode" aria-hidden="true"></i></td> <td class="col-md-1"><i class="fas fa-barcode" aria-hidden="true"></i></td>
<td class="col-md-10">Name</td> <td class="col-md-10">{{ trans('general.name') }}</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>