2021-03-11 09:29:11 +00:00
|
|
|
<ChildSelector
|
|
|
|
@disabled={{disabled}}
|
|
|
|
@repo={{repo}}
|
|
|
|
@dc={{dc}}
|
2021-09-15 18:50:11 +00:00
|
|
|
@partition={{partition}}
|
2021-03-11 09:29:11 +00:00
|
|
|
@nspace={{nspace}}
|
|
|
|
@type="policy"
|
|
|
|
@placeholder="Search for policy"
|
|
|
|
@items={{items}}
|
|
|
|
...attributes
|
|
|
|
>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{yield}}
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="label">
|
2019-05-01 18:09:29 +00:00
|
|
|
Apply an existing policy
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="create">
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#yield-slot name='trigger'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{yield}}
|
|
|
|
{{else}}
|
2021-03-09 09:30:01 +00:00
|
|
|
<label
|
|
|
|
class="type-dialog"
|
|
|
|
data-test-policy-create
|
|
|
|
{{on "click" (optional this.modal.open)}}
|
|
|
|
>
|
2019-05-01 18:09:29 +00:00
|
|
|
<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}}
|
2020-03-06 14:10:34 +00:00
|
|
|
<ModalDialog
|
|
|
|
data-test-policy-form
|
2021-04-06 12:40:40 +00:00
|
|
|
id="new-policy"
|
2020-03-06 14:10:34 +00:00
|
|
|
@onopen={{action "open"}}
|
2021-04-06 12:40:40 +00:00
|
|
|
@aria={{hash
|
|
|
|
label='New Policy'
|
|
|
|
}}
|
2021-03-09 09:30:01 +00:00
|
|
|
as |modal|>
|
|
|
|
<Ref @target={{this}} @name="modal" @value={{modal}} />
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="header">
|
2019-05-01 18:09:29 +00:00
|
|
|
<h2>New Policy</h2>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="body">
|
2021-09-15 18:50:11 +00:00
|
|
|
<PolicyForm
|
|
|
|
@form={{form}}
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@partition={{partition}}
|
|
|
|
@dc={{dc}}
|
|
|
|
@allowServiceIdentity={{allowServiceIdentity}}
|
|
|
|
/>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="actions" as |close|>
|
2020-11-09 09:25:35 +00:00
|
|
|
<button type="submit"
|
|
|
|
onclick={{perform this.save item items (queue (action close) (action 'reset'))}}
|
|
|
|
disabled={{if (or item.isSaving item.isPristine item.isInvalid) 'disabled'}}
|
|
|
|
>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{#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>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
2020-03-06 14:10:34 +00:00
|
|
|
</ModalDialog>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{/yield-slot}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="option" as |option|>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{option.Name}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="set">
|
2020-03-06 14:10:34 +00:00
|
|
|
<TabularDetails
|
2019-05-01 18:09:29 +00:00
|
|
|
data-test-policies
|
2020-04-22 16:30:26 +00:00
|
|
|
@onchange={{action 'open'}}
|
2020-03-06 14:10:34 +00:00
|
|
|
@items={{sort-by 'CreateTime:desc' 'Name:asc' items}} as |item index|
|
|
|
|
>
|
2020-02-19 19:26:38 +00:00
|
|
|
<BlockSlot @name="header">
|
2019-05-01 18:09:29 +00:00
|
|
|
<th>Name</th>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="row">
|
2019-05-01 18:09:29 +00:00
|
|
|
<td class={{policy/typeof item}}>
|
|
|
|
{{#if item.ID }}
|
2020-06-23 08:59:43 +00:00
|
|
|
<a href={{href-to 'dc.acls.policies.edit' item.ID}}>{{item.Name}}</a>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{else}}
|
|
|
|
<a name={{item.Name}}>{{item.Name}}</a>
|
|
|
|
{{/if}}
|
|
|
|
</td>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @name="details">
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if (eq item.template '')}}
|
|
|
|
<DataSource
|
2021-09-15 18:50:11 +00:00
|
|
|
@src={{uri '/${partition}/${nspace}/${dc}/policy/${id}'
|
|
|
|
(hash
|
|
|
|
partition=item.Partition
|
|
|
|
nspace=item.Namespace
|
|
|
|
dc=dc
|
|
|
|
id=item.ID
|
|
|
|
)
|
|
|
|
}}
|
2020-06-23 08:59:43 +00:00
|
|
|
@onchange={{action (mut loadedItem) value="data"}}
|
|
|
|
@loading="lazy"
|
|
|
|
/>
|
|
|
|
{{/if}}
|
|
|
|
{{#if (eq item.template 'node-identity')}}
|
|
|
|
<dl>
|
|
|
|
<dt>Datacenter:</dt>
|
|
|
|
<dd>
|
|
|
|
{{item.Datacenter}}
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
{{else}}
|
2020-05-11 14:05:25 +00:00
|
|
|
<dl>
|
|
|
|
<dt>Datacenters:</dt>
|
|
|
|
<dd>
|
|
|
|
{{join ', ' (policy/datacenters (or loadedItem item))}}
|
|
|
|
</dd>
|
|
|
|
</dl>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{/if}}
|
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>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if (eq item.template 'service-identity')}}
|
2020-11-30 18:42:59 +00:00
|
|
|
<CodeEditor
|
|
|
|
@syntax="hcl"
|
|
|
|
@readonly={{true}}
|
|
|
|
><Consul::ServiceIdentity::Template
|
|
|
|
@nspace={{nspace}}
|
|
|
|
@name={{item.Name}}
|
|
|
|
/></CodeEditor>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{else if (eq item.template 'node-identity')}}
|
2020-11-30 18:42:59 +00:00
|
|
|
<CodeEditor
|
|
|
|
@syntax="hcl"
|
|
|
|
@readonly={{true}}
|
|
|
|
><Consul::NodeIdentity::Template
|
|
|
|
@name={{item.Name}}
|
|
|
|
/></CodeEditor>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{else}}
|
2020-11-30 18:42:59 +00:00
|
|
|
<CodeEditor
|
|
|
|
@syntax="hcl"
|
|
|
|
@readonly={{true}}
|
|
|
|
@value={{or loadedItem.Rules item.Rules}}
|
|
|
|
/>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{/if}}
|
2019-05-01 18:09:29 +00:00
|
|
|
</label>
|
2021-03-11 09:29:11 +00:00
|
|
|
{{#if (not disabled)}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<div>
|
2020-02-19 19:26:38 +00:00
|
|
|
<ConfirmationDialog @message="Are you sure you want to remove this policy from this token?">
|
|
|
|
<BlockSlot @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>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @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>
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</ConfirmationDialog>
|
2019-05-01 18:09:29 +00:00
|
|
|
</div>
|
2021-03-11 09:29:11 +00:00
|
|
|
{{/if}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
2020-03-06 14:10:34 +00:00
|
|
|
</TabularDetails>
|
2019-05-01 18:09:29 +00:00
|
|
|
|
2020-02-19 19:26:38 +00:00
|
|
|
</BlockSlot>
|
|
|
|
</ChildSelector>
|