discourse/app/assets/javascripts/admin/addon/templates/api-keys-show.hbs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

118 lines
3.9 KiB
Handlebars
Raw Normal View History

<LinkTo @route="adminApiKeys.index" class="go-back">
{{d-icon "arrow-left"}}
{{i18n "admin.api.all_api_keys"}}
</LinkTo>
<div class="api-key api-key-show">
<AdminFormRow @label="admin.api.key">
{{#if model.revoked_at}}{{d-icon "times-circle"}}{{/if}}
{{model.truncatedKey}}
</AdminFormRow>
<AdminFormRow @label="admin.api.description">
{{#if editingDescription}}
<Input @value={{buffered.description}} @maxlength="255" placeholder={{i18n "admin.api.description_placeholder"}} />
{{else}}
<span>
{{if model.description model.description (i18n "admin.api.no_description")}}
</span>
{{/if}}
<div class="controls">
{{#if editingDescription}}
<DButton @class="ok" @action={{action "saveDescription"}} @icon="check" />
<DButton @class="cancel" @action={{action "editDescription"}} @icon="times" />
{{else}}
<DButton @class="btn-default" @action={{action "editDescription"}} @icon="pencil-alt" />
{{/if}}
</div>
</AdminFormRow>
<AdminFormRow @label="admin.api.user">
{{#if model.user}}
<LinkTo @route="adminUser" @model={{model.user}}>
{{avatar model.user imageSize="small"}} {{model.user.username}}
</LinkTo>
{{else}}
{{i18n "admin.api.all_users"}}
{{/if}}
</AdminFormRow>
<AdminFormRow @label="admin.api.created">
{{format-date model.created_at leaveAgo="true"}}
</AdminFormRow>
<AdminFormRow @label="admin.api.updated">
{{format-date model.updated_at leaveAgo="true"}}
</AdminFormRow>
<AdminFormRow @label="admin.api.last_used">
{{#if model.last_used_at}}
{{format-date model.last_used_at leaveAgo="true"}}
{{else}}
{{i18n "admin.api.never_used"}}
{{/if}}
</AdminFormRow>
<AdminFormRow @label="admin.api.revoked">
{{#if model.revoked_at}}
{{format-date model.revoked_at leaveAgo="true"}}
{{else}}
<span>{{i18n "no_value"}}</span>
{{/if}}
<div class="controls">
{{#if model.revoked_at}}
<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" />
{{else}}
<DButton @class="btn-danger" @action={{action "revokeKey"}} @actionParam={{model}} @icon="times" @label="admin.api.revoke" />
{{/if}}
</div>
</AdminFormRow>
{{#if model.api_key_scopes.length}}
<h2 class="scopes-title">{{i18n "admin.api.scopes.title"}}</h2>
<table class="scopes-table grid">
<thead>
<tr>
<td>{{i18n "admin.api.scopes.resource"}}</td>
<td>{{i18n "admin.api.scopes.action"}}</td>
<td>{{i18n "admin.api.scopes.allowed_urls"}}</td>
<td>{{i18n "admin.api.scopes.allowed_parameters"}}</td>
</tr>
</thead>
<tbody>
{{#each model.api_key_scopes as |scope|}}
<tr>
<td>{{scope.resource}}</td>
<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>
<DButton @icon="link" @action={{action "showURLs" scope.urls}} @class="btn-info" />
</td>
<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}}
</div>