85 lines
3.7 KiB
PHP
85 lines
3.7 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('integrationhub::lang.odata_tokens'))
|
|
|
|
@section('content')
|
|
@include('integrationhub::layouts.nav')
|
|
|
|
<section class="content no-print mt-page">
|
|
<div class="mt-page-header">
|
|
<h1><i class="fas fa-key" style="color:#8b5cf6;margin-left:8px;"></i> @lang('integrationhub::lang.odata_tokens')</h1>
|
|
<a href="{{ action([\Modules\IntegrationHub\Http\Controllers\ODataController::class, 'createToken']) }}" class="mt-btn-primary btn">
|
|
<i class="fa fa-plus"></i> @lang('integrationhub::lang.add')
|
|
</a>
|
|
</div>
|
|
|
|
@if(session('plain_token'))
|
|
<div class="ih-token-box">
|
|
<strong>@lang('integrationhub::lang.plain_token'):</strong><br>
|
|
{{ session('plain_token') }}
|
|
<button type="button" class="btn btn-xs btn-default pull-left ih-copy-token" data-token="{{ session('plain_token') }}">
|
|
<i class="fa fa-copy"></i> @lang('integrationhub::lang.copy')
|
|
</button>
|
|
</div>
|
|
@endif
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-body">
|
|
<table class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('integrationhub::lang.name')</th>
|
|
<th>@lang('integrationhub::lang.scopes')</th>
|
|
<th>@lang('integrationhub::lang.expires_at')</th>
|
|
<th>@lang('integrationhub::lang.created_at')</th>
|
|
<th>@lang('integrationhub::lang.action')</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($tokens as $token)
|
|
<tr>
|
|
<td>{{ $token->name }}</td>
|
|
<td>
|
|
@foreach($token->scopes ?? [] as $scope)
|
|
<span class="label label-info">{{ $scope === '*' ? __('integrationhub::lang.all_datasets') : __('integrationhub::lang.'.$scope) }}</span>
|
|
@endforeach
|
|
</td>
|
|
<td>
|
|
@if($token->expires_at)
|
|
@format_datetime($token->expires_at)
|
|
@if($token->isExpired()) <span class="label label-danger">@lang('integrationhub::lang.expired')</span> @endif
|
|
@else
|
|
@lang('integrationhub::lang.never')
|
|
@endif
|
|
</td>
|
|
<td>@format_datetime($token->created_at)</td>
|
|
<td>
|
|
{!! Form::open(['url' => action([\Modules\IntegrationHub\Http\Controllers\ODataController::class, 'destroyToken'], $token->id), 'method' => 'delete', 'style' => 'display:inline']) !!}
|
|
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm(LANG.sure)"><i class="fa fa-trash"></i> @lang('integrationhub::lang.delete')</button>
|
|
{!! Form::close() !!}
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="text-center text-muted">@lang('integrationhub::lang.no_records')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
{{ $tokens->links() }}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script>
|
|
$(function() {
|
|
$(document).on('click', '.ih-copy-token', function() {
|
|
var token = $(this).data('token');
|
|
if (navigator.clipboard) {
|
|
navigator.clipboard.writeText(token).then(function() { toastr.success('@lang('integrationhub::lang.copied')'); });
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endsection
|