mirror of https://github.com/hashicorp/consul
50 lines
2.3 KiB
Handlebars
50 lines
2.3 KiB
Handlebars
<form>
|
|
{{#policy-form form=form item=item}}
|
|
{{!don't show template selection here, i.e. Service Identity}}
|
|
{{block-slot name='template'}}
|
|
{{/policy-form}}
|
|
{{#if (not create) }}
|
|
{{token-list caption="Applied to the following tokens:" items=items}}
|
|
{{/if}}
|
|
<div>
|
|
{{#if create }}
|
|
{{! we only need to check for an empty name here as ember munges autofocus, once we have autofocus back revisit this}}
|
|
<button type="submit" {{ action "create" item}} disabled={{if (or item.isPristine item.isInvalid (eq item.Name '')) 'disabled'}}>Save</button>
|
|
{{ else }}
|
|
<button type="submit" {{ action "update" item}} disabled={{if item.isInvalid 'disabled'}}>Save</button>
|
|
{{/if}}
|
|
<button type="reset" {{ action "cancel" item}}>Cancel</button>
|
|
{{# if (not create) }}
|
|
{{#confirmation-dialog message='Are you sure you want to delete this Policy?'}}
|
|
{{#block-slot name='action' as |confirm|}}
|
|
<button type="button" data-test-delete class="type-delete" {{action confirm 'delete' item}}>Delete</button>
|
|
{{/block-slot}}
|
|
{{#block-slot name='dialog' as |execute cancel message|}}
|
|
{{#if (gt items.length 0)}}
|
|
{{#modal-dialog data-test-delete-modal onclose=(action cancel)}}
|
|
{{#block-slot name='header'}}
|
|
<h2>Policy in Use</h2>
|
|
{{/block-slot}}
|
|
{{#block-slot name='body'}}
|
|
<p>
|
|
This Policy is currently in use. If you choose to delete this Policy, it will be removed from the following <strong>{{items.length}} Tokens</strong>:
|
|
</p>
|
|
{{token-list items=items target='_blank'}}
|
|
<p>
|
|
This action cannot be undone. {{message}}
|
|
</p>
|
|
{{/block-slot}}
|
|
{{#block-slot name='actions' as |close|}}
|
|
<button type="button" class="type-delete" {{action execute}}>Yes, Delete</button>
|
|
<button type="button" class="type-cancel" {{action close}}>Cancel</button>
|
|
{{/block-slot}}
|
|
{{/modal-dialog}}
|
|
{{else}}
|
|
{{delete-confirmation message=message execute=execute cancel=cancel}}
|
|
{{/if}}
|
|
{{/block-slot}}
|
|
{{/confirmation-dialog}}
|
|
{{/if}}
|
|
</div>
|
|
</form>
|