Skip to content

Commit

Permalink
ui: Move intention source/destination menus use text from the template (
Browse files Browse the repository at this point in the history
  • Loading branch information
johncowen authored and John Cowen committed Dec 5, 2018
1 parent 51baa12 commit 01aa636
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions ui-v2/app/controllers/dc/intentions/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { get, set } from '@ember/object';

export default Controller.extend({
dom: service('dom'),
builder: service('form'),
Expand Down Expand Up @@ -32,8 +31,8 @@ export default Controller.extend({
});
},
actions: {
createNewLabel: function(term) {
return `Use a future Consul Service called '${term}'`;
createNewLabel: function(template, term) {
return template.replace(/{{term}}/g, term);
},
isUnique: function(term) {
return !get(this, 'items').findBy('Name', term);
Expand Down
4 changes: 2 additions & 2 deletions ui-v2/app/templates/dc/intentions/-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
searchField='Name'
selected=SourceName
searchPlaceholder='Type service name'
buildSuggestion=(action 'createNewLabel')
buildSuggestion=(action 'createNewLabel' "Use a future Consul Service called '{{term}}'")
showCreateWhen=(action "isUnique")
oncreate=(action 'change' 'SourceName')
onchange=(action 'change' 'SourceName') as |service search|
Expand All @@ -27,7 +27,7 @@
searchField='Name'
selected=DestinationName
searchPlaceholder='Type service name'
buildSuggestion=(action 'createNewLabel')
buildSuggestion=(action 'createNewLabel' "Use a future Consul Service called '{{term}}'")
showCreateWhen=(action "isUnique")
oncreate=(action 'change' 'DestinationName')
onchange=(action 'change' 'DestinationName') as |service|
Expand Down

0 comments on commit 01aa636

Please sign in to comment.