List all tokens in profile

This commit is contained in:
Johannes Zellner
2020-02-07 17:03:14 +01:00
parent 3efe7eb85d
commit 8ae6bf832a
2 changed files with 68 additions and 47 deletions

View File

@@ -366,17 +366,40 @@
</div>
</div>
<div class="text-left" ng-show="user.admin">
<h3>Sessions and API Tokens</h3>
<div class="text-left">
<h3>Login and API Tokens <button class="btn btn-primary btn-sm pull-right" ng-click="tokens.add.show()" ng-show="user.admin"><i class="fa fa-plus"></i> New API Token</button></h3>
</div>
<div class="card" ng-show="user.admin">
<div class="card">
<div class="grid-item-top">
<div class="row">
<div class="col-xs-12">
<p>You have {{ webadminClient.activeTokens.length }} active web session(s) and {{ cliClient.activeTokens.length }} CLI token(s).</p>
<p>You have {{ tokens.webadminTokens.length }} active web token(s), {{ tokens.cliTokens.length }} active CLI token(s) and {{ tokens.apiTokens.length }} API token(s).</p>
<button class="btn btn-outline btn-danger pull-right" ng-click="revokeTokens()">Logout From All</button>
<table class="table table-hover" style="margin: 0;">
<thead>
<tr>
<th style="width: 45%">Name</th>
<th style="width: 49.5%">Type</th>
<th style="width: 5%" class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="token in tokens.allTokens">
<td class="hand elide-table-cell" style="text-overflow: ellipsis; white-space: nowrap;">
{{ token.name || 'unnamed' }}
</td>
<td class="hand elide-table-cell" style="text-overflow: ellipsis; white-space: nowrap;">
{{ token.clientId }}
</td>
<td class="text-right no-wrap" style="vertical-align: bottom">
<button class="btn btn-xs btn-danger" ng-click="tokens.revoke(token)" uib-tooltip="Revoke Token"><i class="far fa-trash-alt"></i></button>
</td>
</tr>
</tbody>
</table>
<button class="btn btn-outline btn-danger pull-right" ng-click="tokens.revokeAll()">Logout From All</button>
</div>
</div>
</div>