ui: Move intention source/destination menus use text from the template (#4938)

This commit is contained in:
John Cowen 2018-11-19 14:54:40 +00:00 committed by John Cowen
parent 5eed6dcef6
commit 5049780134
2 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,6 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { get, set } from '@ember/object'; import { get, set } from '@ember/object';
export default Controller.extend({ export default Controller.extend({
dom: service('dom'), dom: service('dom'),
builder: service('form'), builder: service('form'),
@ -32,8 +31,8 @@ export default Controller.extend({
}); });
}, },
actions: { actions: {
createNewLabel: function(term) { createNewLabel: function(template, term) {
return `Use a future Consul Service called '${term}'`; return template.replace(/{{term}}/g, term);
}, },
isUnique: function(term) { isUnique: function(term) {
return !get(this, 'items').findBy('Name', term); return !get(this, 'items').findBy('Name', term);

View File

@ -7,7 +7,7 @@
searchField='Name' searchField='Name'
selected=SourceName selected=SourceName
searchPlaceholder='Type service name' searchPlaceholder='Type service name'
buildSuggestion=(action 'createNewLabel') buildSuggestion=(action 'createNewLabel' "Use a future Consul Service called '{{term}}'")
showCreateWhen=(action "isUnique") showCreateWhen=(action "isUnique")
oncreate=(action 'change' 'SourceName') oncreate=(action 'change' 'SourceName')
onchange=(action 'change' 'SourceName') as |service search| onchange=(action 'change' 'SourceName') as |service search|
@ -27,7 +27,7 @@
searchField='Name' searchField='Name'
selected=DestinationName selected=DestinationName
searchPlaceholder='Type service name' searchPlaceholder='Type service name'
buildSuggestion=(action 'createNewLabel') buildSuggestion=(action 'createNewLabel' "Use a future Consul Service called '{{term}}'")
showCreateWhen=(action "isUnique") showCreateWhen=(action "isUnique")
oncreate=(action 'change' 'DestinationName') oncreate=(action 'change' 'DestinationName')
onchange=(action 'change' 'DestinationName') as |service| onchange=(action 'change' 'DestinationName') as |service|