open-nomad/ui/app/templates/policies/index.hbs
Phil Renaud dce8717866
[ui] Token management interface on policy pages (#15435)
* basic-functionality demo for token CRUD

* Styling for tokens crud

* Tokens crud styles

* Expires, not expiry

* Mobile styles etc

* Refresh and redirect rules for policy save and token creation

* Delete method and associated serializer change

* Ability-checking for tokens

* Update policies acceptance tests to reflect new redirect rules

* Token ability unit tests

* Mirage config methods for token crud

* Token CRUD acceptance tests

* A couple visual diff snapshots

* Add and Delete abilities referenced for token operations

* Changing timeouts and adding a copy to clipboard action

* replaced accessor with secret when copying to clipboard

* PR comments addressed

* Simplified error passing for policy editor
2022-12-15 13:11:28 -05:00

72 lines
2.2 KiB
Handlebars
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{page-title "Policies"}}
<section class="section">
<div class="toolbar">
<div class="toolbar-item is-right-aligned is-mobile-full-width">
<div class="button-bar">
{{#if (can "write policy")}}
<LinkTo
@route="policies.new"
class="button is-primary"
data-test-create-policy
>
Create Policy
</LinkTo>
{{else}}
<button
class="button is-primary is-disabled tooltip is-right-aligned"
aria-label="You dont have sufficient permissions"
disabled
type="button"
data-test-disabled-create-policy
>
Create Policy
</button>
{{/if}}
</div>
</div>
</div>
{{#if this.policies.length}}
<ListTable
@source={{this.policies}}
@class="policies no-mobile-condense" as |t|>
<t.head>
<th>Policy Name</th>
{{#if (can "list token")}}
<th>Tokens</th>
{{/if}}
</t.head>
<t.body as |row|>
<tr data-test-policy-row {{on "click" (action "openPolicy" row.model)}}
{{keyboard-shortcut
enumerated=true
action=(action "openPolicy" row.model)
}}>
<td data-test-policy-name>
<LinkTo @route="policies.policy" @model={{row.model.name}}>{{row.model.name}}</LinkTo>
</td>
{{#if (can "list token")}}
<td data-test-policy-token-count>
<span>
<span data-test-policy-total-tokens>{{row.model.tokens.length}}</span>
{{#if (filter-by "isExpired" row.model.tokens)}}
<span data-test-policy-expired-tokens class="number-expired">({{get (filter-by "isExpired" row.model.tokens) "length"}} expired)</span>
{{/if}}
</span>
</td>
{{/if}}
</tr>
</t.body>
</ListTable>
{{else}}
<div class="empty-message">
<h3 data-test-empty-policies-list-headline class="empty-message-headline">
No Policies
</h3>
<p class="empty-message-body">
Get started by <LinkTo @route="policies.new">creating a new policy</LinkTo>
</p>
</div>
{{/if}}
</section>