mirror of https://github.com/status-im/consul.git
Make sure future services are available when editing intentions
This commit is contained in:
parent
5575455053
commit
50507b34a5
|
@ -8,12 +8,24 @@ import validations from 'consul-ui/validations/intention';
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
setProperties: function(model) {
|
setProperties: function(model) {
|
||||||
this.changeset = new Changeset(model.item, lookupValidator(validations), validations);
|
this.changeset = new Changeset(model.item, lookupValidator(validations), validations);
|
||||||
|
const sourceName = get(model.item, 'SourceName');
|
||||||
|
const destinationName = get(model.item, 'DestinationName');
|
||||||
|
let source = model.items.findBy('Name', sourceName);
|
||||||
|
let destination = model.items.findBy('Name', destinationName);
|
||||||
|
if (!source) {
|
||||||
|
source = { Name: sourceName };
|
||||||
|
model.items = [source].concat(model.items);
|
||||||
|
}
|
||||||
|
if (!destination) {
|
||||||
|
destination = { Name: destinationName };
|
||||||
|
model.items = [destination].concat(model.items);
|
||||||
|
}
|
||||||
this._super({
|
this._super({
|
||||||
...model,
|
...model,
|
||||||
...{
|
...{
|
||||||
item: this.changeset,
|
item: this.changeset,
|
||||||
SourceName: model.items.filterBy('Name', get(model.item, 'SourceName'))[0],
|
SourceName: source,
|
||||||
DestinationName: model.items.filterBy('Name', get(model.item, 'DestinationName'))[0],
|
DestinationName: destination,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue