2022-06-30 18:30:50 +08:00
|
|
|
<LinkTo @route="adminApiKeys.index" class="go-back">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{d-icon "arrow-left"}}
|
|
|
|
{{i18n "admin.api.all_api_keys"}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2020-09-11 21:38:28 +08:00
|
|
|
<div class="api-key api-key-show">
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.key">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{#if model.revoked_at}}{{d-icon "times-circle"}}{{/if}}
|
2019-12-12 19:45:00 +08:00
|
|
|
{{model.truncatedKey}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.description">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{#if editingDescription}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<Input @value={{buffered.description}} @maxlength="255" placeholder={{i18n "admin.api.description_placeholder"}} />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2020-02-11 22:55:16 +08:00
|
|
|
<span>
|
|
|
|
{{if model.description model.description (i18n "admin.api.no_description")}}
|
|
|
|
</span>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div class="controls">
|
|
|
|
{{#if editingDescription}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton @class="ok" @action={{action "saveDescription"}} @icon="check" />
|
|
|
|
<DButton @class="cancel" @action={{action "editDescription"}} @icon="times" />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton @class="btn-default" @action={{action "editDescription"}} @icon="pencil-alt" />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
</div>
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.user">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{#if model.user}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<LinkTo @route="adminUser" @model={{model.user}}>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{avatar model.user imageSize="small"}} {{model.user.username}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</LinkTo>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.all_users"}}
|
|
|
|
{{/if}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.created">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{format-date model.created_at leaveAgo="true"}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.updated">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{format-date model.updated_at leaveAgo="true"}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.last_used">
|
2019-11-08 07:41:43 +08:00
|
|
|
{{#if model.last_used_at}}
|
|
|
|
{{format-date model.last_used_at leaveAgo="true"}}
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.never_used"}}
|
|
|
|
{{/if}}
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2019-11-05 22:10:23 +08:00
|
|
|
|
2022-06-30 18:30:50 +08:00
|
|
|
<AdminFormRow @label="admin.api.revoked">
|
2019-11-05 22:10:23 +08:00
|
|
|
{{#if model.revoked_at}}
|
|
|
|
{{format-date model.revoked_at leaveAgo="true"}}
|
2020-09-11 21:38:28 +08:00
|
|
|
{{else}}
|
|
|
|
<span>{{i18n "no_value"}}</span>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
<div class="controls">
|
|
|
|
{{#if model.revoked_at}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton @action={{action "undoRevokeKey"}} @actionParam={{model}} @icon="undo" @label="admin.api.undo_revoke" />
|
|
|
|
<DButton @action={{action "deleteKey"}} @actionParam={{model}} @icon="trash-alt" @label="admin.api.delete" @class="btn-danger" />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton @class="btn-danger" @action={{action "revokeKey"}} @actionParam={{model}} @icon="times" @label="admin.api.revoke" />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
</div>
|
2022-06-30 18:30:50 +08:00
|
|
|
</AdminFormRow>
|
2020-07-17 02:51:24 +08:00
|
|
|
|
|
|
|
{{#if model.api_key_scopes.length}}
|
2021-11-10 23:48:00 +08:00
|
|
|
<h2 class="scopes-title">{{i18n "admin.api.scopes.title"}}</h2>
|
2020-07-17 02:51:24 +08:00
|
|
|
|
2020-09-11 21:38:28 +08:00
|
|
|
<table class="scopes-table grid">
|
2020-07-17 02:51:24 +08:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td>{{i18n "admin.api.scopes.resource"}}</td>
|
|
|
|
<td>{{i18n "admin.api.scopes.action"}}</td>
|
2020-08-19 02:12:04 +08:00
|
|
|
<td>{{i18n "admin.api.scopes.allowed_urls"}}</td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td>{{i18n "admin.api.scopes.allowed_parameters"}}</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{{#each model.api_key_scopes as |scope|}}
|
|
|
|
<tr>
|
|
|
|
<td>{{scope.resource}}</td>
|
2020-08-19 02:12:04 +08:00
|
|
|
<td>
|
|
|
|
{{scope.action}}
|
|
|
|
<span
|
|
|
|
class="scope-tooltip"
|
|
|
|
data-tooltip={{i18n (concat "admin.api.scopes.descriptions." scope.resource "." scope.key)}}>
|
|
|
|
{{d-icon "question-circle"}}
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td>
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton @icon="link" @action={{action "showURLs" scope.urls}} @class="btn-info" />
|
2020-08-19 02:12:04 +08:00
|
|
|
</td>
|
2020-07-17 02:51:24 +08:00
|
|
|
<td>
|
|
|
|
{{#each scope.parameters as |p|}}
|
|
|
|
<div>
|
|
|
|
<b>{{p}}:</b>
|
|
|
|
{{#if (get scope.allowed_parameters p)}}
|
|
|
|
{{get scope.allowed_parameters p}}
|
|
|
|
{{else}}
|
|
|
|
{{i18n "admin.api.scopes.any_parameter"}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/each}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{/each}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{{/if}}
|
2020-01-07 01:35:00 +08:00
|
|
|
</div>
|