github.com/outbrain/consul@v1.4.5/ui-v2/app/templates/dc/acls/tokens/-policies.hbs (about) 1 <label data-test-new-policy class="type-dialog" for="new-policy-toggle"> 2 <span>Create new policy</span> 3 {{#modal-dialog data-test-policy-form onclose=(action 'sendClearPolicy') onopen=(action 'refreshCodeEditor' '#policy_rules') name="new-policy-toggle"}} 4 {{#block-slot 'header'}} 5 <h2>New Policy</h2> 6 {{/block-slot}} 7 {{#block-slot 'body'}} 8 {{#with policy as |item|}} 9 {{partial 'dc/acls/policies/fieldsets'}} 10 {{/with}} 11 {{/block-slot}} 12 {{#block-slot 'actions' as |close|}} 13 <button type="submit" {{action 'sendCreatePolicy' policy item.Policies close}} disabled={{if (or policy.isSaving policy.isPristine policy.isInvalid) 'disabled'}}> 14 {{#if policy.isSaving }} 15 <div class="progress indeterminate"></div> 16 {{/if}} 17 <span>Create and apply</span> 18 </button> 19 <button type="reset" disabled={{if policy.isSaving 'disabled'}} {{action close}}>Cancel</button> 20 {{/block-slot}} 21 {{/modal-dialog}} 22 </label> 23 <label class="type-text" data-test-policy-element> 24 <span>Apply an existing policy</span> 25 {{#power-select 26 options=(difference items item.Policies item.Policies.length) 27 searchField='Name' 28 selected=DestinationName 29 searchPlaceholder='Type policy name' 30 onchange=(action 'change' 'Policy') as |policy| 31 }} 32 {{policy.Name}} 33 {{/power-select}} 34 </label> 35 {{#if (gt item.Policies.length 0)}} 36 {{#with item as |token| }} 37 {{#tabular-details 38 data-test-policies 39 onchange=(action 'change') 40 name="Details" 41 items=(sort-by 'CreateTime:desc' 'Name:asc' item.Policies) as |item index| 42 }} 43 {{#block-slot 'header'}} 44 <th>Name</th> 45 <th>Datacenters</th> 46 {{/block-slot}} 47 {{#block-slot 'row'}} 48 <td> 49 <a href={{href-to 'dc.acls.policies.edit' item.ID}}>{{item.Name}}</a> 50 </td> 51 <td> 52 {{if (not item.isSaving) (join ', ' (policy/datacenters item)) 'Saving...'}} 53 </td> 54 {{/block-slot}} 55 {{#block-slot 'details'}} 56 <label class="type-text"> 57 <span>Rules <a href="{{env 'CONSUL_DOCUMENTATION_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a></span> 58 {{code-editor readonly=true value=item.Rules}} 59 </label> 60 <div> 61 {{#confirmation-dialog message='Are you sure you want to remove this policy from this token?'}} 62 {{#block-slot 'action' as |confirm|}} 63 <button data-test-delete type="button" class="type-delete" {{action confirm 'remove' item token.Policies}}>Remove</button> 64 {{/block-slot}} 65 {{#block-slot 'dialog' as |execute cancel message|}} 66 <p> 67 {{message}} 68 </p> 69 <button type="button" class="type-delete" {{action execute}}>Confirm remove</button> 70 <button type="button" class="type-cancel" {{action cancel}}>Cancel</button> 71 {{/block-slot}} 72 {{/confirmation-dialog}} 73 </div> 74 {{/block-slot}} 75 {{/tabular-details}} 76 {{/with}} 77 {{/if}}