2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@action={{route-action "new"}}
|
|
|
|
@icon="plus"
|
|
|
|
@label="admin.api.new_key"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-primary"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
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"}}>
|
2024-11-07 09:38:25 +08:00
|
|
|
<table class="d-admin-table api-keys">
|
2021-11-09 18:18:23 +08:00
|
|
|
<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>
|
2024-12-05 19:24:01 +08:00
|
|
|
<th>{{i18n "admin.site_settings.table_column_heading.status"}}</th>
|
2021-11-09 18:18:23 +08:00
|
|
|
<th> </th>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each this.model as |k|}}
|
2024-11-07 09:38:25 +08:00
|
|
|
<tr class="d-admin-row__content {{if k.revoked_at 'revoked'}}">
|
|
|
|
<td class="d-admin-row__overview key">
|
2021-11-09 18:18:23 +08:00
|
|
|
{{k.truncatedKey}}
|
|
|
|
</td>
|
2024-11-07 09:38:25 +08:00
|
|
|
<td class="d-admin-row__detail key-description">
|
|
|
|
<div class="d-admin-row__mobile-label">{{i18n
|
|
|
|
"admin.api.description"
|
|
|
|
}}</div>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{k.shortDescription}}
|
|
|
|
</td>
|
2024-11-07 09:38:25 +08:00
|
|
|
<td class="d-admin-row__detail key-user">
|
|
|
|
<div class="d-admin-row__mobile-label">{{i18n
|
|
|
|
"admin.api.user"
|
|
|
|
}}</div>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{#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>
|
2024-11-07 09:38:25 +08:00
|
|
|
<td class="d-admin-row__detail key-created">
|
|
|
|
<div class="d-admin-row__mobile-label">{{i18n
|
|
|
|
"admin.api.created"
|
|
|
|
}}</div>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{format-date k.created_at}}
|
|
|
|
</td>
|
2024-11-07 09:38:25 +08:00
|
|
|
<td class="d-admin-row__detail key-last-used">
|
|
|
|
<div class="d-admin-row__mobile-label">{{i18n
|
|
|
|
"admin.api.last_used"
|
|
|
|
}}</div>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{#if k.last_used_at}}
|
|
|
|
{{format-date k.last_used_at}}
|
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.never_used"}}
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
2024-12-05 19:24:01 +08:00
|
|
|
<td class="d-admin-row__detail">
|
|
|
|
<div class="d-admin-row__mobile-label">{{i18n
|
|
|
|
"admin.site_settings.table_column_heading.status"
|
|
|
|
}}</div>
|
|
|
|
{{#if k.revoked_at}}
|
|
|
|
<div role="status" class="status-label">
|
|
|
|
<div class="status-label-indicator">
|
|
|
|
</div>
|
|
|
|
<div class="status-label-text">
|
|
|
|
{{i18n "admin.api.revoked"}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
2024-11-07 09:38:25 +08:00
|
|
|
<td class="d-admin-row__controls 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
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.undoRevokeKey k}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="arrow-rotate-left"
|
2022-06-30 18:30:50 +08:00
|
|
|
@title="admin.api.undo_revoke"
|
|
|
|
/>
|
2021-11-09 18:18:23 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.revokeKey k}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="xmark"
|
2022-06-30 18:30:50 +08:00
|
|
|
@title="admin.api.revoke"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-danger"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
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}}
|