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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.revoked_at}}{{d-icon "times-circle"}}{{/if}}
|
|
|
|
{{this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.editingDescription}}
|
2022-07-06 16:37:54 +08:00
|
|
|
<Input @value={{this.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>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{if this.model.description this.model.description (i18n "admin.api.no_description")}}
|
2020-02-11 22:55:16 +08:00
|
|
|
</span>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div class="controls">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.user}}
|
|
|
|
<LinkTo @route="adminUser" @model={{this.model.user}}>
|
|
|
|
{{avatar this.model.user imageSize="small"}} {{this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{format-date this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{format-date this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.last_used_at}}
|
|
|
|
{{format-date this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.revoked_at}}
|
|
|
|
{{format-date this.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">
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.model.revoked_at}}
|
|
|
|
<DButton @action={{action "undoRevokeKey"}} @actionParam={{this.model}} @icon="undo" @label="admin.api.undo_revoke" />
|
|
|
|
<DButton @action={{action "deleteKey"}} @actionParam={{this.model}} @icon="trash-alt" @label="admin.api.delete" @class="btn-danger" />
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2022-07-06 01:41:31 +08:00
|
|
|
<DButton @class="btn-danger" @action={{action "revokeKey"}} @actionParam={{this.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
|
|
|
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#if this.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>
|
2022-07-06 01:41:31 +08:00
|
|
|
{{#each this.model.api_key_scopes as |scope|}}
|
2020-07-17 02:51:24 +08:00
|
|
|
<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>
|