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">
|
2024-09-13 23:50:52 +08:00
|
|
|
{{#if this.model.revoked_at}}{{d-icon "circle-xmark"}}{{/if}}
|
2022-07-06 01:41:31 +08:00
|
|
|
{{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}}
|
2023-08-31 17:49:35 +08:00
|
|
|
<DButton @action={{this.saveDescription}} @icon="check" class="ok" />
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{this.editDescription}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="xmark"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="cancel"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{this.editDescription}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="pencil"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-default"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
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
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.undoRevokeKey this.model}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="arrow-rotate-left"
|
2022-07-06 01:41:31 +08:00
|
|
|
@label="admin.api.undo_revoke"
|
|
|
|
/>
|
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.deleteKey this.model}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="trash-can"
|
2022-07-06 01:41:31 +08:00
|
|
|
@label="admin.api.delete"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-danger"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
2019-11-05 22:10:23 +08:00
|
|
|
{{else}}
|
2022-07-06 01:41:31 +08:00
|
|
|
<DButton
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.revokeKey this.model}}
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="xmark"
|
2022-07-06 01:41:31 +08:00
|
|
|
@label="admin.api.revoke"
|
2023-08-31 17:49:35 +08:00
|
|
|
class="btn-danger"
|
2022-07-06 01:41:31 +08:00
|
|
|
/>
|
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}}
|
2023-10-24 03:09:02 +08:00
|
|
|
<DTooltip
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="circle-question"
|
2023-10-24 03:09:02 +08:00
|
|
|
@content={{i18n
|
2020-08-19 02:12:04 +08:00
|
|
|
(concat
|
|
|
|
"admin.api.scopes.descriptions."
|
|
|
|
scope.resource
|
|
|
|
"."
|
|
|
|
scope.key
|
2022-12-28 20:28:11 +08:00
|
|
|
)
|
2020-08-19 02:12:04 +08:00
|
|
|
}}
|
2023-10-24 03:09:02 +08:00
|
|
|
class="scope-tooltip"
|
|
|
|
/>
|
2020-08-19 02:12:04 +08:00
|
|
|
</td>
|
|
|
|
<td>
|
2022-06-30 18:30:50 +08:00
|
|
|
<DButton
|
|
|
|
@icon="link"
|
2023-08-31 17:49:35 +08:00
|
|
|
@action={{fn this.showURLs scope.urls}}
|
|
|
|
class="btn-info"
|
2022-06-30 18:30:50 +08:00
|
|
|
/>
|
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>
|