2019-12-17 18:47:37 +00:00
|
|
|
{{#child-selector repo=repo dc=dc nspace=nspace type="policy" placeholder="Search for policy" items=items}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{yield}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='label'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
Apply an existing policy
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='create'}}
|
|
|
|
{{#yield-slot name='trigger'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{yield}}
|
|
|
|
{{else}}
|
|
|
|
<label class="type-dialog" for="new-policy-toggle">
|
|
|
|
<span>Create new policy</span>
|
|
|
|
</label>
|
|
|
|
{{!TODO: potentially call trigger something else}}
|
|
|
|
{{!the modal has to go here so that if you provide a slot to trigger it doesn't get rendered}}
|
2019-06-04 14:57:35 +00:00
|
|
|
{{#modal-dialog data-test-policy-form onopen=(action 'open') name="new-policy-toggle"}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='header'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<h2>New Policy</h2>
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='body'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{policy-form form=form dc=dc}}
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='actions' as |close|}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<button type="submit" {{action 'save' item items (queue (action close) (action 'reset'))}} disabled={{if (or item.isSaving item.isPristine item.isInvalid) 'disabled'}}>
|
|
|
|
{{#if item.isSaving }}
|
|
|
|
<div class="progress indeterminate"></div>
|
|
|
|
{{/if}}
|
|
|
|
<span>Create and apply</span>
|
|
|
|
</button>
|
|
|
|
<button type="reset" disabled={{if item.isSaving 'disabled'}} {{action (queue (action close) (action 'reset'))}}>Cancel</button>
|
|
|
|
{{/block-slot}}
|
|
|
|
{{/modal-dialog}}
|
|
|
|
{{/yield-slot}}
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='option' as |option|}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{option.Name}}
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='set'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{#tabular-details
|
|
|
|
data-test-policies
|
|
|
|
onchange=(action 'loadItem')
|
|
|
|
items=(sort-by 'CreateTime:desc' 'Name:asc' items) as |item index|
|
|
|
|
}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='header'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<th>Name</th>
|
|
|
|
<th>Datacenters</th>
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='row'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<td class={{policy/typeof item}}>
|
|
|
|
{{#if item.ID }}
|
|
|
|
<a href={{href-to 'dc.acls.policies.edit' item.ID}}>{{item.Name}}</a>
|
|
|
|
{{else}}
|
|
|
|
<a name={{item.Name}}>{{item.Name}}</a>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{if (not item.isSaving) (join ', ' (policy/datacenters item)) 'Saving...'}}
|
|
|
|
</td>
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='details'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<label class="type-text">
|
2019-08-05 17:10:00 +00:00
|
|
|
<span>Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a></span>
|
2019-05-08 09:00:23 +00:00
|
|
|
{{#if (eq item.template '')}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{code-editor syntax='hcl' readonly=true value=item.Rules}}
|
|
|
|
{{else}}
|
|
|
|
{{#code-editor syntax='hcl' readonly=true}}
|
|
|
|
{{~component 'service-identity' name=item.Name~}}
|
|
|
|
{{/code-editor}}
|
|
|
|
{{/if}}
|
|
|
|
</label>
|
|
|
|
<div>
|
|
|
|
{{#confirmation-dialog message='Are you sure you want to remove this policy from this token?'}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='action' as |confirm|}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<button data-test-delete type="button" class="type-delete" {{action confirm 'remove' item items}}>Remove</button>
|
|
|
|
{{/block-slot}}
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#block-slot name='dialog' as |execute cancel message|}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<p>
|
|
|
|
{{message}}
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<button type="button" class="type-delete" {{action execute}}>Confirm remove</button>
|
|
|
|
<button type="button" class="type-cancel" {{action cancel}}>Cancel</button>
|
|
|
|
{{/block-slot}}
|
|
|
|
{{/confirmation-dialog}}
|
|
|
|
</div>
|
|
|
|
{{/block-slot}}
|
|
|
|
{{/tabular-details}}
|
|
|
|
|
|
|
|
{{/block-slot}}
|
|
|
|
{{/child-selector}}
|