ui: Move identity components (#9298)

This commit is contained in:
John Cowen 2020-11-30 18:42:59 +00:00 committed by GitHub
parent 70666c22bb
commit afe0f26143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 55 deletions

View File

@ -1,6 +1,6 @@
{{#if (env "CONSUL_NSPACES_ENABLED")}} {{#if (env "CONSUL_NSPACES_ENABLED")}}
namespace "default" { namespace "default" {
node "{{name}}" { node "{{@name}}" {
policy = "write" policy = "write"
} }
} }
@ -10,7 +10,7 @@ namespace_prefix "" {
} }
} }
{{else}} {{else}}
node "{{name}}" { node "{{@name}}" {
policy = "write" policy = "write"
} }
service_prefix "" { service_prefix "" {

View File

@ -1,9 +1,9 @@
{{#if (env "CONSUL_NSPACES_ENABLED")}} {{#if (env "CONSUL_NSPACES_ENABLED")}}
namespace "{{nspace}}" { namespace "{{@nspace}}" {
service "{{name}}" { service "{{@name}}" {
policy = "write" policy = "write"
} }
service "{{name}}-sidecar-proxy" { service "{{@name}}-sidecar-proxy" {
policy = "write" policy = "write"
} }
service_prefix "" { service_prefix "" {
@ -14,10 +14,10 @@ namespace "{{nspace}}" {
} }
} }
{{else}} {{else}}
service "{{name}}" { service "{{@name}}" {
policy = "write" policy = "write"
} }
service "{{name}}-sidecar-proxy" { service "{{@name}}-sidecar-proxy" {
policy = "write" policy = "write"
} }
service_prefix "" { service_prefix "" {

View File

@ -1,5 +0,0 @@
import Component from '@ember/component';
export default Component.extend({
tagName: '',
});

View File

@ -35,15 +35,32 @@
<label class="type-text" data-test-rules> <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> <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')}} {{#if (eq item.template 'service-identity')}}
<CodeEditor @readonly={{true}} @name={{concat name "[Rules]"}} @syntax="hcl" @oninput={{action "change" (concat name "[Rules]")}}> <CodeEditor
{{~component 'service-identity' nspace=nspace name=item.Name~}} @readonly={{true}}
</CodeEditor> @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')}} {{else if (eq item.template 'node-identity')}}
<CodeEditor @readonly={{true}} @name={{concat name "[Rules]"}} @syntax="hcl" @oninput={{action "change" (concat name "[Rules]")}}> <CodeEditor
{{~component 'node-identity' name=item.Name~}} @readonly={{true}}
</CodeEditor> @name={{concat name "[Rules]"}}
@syntax="hcl"
@oninput={{action "change" (concat name "[Rules]")}}
><Consul::NodeIdentity::Template
@name={{item.Name}}
/></CodeEditor>
{{else}} {{else}}
<CodeEditor @syntax="hcl" @class={{if item.error.Rules "error"}} @name={{concat name "[Rules]"}} @value={{item.Rules}} @onkeyup={{action "change" (concat name "[Rules]")}} /> <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}} {{#if item.error.Rules}}
<strong>{{item.error.Rules.validation}}</strong> <strong>{{item.error.Rules.validation}}</strong>
{{/if}} {{/if}}

View File

@ -85,15 +85,26 @@
<label class="type-text"> <label class="type-text">
<span>Rules <a href="{{env 'CONSUL_DOCS_URL'}}/guides/acl.html#rule-specification" rel="help noopener noreferrer" target="_blank">(HCL Format)</a></span> <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')}} {{#if (eq item.template 'service-identity')}}
<CodeEditor @syntax="hcl" @readonly={{true}}> <CodeEditor
{{~component 'service-identity' nspace=nspace name=item.Name~}} @syntax="hcl"
</CodeEditor> @readonly={{true}}
><Consul::ServiceIdentity::Template
@nspace={{nspace}}
@name={{item.Name}}
/></CodeEditor>
{{else if (eq item.template 'node-identity')}} {{else if (eq item.template 'node-identity')}}
<CodeEditor @syntax="hcl" @readonly={{true}}> <CodeEditor
{{~component 'node-identity' name=item.Name~}} @syntax="hcl"
</CodeEditor> @readonly={{true}}
><Consul::NodeIdentity::Template
@name={{item.Name}}
/></CodeEditor>
{{else}} {{else}}
<CodeEditor @syntax="hcl" @readonly={{true}} @value={{or loadedItem.Rules item.Rules}} /> <CodeEditor
@syntax="hcl"
@readonly={{true}}
@value={{or loadedItem.Rules item.Rules}}
/>
{{/if}} {{/if}}
</label> </label>
<div> <div>

View File

@ -1,5 +0,0 @@
import Component from '@ember/component';
export default Component.extend({
tagName: '',
});

View File

@ -1,24 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | service identity', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
await render(hbs`{{service-identity}}`);
assert.ok(this.element.textContent.trim().indexOf('service_prefix') !== -1);
// Template block usage:
await render(hbs`
{{#service-identity}}{{/service-identity}}
`);
assert.ok(this.element.textContent.trim().indexOf('service_prefix') !== -1);
});
});