2020-02-19 19:26:38 +00:00
|
|
|
<ChildSelector @repo={{repo}} @dc={{dc}} @nspace={{nspace}} @type="policy" @placeholder="Search for policy" @items={{items}}>
|
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}}
|
|
|
|
<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}}
|
2020-03-06 14:10:34 +00:00
|
|
|
<ModalDialog
|
|
|
|
data-test-policy-form
|
|
|
|
@onopen={{action "open"}}
|
|
|
|
@name="new-policy-toggle"
|
|
|
|
>
|
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">
|
|
|
|
<PolicyForm @form={{form}} @dc={{dc}} @allowServiceIdentity={{allowServiceIdentity}} />
|
|
|
|
</BlockSlot>
|
|
|
|
<BlockSlot @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>
|
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-04-22 16:30:26 +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">
|
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 '')}}
|
2020-04-22 16:30:26 +00:00
|
|
|
<DataSource
|
|
|
|
@src={{concat '/' item.Namespace '/' item.Datacenter '/policy/' item.ID}}
|
|
|
|
@onchange={{action (mut loadedItem) value="data"}}
|
|
|
|
@loading="lazy"
|
|
|
|
/>
|
|
|
|
<CodeEditor @syntax="hcl" @readonly={{true}} @value={{or loadedItem.Rules item.Rules}} />
|
2019-05-01 18:09:29 +00:00
|
|
|
{{else}}
|
2020-02-19 19:26:38 +00:00
|
|
|
<CodeEditor @syntax="hcl" @readonly={{true}}>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{~component 'service-identity' name=item.Name~}}
|
2020-02-19 19:26:38 +00:00
|
|
|
</CodeEditor>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{/if}}
|
|
|
|
</label>
|
|
|
|
<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>
|
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>
|