Fixed bug on grants pagination

when user starts to paginate, application
type field disapperead and was populated with
created_at field instead.

Change-Id: I59bc728dd7e4161d1ef2f60821f038df2c161fc6
This commit is contained in:
Sebastian Marcet 2017-08-22 13:13:10 -03:00
parent 7aea9b139a
commit 34ffcd1d5a
4 changed files with 18 additions and 43 deletions

View File

@ -1,33 +0,0 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}

View File

@ -669,6 +669,7 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
foreach ($paginator->items() as $token) {
$res[] = [
'app_type' => $token->client()->first()->getFriendlyApplicationType(),
'value' => $token->value,
'scope' => $token->scope,
'lifetime' => $token->getRemainingLifetime(),
@ -706,6 +707,7 @@ final class ClientApiController extends AbstractRESTController implements ICRUDC
foreach ($paginator->items() as $token) {
$res[] = [
'app_type' => $token->client()->first()->getFriendlyApplicationType(),
'value' => $token->value,
'scope' => $token->scope,
'lifetime' => $token->getRemainingLifetime(),

View File

@ -20,14 +20,15 @@ function updateAccessTokenList(page, page_size){
else{
$('#info-access-tokens').hide();
$('#table-access-tokens').show();
var template = $('<tbody><tr><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Access Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-access-token" data-hint="access-token">Revoke</a></td></tr></tbody>');
var template = $('<tbody><tr><td class="app_type"></td><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Access Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-access-token" data-hint="access-token">Revoke</a></td></tr></tbody>');
var directives = {
'tr':{
'token<-context':{
'@id' :'token.value',
'td.issued' :'token.issued',
'td.scope' :'token.scope',
'td.lifetime':'token.lifetime',
'@id' :'token.value',
'td.app_type' :'token.app_type',
'td.issued' :'token.issued',
'td.scope' :'token.scope',
'td.lifetime' :'token.lifetime',
'a@href':function(arg){
var token_value = arg.item.value;
var href = TokensUrls.AccessTokenUrls.delete;
@ -71,14 +72,15 @@ function updateRefreshTokenList(page, page_size){
else{
$('#info-refresh-tokens').hide();
$('#table-refresh-tokens').show();
var template = $('<tbody><tr><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Refresh Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-refresh-token" data-hint="refresh-token">Revoke</a></td></tr></tbody>');
var template = $('<tbody><tr><td class="app_type"></td><td class="issued"></td><td class="scope"></td><td class="lifetime"></td><td><a title="Revoke Refresh Token" class="btn btn-default btn-md active btn-delete revoke-token revoke-refresh-token" data-hint="refresh-token">Revoke</a></td></tr></tbody>');
var directives = {
'tr':{
'token<-context':{
'@id' :'token.value',
'td.issued' :'token.issued',
'td.scope' :'token.scope',
'td.lifetime':function(arg){
'@id' :'token.value',
'td.app_type' :'token.app_type',
'td.issued' :'token.issued',
'td.scope' :'token.scope',
'td.lifetime' : function(arg){
var token_lifetime = arg.item.lifetime;
return token_lifetime===0?'Not Expire':token_lifetime;
},

View File

@ -21,6 +21,7 @@
<thead>
<tr>
<th>Application Type</th>
<th>Issued</th>
<th>Application Name</th>
<th>Granted Scopes</th>
<th>&nbsp;</th>
@ -30,6 +31,7 @@
@foreach($access_tokens as $access_token)
<tr id="{!!$access_token->value!!}">
<td>{!!$access_token->client()->first()->getFriendlyApplicationType()!!}</td>
<td>{!!$access_token->created_at!!}</td>
<td>{!!$access_token->client()->first()->app_name!!}</td>
<td>{!!$access_token->scope!!}</td>
<td>{!! HTML::link(URL::action("Api\\UserApiController@revokeToken",array("id"=>$user_id,"value"=>$access_token->value, "hint"=>'access-token')),'Revoke Access',array('data-value' => $access_token->value,'data-hint'=>'access-token','class'=>'btn btn-default btn-md active btn-delete revoke-token','title'=>'Revoke Access Token')) !!}</td>
@ -64,6 +66,7 @@
<thead>
<tr>
<th>Application Type</th>
<th>Issued</th>
<th>Application Name</th>
<th>Granted Scopes</th>
<th>&nbsp;</th>
@ -73,6 +76,7 @@
@foreach($refresh_tokens as $refresh_token)
<tr id="{!!$refresh_token->value!!}">
<td>{!!$refresh_token->client()->first()->getFriendlyApplicationType()!!}</td>
<td>{!!$refresh_token->created_at!!}</td>
<td>{!!$refresh_token->client()->first()->app_name!!}</td>
<td>{!!$refresh_token->scope!!}</td>
<td>{!! HTML::link(URL::action("Api\\UserApiController@revokeToken",array("id" => $user_id,"value" => $refresh_token->value, "hint" => 'refresh-token')),'Revoke Access',array('data-value' => $refresh_token->value,'data-hint' => 'refresh_token','class' => 'btn btn-default btn-md active btn-delete revoke-token','title' => 'Revoke Access Token')) !!}</td>