2019-05-01 18:09:29 +00:00
|
|
|
{{yield}}
|
2021-03-11 09:29:11 +00:00
|
|
|
<fieldset
|
2021-04-06 12:40:40 +00:00
|
|
|
class="policy-form"
|
2021-03-11 09:29:11 +00:00
|
|
|
disabled={{if (not (can "write policy" item=item)) "disabled"}}
|
|
|
|
...attributes
|
|
|
|
>
|
2020-01-15 09:15:54 +00:00
|
|
|
{{#yield-slot name='template'}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{else}}
|
|
|
|
<header>
|
2020-06-23 08:59:43 +00:00
|
|
|
Policy{{if allowIdentity ' or identity?' ''}}
|
2019-05-01 18:09:29 +00:00
|
|
|
</header>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if allowIdentity}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<p>
|
2020-06-23 08:59:43 +00:00
|
|
|
Identities are default policies with configurable names. They save you some time and effort you're using Consul for Connect features.
|
2019-05-01 18:09:29 +00:00
|
|
|
</p>
|
|
|
|
{{! this should use radio-group }}
|
|
|
|
<div role="radiogroup" class={{if item.error.Type ' has-error'}}>
|
|
|
|
{{#each templates as |template|}}
|
2020-03-06 14:10:34 +00:00
|
|
|
<label data-test-radiobutton={{concat 'template_' template.template}}>
|
2019-05-01 18:09:29 +00:00
|
|
|
<span>{{template.name}}</span>
|
2021-09-15 18:50:11 +00:00
|
|
|
<input type="radio" name={{concat name '[template]'}} value={{template.template}} checked={{eq item.template template.template}} onchange={{action (optional (changeset-set item 'template')) value='target.value'}}/>
|
2019-05-01 18:09:29 +00:00
|
|
|
</label>
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
2020-01-28 09:39:09 +00:00
|
|
|
{{else}}
|
|
|
|
<input type="hidden" name={{concat name '[template]'}} value="" />
|
|
|
|
{{/if}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{/yield-slot}}
|
2019-06-04 14:57:35 +00:00
|
|
|
<label class="type-text{{if (and item.error.Name (not item.isPristine)) ' has-error'}}">
|
2019-05-01 18:09:29 +00:00
|
|
|
<span>Name</span>
|
|
|
|
<input type="text" value={{item.Name}} name="{{name}}[Name]" autofocus="autofocus" oninput={{action 'change'}} />
|
|
|
|
<em>
|
|
|
|
Maximum 128 characters. May only include letters (uppercase and/or lowercase) and/or numbers. Must be unique.
|
|
|
|
</em>
|
2019-06-04 14:57:35 +00:00
|
|
|
{{#if (and item.error.Name (not item.isPristine))}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<strong>{{item.error.Name.validation}}</strong>
|
|
|
|
{{/if}}
|
|
|
|
</label>
|
2021-11-12 15:28:06 +00:00
|
|
|
<label for="" class="type-text" data-test-rules>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if (eq item.template 'service-identity')}}
|
2020-11-30 18:42:59 +00:00
|
|
|
<CodeEditor
|
|
|
|
@readonly={{true}}
|
|
|
|
@name={{concat name "[Rules]"}}
|
|
|
|
@syntax="hcl"
|
|
|
|
@oninput={{action "change" (concat name "[Rules]")}}
|
2021-11-12 15:28:06 +00:00
|
|
|
>
|
|
|
|
<:label>
|
|
|
|
Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a>
|
|
|
|
</:label>
|
2021-12-06 10:33:44 +00:00
|
|
|
<:content><Consul::ServiceIdentity::Template
|
2021-11-12 15:28:06 +00:00
|
|
|
@nspace={{nspace}}
|
2021-12-06 10:33:44 +00:00
|
|
|
@partition={{partition}}
|
2021-11-12 15:28:06 +00:00
|
|
|
@name={{item.Name}}
|
2021-12-06 10:33:44 +00:00
|
|
|
/></:content>
|
2021-11-12 15:28:06 +00:00
|
|
|
</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
|
|
|
|
@readonly={{true}}
|
|
|
|
@name={{concat name "[Rules]"}}
|
|
|
|
@syntax="hcl"
|
|
|
|
@oninput={{action "change" (concat name "[Rules]")}}
|
2021-11-12 15:28:06 +00:00
|
|
|
>
|
|
|
|
<:label>
|
|
|
|
Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a>
|
|
|
|
</:label>
|
2021-12-06 10:33:44 +00:00
|
|
|
<:content><Consul::NodeIdentity::Template
|
2021-11-12 15:28:06 +00:00
|
|
|
@name={{item.Name}}
|
2021-12-06 10:33:44 +00:00
|
|
|
@partition={{partition}}
|
|
|
|
/></:content>
|
2021-11-12 15:28:06 +00:00
|
|
|
</CodeEditor>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{else}}
|
2020-11-30 18:42:59 +00:00
|
|
|
<CodeEditor
|
|
|
|
@syntax="hcl"
|
|
|
|
@class={{if item.error.Rules "error"}}
|
|
|
|
@name={{concat name "[Rules]"}}
|
|
|
|
@value={{item.Rules}}
|
|
|
|
@onkeyup={{action "change" (concat name "[Rules]")}}
|
2021-11-12 15:28:06 +00:00
|
|
|
>
|
|
|
|
<:label>
|
|
|
|
Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a>
|
|
|
|
</:label>
|
|
|
|
</CodeEditor>
|
2019-05-01 18:09:29 +00:00
|
|
|
{{#if item.error.Rules}}
|
|
|
|
<strong>{{item.error.Rules.validation}}</strong>
|
|
|
|
{{/if}}
|
|
|
|
{{/if}}
|
|
|
|
</label>
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if (eq item.template 'node-identity')}}
|
|
|
|
|
2021-09-15 18:50:11 +00:00
|
|
|
<DataSource
|
|
|
|
@src={{uri '/*/*/*/datacenters'}}
|
2020-06-23 08:59:43 +00:00
|
|
|
@onchange={{action (mut datacenters) value="data"}}
|
|
|
|
/>
|
|
|
|
<label class="type-select" data-test-datacenter>
|
|
|
|
<span>Datacenter</span>
|
|
|
|
<PowerSelect
|
|
|
|
@options={{map-by 'Name' datacenters}}
|
|
|
|
@searchField="Name"
|
|
|
|
@selected={{or item.Datacenter dc}}
|
|
|
|
@searchPlaceholder="Type a datacenter name"
|
|
|
|
@onChange={{action "change" "Datacenter"}} as |Name|>
|
|
|
|
{{Name}}
|
|
|
|
</PowerSelect>
|
|
|
|
</label>
|
|
|
|
{{else}}
|
2021-12-01 11:05:15 +00:00
|
|
|
{{! only show Valid Datacenters for the default partition }}
|
|
|
|
{{#if (eq (or partition 'default') 'default')}}
|
2019-05-01 18:09:29 +00:00
|
|
|
<div class="type-toggle">
|
|
|
|
<span>Valid datacenters</span>
|
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="{{name}}[isScoped]" checked={{if (not isScoped) 'checked' }} onchange={{action 'change'}} />
|
|
|
|
<span>All</span>
|
|
|
|
</label>
|
|
|
|
</div>
|
2021-12-01 11:05:15 +00:00
|
|
|
{{/if}}
|
2020-06-23 08:59:43 +00:00
|
|
|
{{#if isScoped }}
|
2021-09-15 18:50:11 +00:00
|
|
|
<DataSource
|
|
|
|
@src={{uri '/*/*/*/datacenters'}}
|
2020-04-22 16:30:26 +00:00
|
|
|
@onchange={{action (mut datacenters) value="data"}}
|
|
|
|
/>
|
2020-06-23 08:59:43 +00:00
|
|
|
|
2019-05-01 18:09:29 +00:00
|
|
|
<div class="checkbox-group" role="group">
|
|
|
|
{{#each datacenters as |dc| }}
|
|
|
|
<label class="type-checkbox">
|
|
|
|
<input type="checkbox" name="{{name}}[Datacenters]" value={{dc.Name}} checked={{if (contains dc.Name item.Datacenters) 'checked' }} onchange={{action 'change'}} />
|
|
|
|
<span>{{dc.Name}}</span>
|
|
|
|
</label>
|
|
|
|
{{/each}}
|
|
|
|
{{#each item.Datacenters as |dc| }}
|
|
|
|
{{#if (not (find-by 'Name' dc datacenters))}}
|
|
|
|
<label class="type-checkbox">
|
|
|
|
<input type="checkbox" name="{{name}}[Datacenters]" value={{dc}} checked="checked" onchange={{action 'change'}} />
|
|
|
|
<span>{{dc}}</span>
|
|
|
|
</label>
|
|
|
|
{{/if}}
|
|
|
|
{{/each}}
|
|
|
|
</div>
|
2020-06-23 08:59:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{/if}}
|
2019-05-01 18:09:29 +00:00
|
|
|
{{/if}}
|
|
|
|
{{#if (eq item.template '') }}
|
|
|
|
<label class="type-text">
|
|
|
|
<span>Description (Optional)</span>
|
|
|
|
<textarea name="{{name}}[Description]" value={{item.Description}} oninput={{action 'change'}}></textarea>
|
|
|
|
</label>
|
|
|
|
{{/if}}
|
|
|
|
</fieldset>
|
|
|
|
|