mirror of https://github.com/status-im/consul.git
ui: Move identity components (#9298)
This commit is contained in:
parent
70666c22bb
commit
afe0f26143
|
@ -1,6 +1,6 @@
|
|||
{{#if (env "CONSUL_NSPACES_ENABLED")}}
|
||||
namespace "default" {
|
||||
node "{{name}}" {
|
||||
node "{{@name}}" {
|
||||
policy = "write"
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace_prefix "" {
|
|||
}
|
||||
}
|
||||
{{else}}
|
||||
node "{{name}}" {
|
||||
node "{{@name}}" {
|
||||
policy = "write"
|
||||
}
|
||||
service_prefix "" {
|
|
@ -1,9 +1,9 @@
|
|||
{{#if (env "CONSUL_NSPACES_ENABLED")}}
|
||||
namespace "{{nspace}}" {
|
||||
service "{{name}}" {
|
||||
namespace "{{@nspace}}" {
|
||||
service "{{@name}}" {
|
||||
policy = "write"
|
||||
}
|
||||
service "{{name}}-sidecar-proxy" {
|
||||
service "{{@name}}-sidecar-proxy" {
|
||||
policy = "write"
|
||||
}
|
||||
service_prefix "" {
|
||||
|
@ -14,10 +14,10 @@ namespace "{{nspace}}" {
|
|||
}
|
||||
}
|
||||
{{else}}
|
||||
service "{{name}}" {
|
||||
service "{{@name}}" {
|
||||
policy = "write"
|
||||
}
|
||||
service "{{name}}-sidecar-proxy" {
|
||||
service "{{@name}}-sidecar-proxy" {
|
||||
policy = "write"
|
||||
}
|
||||
service_prefix "" {
|
|
@ -1,5 +0,0 @@
|
|||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
});
|
|
@ -35,15 +35,32 @@
|
|||
<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')}}
|
||||
<CodeEditor @readonly={{true}} @name={{concat name "[Rules]"}} @syntax="hcl" @oninput={{action "change" (concat name "[Rules]")}}>
|
||||
{{~component 'service-identity' nspace=nspace name=item.Name~}}
|
||||
</CodeEditor>
|
||||
<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')}}
|
||||
<CodeEditor @readonly={{true}} @name={{concat name "[Rules]"}} @syntax="hcl" @oninput={{action "change" (concat name "[Rules]")}}>
|
||||
{{~component 'node-identity' name=item.Name~}}
|
||||
</CodeEditor>
|
||||
<CodeEditor
|
||||
@readonly={{true}}
|
||||
@name={{concat name "[Rules]"}}
|
||||
@syntax="hcl"
|
||||
@oninput={{action "change" (concat name "[Rules]")}}
|
||||
><Consul::NodeIdentity::Template
|
||||
@name={{item.Name}}
|
||||
/></CodeEditor>
|
||||
{{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}}
|
||||
<strong>{{item.error.Rules.validation}}</strong>
|
||||
{{/if}}
|
||||
|
|
|
@ -85,15 +85,26 @@
|
|||
<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>
|
||||
{{#if (eq item.template 'service-identity')}}
|
||||
<CodeEditor @syntax="hcl" @readonly={{true}}>
|
||||
{{~component 'service-identity' nspace=nspace name=item.Name~}}
|
||||
</CodeEditor>
|
||||
<CodeEditor
|
||||
@syntax="hcl"
|
||||
@readonly={{true}}
|
||||
><Consul::ServiceIdentity::Template
|
||||
@nspace={{nspace}}
|
||||
@name={{item.Name}}
|
||||
/></CodeEditor>
|
||||
{{else if (eq item.template 'node-identity')}}
|
||||
<CodeEditor @syntax="hcl" @readonly={{true}}>
|
||||
{{~component 'node-identity' name=item.Name~}}
|
||||
</CodeEditor>
|
||||
<CodeEditor
|
||||
@syntax="hcl"
|
||||
@readonly={{true}}
|
||||
><Consul::NodeIdentity::Template
|
||||
@name={{item.Name}}
|
||||
/></CodeEditor>
|
||||
{{else}}
|
||||
<CodeEditor @syntax="hcl" @readonly={{true}} @value={{or loadedItem.Rules item.Rules}} />
|
||||
<CodeEditor
|
||||
@syntax="hcl"
|
||||
@readonly={{true}}
|
||||
@value={{or loadedItem.Rules item.Rules}}
|
||||
/>
|
||||
{{/if}}
|
||||
</label>
|
||||
<div>
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
});
|
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue