2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@class="btn-primary"
|
|
|
|
@action={{route-action "new"}}
|
|
|
|
@icon="plus"
|
|
|
|
@label="admin.api.new_key"
|
|
|
|
/>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<LoadMore @selector=".api-keys tr" @action={{action "loadMore"}}>
|
2021-11-09 18:18:23 +08:00
|
|
|
<table class="api-keys grid">
|
|
|
|
<thead>
|
|
|
|
<th>{{i18n "admin.api.key"}}</th>
|
|
|
|
<th>{{i18n "admin.api.description"}}</th>
|
|
|
|
<th>{{i18n "admin.api.user"}}</th>
|
|
|
|
<th>{{i18n "admin.api.created"}}</th>
|
|
|
|
<th>{{i18n "admin.api.last_used"}}</th>
|
|
|
|
<th> </th>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each this.model as |k|}}
|
2021-11-09 18:18:23 +08:00
|
|
|
<tr class={{if k.revoked_at "revoked"}}>
|
|
|
|
<td class="key">
|
|
|
|
{{#if k.revoked_at}}{{d-icon "times-circle"}}{{/if}}
|
|
|
|
{{k.truncatedKey}}
|
|
|
|
</td>
|
|
|
|
<td class="key-description">
|
|
|
|
{{k.shortDescription}}
|
|
|
|
</td>
|
|
|
|
<td class="key-user">
|
|
|
|
<div class="label">{{i18n "admin.api.user"}}</div>
|
|
|
|
{{#if k.user}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<LinkTo @route="adminUser" @model={{k.user}}>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{avatar k.user imageSize="small"}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{else}}
|
|
|
|
{{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">
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@action={{route-action "show" k}}
|
|
|
|
@icon="far-eye"
|
|
|
|
@title="admin.api.show_details"
|
|
|
|
/>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{#if k.revoked_at}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@action={{action "undoRevokeKey"}}
|
|
|
|
@actionParam={{k}}
|
|
|
|
@icon="undo"
|
|
|
|
@title="admin.api.undo_revoke"
|
|
|
|
/>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@class="btn-danger"
|
|
|
|
@action={{action "revokeKey"}}
|
|
|
|
@actionParam={{k}}
|
|
|
|
@icon="times"
|
|
|
|
@title="admin.api.revoke"
|
|
|
|
/>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/each}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2022-06-30 18:30:50 +08:00
|
|
|
</LoadMore>
|
2021-11-09 18:18:23 +08:00
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
<ConditionalLoadingSpinner @condition={{this.loading}} />
|
2016-09-19 16:43:06 +08:00
|
|
|
{{else}}
|
2019-01-24 00:40:05 +08:00
|
|
|
<p>{{i18n "admin.api.none"}}</p>
|
2020-03-27 02:49:38 +08:00
|
|
|
{{/if}}
|