open-consul/ui/packages/consul-ui/app/components/policy-form/index.hbs

132 lines
4.7 KiB
Handlebars
Raw Normal View History

{{yield}}
<fieldset
class="policy-form"
disabled={{if (not (can "write policy" item=item)) "disabled"}}
...attributes
>
{{#yield-slot name='template'}}
{{else}}
<header>
Policy{{if allowIdentity ' or identity?' ''}}
</header>
{{#if allowIdentity}}
<p>
Identities are default policies with configurable names. They save you some time and effort you're using Consul for Connect features.
</p>
{{! this should use radio-group }}
<div role="radiogroup" class={{if item.error.Type ' has-error'}}>
{{#each templates as |template|}}
<label data-test-radiobutton={{concat 'template_' template.template}}>
<span>{{template.name}}</span>
ui: Partitions Application Layer (#11017) * Add Partition to all our models * Add partitions into our serializers/fingerprinting * Make some amends to a few adapters ready for partitions * Amend blueprints to avoid linting error * Update all our repositories to include partitions, also Remove enabled/disable nspace repo and just use a nspace with conditionals * Ensure nspace and parition parameters always return '' no matter what * Ensure data-sink finds the model properly This will later be replaced by a @dataSink decorator but we are find kicking that can down the road a little more * Add all the new partition data layer * Add a way to set the title of the page from inside the route and make it accessibile via a route announcer * Make the Consul Route the default/basic one * Tweak nspace and partition abilities not to check the length * Thread partition through all the components that need it * Some ACL tweaks * Move the entire app to use partitions * Delete all the tests we no longer need * Update some Unit tests to use partition * Fix up KV title tests * Fix up a few more acceptance tests * Fixup and temporarily ignore some acceptance tests * Stop using ember-cli-page-objects fillable as it doesn't seem to work * Fix lint error * Remove old ACL related test * Add a tick after filling out forms * Fix token warning modal * Found some more places where we need a partition var * Fixup some more acceptance tests * Tokens still needs a repo service for CRUD * Remove acceptance tests we no longer need * Fixup and "FIXME ignore" a few tests * Remove an s * Disable blocking queries for KV to revert to previous release for now * Fixup adapter tests to follow async/function resolving interface * Fixup all the serializer integration tests * Fixup service/repo integration tests * Fixup deleting acceptance test * Fixup some ent tests * Make sure nspaces passes the dc through for when thats important * ...aaaand acceptance nspaces with the extra dc param
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'}}/>
</label>
{{/each}}
</div>
{{else}}
<input type="hidden" name={{concat name '[template]'}} value="" />
{{/if}}
{{/yield-slot}}
<label class="type-text{{if (and item.error.Name (not item.isPristine)) ' has-error'}}">
<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>
{{#if (and item.error.Name (not item.isPristine))}}
<strong>{{item.error.Name.validation}}</strong>
{{/if}}
</label>
<label class="type-text" data-test-rules>
<span>Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a></span>
{{#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]")}}
><Consul::ServiceIdentity::Template
@nspace={{nspace}}
@name={{item.Name}}
/></CodeEditor>
{{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]")}}
><Consul::NodeIdentity::Template
@name={{item.Name}}
/></CodeEditor>
{{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]")}}
/>
{{#if item.error.Rules}}
<strong>{{item.error.Rules.validation}}</strong>
{{/if}}
{{/if}}
</label>
{{#if (eq item.template 'node-identity')}}
ui: Partitions Application Layer (#11017) * Add Partition to all our models * Add partitions into our serializers/fingerprinting * Make some amends to a few adapters ready for partitions * Amend blueprints to avoid linting error * Update all our repositories to include partitions, also Remove enabled/disable nspace repo and just use a nspace with conditionals * Ensure nspace and parition parameters always return '' no matter what * Ensure data-sink finds the model properly This will later be replaced by a @dataSink decorator but we are find kicking that can down the road a little more * Add all the new partition data layer * Add a way to set the title of the page from inside the route and make it accessibile via a route announcer * Make the Consul Route the default/basic one * Tweak nspace and partition abilities not to check the length * Thread partition through all the components that need it * Some ACL tweaks * Move the entire app to use partitions * Delete all the tests we no longer need * Update some Unit tests to use partition * Fix up KV title tests * Fix up a few more acceptance tests * Fixup and temporarily ignore some acceptance tests * Stop using ember-cli-page-objects fillable as it doesn't seem to work * Fix lint error * Remove old ACL related test * Add a tick after filling out forms * Fix token warning modal * Found some more places where we need a partition var * Fixup some more acceptance tests * Tokens still needs a repo service for CRUD * Remove acceptance tests we no longer need * Fixup and "FIXME ignore" a few tests * Remove an s * Disable blocking queries for KV to revert to previous release for now * Fixup adapter tests to follow async/function resolving interface * Fixup all the serializer integration tests * Fixup service/repo integration tests * Fixup deleting acceptance test * Fixup some ent tests * Make sure nspaces passes the dc through for when thats important * ...aaaand acceptance nspaces with the extra dc param
2021-09-15 18:50:11 +00:00
<DataSource
@src={{uri '/*/*/*/datacenters'}}
@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}}
<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>
{{#if isScoped }}
ui: Partitions Application Layer (#11017) * Add Partition to all our models * Add partitions into our serializers/fingerprinting * Make some amends to a few adapters ready for partitions * Amend blueprints to avoid linting error * Update all our repositories to include partitions, also Remove enabled/disable nspace repo and just use a nspace with conditionals * Ensure nspace and parition parameters always return '' no matter what * Ensure data-sink finds the model properly This will later be replaced by a @dataSink decorator but we are find kicking that can down the road a little more * Add all the new partition data layer * Add a way to set the title of the page from inside the route and make it accessibile via a route announcer * Make the Consul Route the default/basic one * Tweak nspace and partition abilities not to check the length * Thread partition through all the components that need it * Some ACL tweaks * Move the entire app to use partitions * Delete all the tests we no longer need * Update some Unit tests to use partition * Fix up KV title tests * Fix up a few more acceptance tests * Fixup and temporarily ignore some acceptance tests * Stop using ember-cli-page-objects fillable as it doesn't seem to work * Fix lint error * Remove old ACL related test * Add a tick after filling out forms * Fix token warning modal * Found some more places where we need a partition var * Fixup some more acceptance tests * Tokens still needs a repo service for CRUD * Remove acceptance tests we no longer need * Fixup and "FIXME ignore" a few tests * Remove an s * Disable blocking queries for KV to revert to previous release for now * Fixup adapter tests to follow async/function resolving interface * Fixup all the serializer integration tests * Fixup service/repo integration tests * Fixup deleting acceptance test * Fixup some ent tests * Make sure nspaces passes the dc through for when thats important * ...aaaand acceptance nspaces with the extra dc param
2021-09-15 18:50:11 +00:00
<DataSource
@src={{uri '/*/*/*/datacenters'}}
@onchange={{action (mut datacenters) value="data"}}
/>
<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>
{{/if}}
{{/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>