lemur/lemur/static/app/angular/api_keys/api_key/api_key.tpl.html

64 lines
3.2 KiB
HTML

<div class="modal-header" ng-show="!jwt">
<button type="button" class="close" ng-click="cancel()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h3>
<span ng-show="!apiKey.fromServer">Create Token</span>
<span ng-show="apiKey.fromServer">Edit Token</span>
</h3>
</div>
<div class="modal-header" ng-show="jwt">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h3><span>Token Pickup</span></h3>
</div>
<div class="modal-body" ng-show="!jwt">
<form name="createForm" class="form-horizontal" role="form" novalidate>
<div class="form-group"
ng-class="{'has-error': createForm.name.$invalid, 'has-success': !createForm.name.$invalid&&createForm.name.$dirty}">
<label class="control-label col-sm-2">
Name
</label>
<div class="col-sm-10">
<input name="name" ng-model="apiKey.name" placeholder="ExampleService" class="form-control" required/>
<p ng-show="createForm.label.$invalid && !createForm.label.$pristine" class="help-block">You must enter an api key name</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">
User
</label>
<div class="col-sm-10">
<input type="text" ng-model="apiKey.user" placeholder="My username..."
uib-typeahead="user.username for user in userService.findUserByName($viewValue)" typeahead-loading="loadingUsers"
class="form-control input-md" typeahead-on-select="apiKey.attachUser($item)"
uib-tooltip="This user will be tied to the generated key. All key permissions will mirror the users. Current user is the default."
uib-tooltip-trigger="focus" uib-tooltip-placement="top" typeahead-wait-ms="500">
<p ng-show="createForm.label.$invalid && !createForm.label.$pristine" class="help-block">You must enter an API Key User ID.</p>
</div>
</div>
<div class="form-group"
ng-class="{'has-error': createForm.ttl.$invalid, 'has-success': !createForm.ttl.$invalid&&createForm.ttl.$dirty}">
<label class="control-label col-sm-2">
TTL
</label>
<div class="col-sm-10">
<input name="ttl" ng-model="apiKey.ttl" placeholder="-1" class="form-control" type="number"
uib-tooltip="Number of days for the token to last. -1 meaning the token will not expire."
uib-tooltip-trigger="focus" uib-tooltip-placement="top" required/>
<p ng-show="createForm.label.$invalid && !createForm.label.$pristine" class="help-block">You must enter an API Key TTL.</p>
</div>
</div>
</form>
</div>
<div class="modal-body" ng-show="jwt">
<h4>Pass the following token on every Lemur API request:</h4>
<pre><code>{{ jwt }}</code></pre>
<h4>Example usage:</h4>
<pre><code>curl -i {{ origin }}/api/1/certificates -H "Authorization: Bearer {{ jwt }}"</code></pre>
</div>
<div class="modal-footer" ng-show="!jwt">
<button ng-click="save(apiKey)" type="submit" ng-disabled="createForm.$invalid" class="btn btn-primary">Save</button>
<button ng-click="cancel()" class="btn btn-danger">Cancel</button>
</div>
<div class="modal-footer" ng-show="jwt">
<button ng-click="close()" class="btn btn-primary">Close</button>
</div>