From 3780622df0ffbd2fd85e5c0d62df7a672922b766 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 19 Nov 2018 14:54:40 +0000 Subject: [PATCH] ui: Move intention source/destination menus use text from the template (#4938) --- ui-v2/app/controllers/dc/intentions/edit.js | 5 ++--- ui-v2/app/templates/dc/intentions/-form.hbs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ui-v2/app/controllers/dc/intentions/edit.js b/ui-v2/app/controllers/dc/intentions/edit.js index 1999614a74..0d622d4858 100644 --- a/ui-v2/app/controllers/dc/intentions/edit.js +++ b/ui-v2/app/controllers/dc/intentions/edit.js @@ -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'), @@ -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); diff --git a/ui-v2/app/templates/dc/intentions/-form.hbs b/ui-v2/app/templates/dc/intentions/-form.hbs index 6a1123cbfd..f85fb8e3ab 100644 --- a/ui-v2/app/templates/dc/intentions/-form.hbs +++ b/ui-v2/app/templates/dc/intentions/-form.hbs @@ -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| @@ -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|