FEATURE: Display created and last_used dates for API keys

This commit is contained in:
David Taylor 2019-10-09 14:24:14 +01:00
parent 10478cb395
commit 445a3851d6
3 changed files with 21 additions and 1 deletions

View File

@ -3,6 +3,8 @@
<thead>
<th>{{i18n "admin.api.key"}}</th>
<th>{{i18n "admin.api.user"}}</th>
<th>{{i18n "admin.api.created"}}</th>
<th>{{i18n "admin.api.last_used"}}</th>
<th>&nbsp;</th>
</thead>
<tbody>
@ -10,6 +12,7 @@
<tr>
<td class="key">{{k.key}}</td>
<td class="key-user">
<div class="label">{{i18n 'admin.api.user'}}</div>
{{#if k.user}}
{{#link-to "adminUser" k.user}}
{{avatar k.user imageSize="small"}}
@ -18,6 +21,18 @@
{{i18n "admin.api.all_users"}}
{{/if}}
</td>
<td class="key-created">
<div class="label">{{i18n 'admin.api.created'}}</div>
{{format-date k.created_at}}
</td>
<td class="key-last-used">
<div class="label">{{i18n 'admin.api.last_used'}}</div>
{{#if k.last_used_at}}
{{format-date k.last_used_at}}
{{else}}
{{i18n "admin.api.never_used"}}
{{/if}}
</td>
<td class="key-controls">
{{d-button
class="btn-default"

View File

@ -3,7 +3,9 @@
class ApiKeySerializer < ApplicationSerializer
attributes :id,
:key
:key,
:last_used_at,
:created_at
has_one :user, serializer: BasicUserSerializer, embed: :objects

View File

@ -3302,6 +3302,9 @@ en:
user: "User"
title: "API"
key: "API Key"
created: Created
last_used: Last Used
never_used: (never)
generate: "Generate"
regenerate: "Regenerate"
revoke: "Revoke"