open-consul/ui-v2/app/templates/dc/nspaces/-form.hbs
John Cowen 0c12a0fef1
ui: Remove the Policy/Service Identity selector from nspaces (#7124)
When editing Nspaces, although you can assign policies to a nspace using
PolicyDefaults you cannot assign a Service Identity to a policy like you
can when adding a policy to a token.

This commit adds an extra attribute to our policy-form/policy-selector
component so you can disable this setting. At a later date we may change
this to have a conficgurable `<Slot />` instead.

Simple acceptance tests is included here
2020-01-28 09:39:09 +00:00

56 lines
2.3 KiB
Handlebars

<form>
<fieldset>
{{#if create }}
<label class="type-text{{if item.error.Name ' has-error'}}">
<span>Name</span>
<input autofocus="autofocus" type="text" value={{item.Name}} name="Name" oninput={{action 'change'}} placeholder="Name" />
<em>
Must be a valid DNS hostname. Must contain 1-64 characters (numbers, letters, and hyphens), and must begin with a letter. Once created, this cannot be changed.
</em>
{{#if item.error.Name}}
<strong>{{item.error.Name.validation}}</strong>
{{/if}}
</label>
{{/if}}
<label class="type-text validate-optional">
<span>Description (Optional)</span>
<textarea name="Description" oninput={{action 'change'}}>{{item.Description}}</textarea>
</label>
</fieldset>
{{#if (env 'CONSUL_ACLS_ENABLED')}}
<fieldset id="roles">
<h2>Roles</h2>
<p>
By adding roles to this namespaces, you will apply them to all tokens created within this namespace.
</p>
{{role-selector dc=dc nspace='default' items=item.ACLs.RoleDefaults}}
</fieldset>
<fieldset id="policies">
<h2>Policies</h2>
<p>
By adding policies to this namespaces, you will apply them to all tokens created within this namespace.
</p>
{{policy-selector dc=dc nspace='default' allowServiceIdentity=false items=item.ACLs.PolicyDefaults}}
</fieldset>
{{/if}}
<div>
{{#if create }}
<button type="submit" {{ action "create" item}} disabled={{if (or item.isPristine item.isInvalid) '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 (and (not create) (not-eq item.Name 'default')) }}
{{#confirmation-dialog message='Are you sure you want to delete this Namespace?'}}
{{#block-slot name='action' as |confirm|}}
<button data-test-delete type="button" class="type-delete" {{action confirm 'delete' item parent}}>Delete</button>
{{/block-slot}}
{{#block-slot name='dialog' as |execute cancel message|}}
{{delete-confirmation message=message execute=execute cancel=cancel}}
{{/block-slot}}
{{/confirmation-dialog}}
{{/if}}
</div>
</form>