mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 00:46:43 +00:00
Switch to single selects rather than inputs
This commit is contained in:
parent
148621d98e
commit
24f6155efc
@ -11,19 +11,23 @@ export default Controller.extend({
|
|||||||
...model,
|
...model,
|
||||||
...{
|
...{
|
||||||
item: this.changeset,
|
item: this.changeset,
|
||||||
|
SourceName: model.items.filterBy('Name', get(model.item, 'SourceName'))[0],
|
||||||
|
DestinationName: model.items.filterBy('Name', get(model.item, 'DestinationName'))[0],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
change: function(e) {
|
change: function(e, value, _target) {
|
||||||
const target = e.target || { name: 'SourceName', value: e };
|
const target = e.target || { ..._target, ...{ name: e, value: value } };
|
||||||
switch (target.name) {
|
switch (target.name) {
|
||||||
case 'Action':
|
case 'Action':
|
||||||
set(this.changeset, target.name, target.value);
|
set(this.changeset, target.name, target.value);
|
||||||
break;
|
break;
|
||||||
case 'SourceName':
|
case 'SourceName':
|
||||||
set(this.changeset, 'SourceName', get(target.value, 'Name'));
|
case 'DestinationName':
|
||||||
set(this.item, 'SourceName', get(target.value, 'Name'));
|
set(this.changeset, target.name, get(target.value, 'Name'));
|
||||||
|
set(this.item, target.name, get(target.value, 'Name'));
|
||||||
|
set(this, target.name, target.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -7,6 +7,7 @@ import WithIntentionActions from 'consul-ui/mixins/intention/with-actions';
|
|||||||
export default Route.extend(WithIntentionActions, {
|
export default Route.extend(WithIntentionActions, {
|
||||||
templateName: 'dc/intentions/edit',
|
templateName: 'dc/intentions/edit',
|
||||||
repo: service('intentions'),
|
repo: service('intentions'),
|
||||||
|
servicesRepo: service('services'),
|
||||||
beforeModel: function() {
|
beforeModel: function() {
|
||||||
get(this, 'repo').invalidate();
|
get(this, 'repo').invalidate();
|
||||||
},
|
},
|
||||||
@ -17,6 +18,7 @@ export default Route.extend(WithIntentionActions, {
|
|||||||
create: true,
|
create: true,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
item: this.item,
|
item: this.item,
|
||||||
|
items: get(this, 'servicesRepo').findAllByDatacenter(this.modelFor('dc').dc.Name),
|
||||||
intents: ['allow', 'deny'],
|
intents: ['allow', 'deny'],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -2,15 +2,28 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<label class="type-text{{if item.error.SourceName ' has-error'}}">
|
<label class="type-text{{if item.error.SourceName ' has-error'}}">
|
||||||
<span>Source Service</span>
|
<span>Source Service</span>
|
||||||
{{#power-select selected=item options=items onchange=(action 'change') as |service|}}
|
{{#power-select
|
||||||
|
options=items
|
||||||
|
searchField='Name'
|
||||||
|
selected=SourceName
|
||||||
|
searchPlaceholder='Type service name'
|
||||||
|
onchange=(action 'change' 'SourceName') as |service|
|
||||||
|
}}
|
||||||
{{service.Name}}
|
{{service.Name}}
|
||||||
{{/power-select}}
|
{{/power-select}}
|
||||||
{{input value=item.SourceName name='source' autofocus='autofocus'}}
|
|
||||||
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
||||||
</label>
|
</label>
|
||||||
<label class="type-text{{if item.error.DestinationName ' has-error'}}">
|
<label class="type-text{{if item.error.DestinationName ' has-error'}}">
|
||||||
<span>Destination Service</span>
|
<span>Destination Service</span>
|
||||||
{{input value=item.DestinationName name='name'}}
|
{{#power-select
|
||||||
|
options=items
|
||||||
|
searchField='Name'
|
||||||
|
selected=DestinationName
|
||||||
|
searchPlaceholder='Type service name'
|
||||||
|
onchange=(action 'change' 'DestinationName') as |service|
|
||||||
|
}}
|
||||||
|
{{service.Name}}
|
||||||
|
{{/power-select}}
|
||||||
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
<em>Choose a Consul Service, write in a future Consul Service, or write any Service URL</em>
|
||||||
</label>
|
</label>
|
||||||
<div role="radiogroup" class={{if item.error.Action ' has-error'}}>
|
<div role="radiogroup" class={{if item.error.Action ' has-error'}}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user