diff --git a/ui-v2/app/controllers/dc/intentions/edit.js b/ui-v2/app/controllers/dc/intentions/edit.js index 5b5b400e2a..669ed0fb25 100644 --- a/ui-v2/app/controllers/dc/intentions/edit.js +++ b/ui-v2/app/controllers/dc/intentions/edit.js @@ -1,5 +1,5 @@ import Controller from '@ember/controller'; -import { set } from '@ember/object'; +import { get, set } from '@ember/object'; // import Changeset from 'ember-changeset'; // import validations from 'consul-ui/validations/acl'; // import lookupValidator from 'ember-changeset-validations'; @@ -16,11 +16,15 @@ export default Controller.extend({ }, actions: { change: function(e) { - const target = e.target; + const target = e.target || { name: 'SourceName', value: e }; switch (target.name) { case 'Action': set(this.changeset, target.name, target.value); break; + case 'SourceName': + set(this.changeset, 'SourceName', get(target.value, 'Name')); + set(this.item, 'SourceName', get(target.value, 'Name')); + break; } }, }, diff --git a/ui-v2/app/routes/dc/intentions/edit.js b/ui-v2/app/routes/dc/intentions/edit.js index 9a75d057b0..12bd62a263 100644 --- a/ui-v2/app/routes/dc/intentions/edit.js +++ b/ui-v2/app/routes/dc/intentions/edit.js @@ -7,10 +7,12 @@ import WithAclActions from 'consul-ui/mixins/intention/with-actions'; export default Route.extend(WithAclActions, { repo: service('intentions'), + servicesRepo: service('services'), model: function(params) { return hash({ isLoading: false, item: get(this, 'repo').findBySlug(params.id, this.modelFor('dc').dc.Name), + items: get(this, 'servicesRepo').findAllByDatacenter(this.modelFor('dc').dc.Name), intents: ['allow', 'deny'], }); }, diff --git a/ui-v2/app/styles/app.scss b/ui-v2/app/styles/app.scss index 03048d259d..f468c65440 100644 --- a/ui-v2/app/styles/app.scss +++ b/ui-v2/app/styles/app.scss @@ -60,3 +60,5 @@ main label a[rel*='help'] { [role='tabpanel'] > p:only-child [rel*='help']::after { content: none; } + +@import 'ember-power-select'; diff --git a/ui-v2/app/templates/dc/intentions/-form.hbs b/ui-v2/app/templates/dc/intentions/-form.hbs index 93a0734d58..e560804a47 100644 --- a/ui-v2/app/templates/dc/intentions/-form.hbs +++ b/ui-v2/app/templates/dc/intentions/-form.hbs @@ -2,6 +2,9 @@
diff --git a/ui-v2/package.json b/ui-v2/package.json index 13642f549c..37dcb95e84 100644 --- a/ui-v2/package.json +++ b/ui-v2/package.json @@ -72,6 +72,7 @@ "ember-load-initializers": "^1.0.0", "ember-math-helpers": "^2.4.0", "ember-pluralize": "^0.2.0", + "ember-power-select": "^2.0.2", "ember-resolver": "^4.0.0", "ember-sinon-qunit": "^2.1.0", "ember-source": "~2.18.2", diff --git a/ui-v2/yarn.lock b/ui-v2/yarn.lock index c760ef53b3..4d8c8400b8 100644 --- a/ui-v2/yarn.lock +++ b/ui-v2/yarn.lock @@ -2972,6 +2972,14 @@ ember-ajax@^3.0.0: dependencies: ember-cli-babel "^6.6.0" +ember-basic-dropdown@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ember-basic-dropdown/-/ember-basic-dropdown-1.0.0.tgz#bbafcaab986ba86dfe8d02b0f8529984229bd738" + dependencies: + ember-cli-babel "^6.12.0" + ember-cli-htmlbars "^2.0.3" + ember-maybe-in-element "^0.1.3" + ember-block-slots@^1.1.11: version "1.1.11" resolved "https://registry.yarnpkg.com/ember-block-slots/-/ember-block-slots-1.1.11.tgz#71ddebfde834a661f94a50bc2d7309b297213fef" @@ -3057,7 +3065,7 @@ ember-cli-babel@5.1.5: ember-cli-version-checker "^1.0.2" resolve "^1.1.2" -ember-cli-babel@6.12.0, ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.7.2, ember-cli-babel@^6.8.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2, ember-cli-babel@^6.9.0, ember-cli-babel@^6.9.2: +ember-cli-babel@6.12.0, ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.7.2, ember-cli-babel@^6.8.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2, ember-cli-babel@^6.9.0, ember-cli-babel@^6.9.2: version "6.12.0" resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.12.0.tgz#3adcdbe1278da1fcd0b9038f1360cb4ac5d4414c" dependencies: @@ -3202,7 +3210,7 @@ ember-cli-htmlbars@^1.0.1, ember-cli-htmlbars@^1.0.3, ember-cli-htmlbars@^1.1.1: json-stable-stringify "^1.0.0" strip-bom "^2.0.0" -ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.2: +ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.2, ember-cli-htmlbars@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-2.0.3.tgz#e116e1500dba12f29c94b05b9ec90f52cb8bb042" dependencies: @@ -3514,6 +3522,14 @@ ember-computed-style@^0.2.0: dependencies: ember-cli-babel "^5.1.7" +ember-concurrency@^0.8.19: + version "0.8.19" + resolved "https://registry.yarnpkg.com/ember-concurrency/-/ember-concurrency-0.8.19.tgz#71b9c175ba077865310029cb4bdb880e17d5155e" + dependencies: + babel-core "^6.24.1" + ember-cli-babel "^6.8.2" + ember-maybe-import-regenerator "^0.1.5" + ember-data@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/ember-data/-/ember-data-3.1.1.tgz#8c17c97a4932b0a0a405cc3e38c43140880366d2" @@ -3596,6 +3612,21 @@ ember-math-helpers@^2.4.0: ember-cli-babel "^6.6.0" ember-cli-htmlbars "^2.0.1" +ember-maybe-import-regenerator@^0.1.5: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ember-maybe-import-regenerator/-/ember-maybe-import-regenerator-0.1.6.tgz#35d41828afa6d6a59bc0da3ce47f34c573d776ca" + dependencies: + broccoli-funnel "^1.0.1" + broccoli-merge-trees "^1.0.0" + ember-cli-babel "^6.0.0-beta.4" + regenerator-runtime "^0.9.5" + +ember-maybe-in-element@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ember-maybe-in-element/-/ember-maybe-in-element-0.1.3.tgz#1c89be49246e580c1090336ad8be31e373f71b60" + dependencies: + ember-cli-babel "^6.11.0" + ember-native-dom-helpers@^0.5.3: version "0.5.10" resolved "https://registry.yarnpkg.com/ember-native-dom-helpers/-/ember-native-dom-helpers-0.5.10.tgz#9c7172e4ddfa5dd86830c46a936e2f8eca3e5896" @@ -3609,6 +3640,17 @@ ember-pluralize@^0.2.0: dependencies: ember-cli-babel "5.1.5" +ember-power-select@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ember-power-select/-/ember-power-select-2.0.2.tgz#e8c9a4f266b5a32847e859ddd4db5b2f95108ee8" + dependencies: + ember-basic-dropdown "^1.0.0" + ember-cli-babel "^6.11.0" + ember-cli-htmlbars "^2.0.1" + ember-concurrency "^0.8.19" + ember-text-measurer "^0.4.0" + ember-truth-helpers "^2.0.0" + "ember-prop-types@>=2.0.0 <4.0.0": version "3.14.2" resolved "https://registry.yarnpkg.com/ember-prop-types/-/ember-prop-types-3.14.2.tgz#59ee8f7672aa67fce8aa0cdf2d9527c4e13c3e42" @@ -3716,6 +3758,12 @@ ember-test-selectors@^0.3.9: ember-cli-babel "^6.8.2" ember-cli-version-checker "^2.0.0" +ember-text-measurer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/ember-text-measurer/-/ember-text-measurer-0.4.1.tgz#30ababa7100b2ffb86f8c37fe2b4b56d2592c626" + dependencies: + ember-cli-babel "^6.8.2" + ember-truth-helpers@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ember-truth-helpers/-/ember-truth-helpers-2.0.0.tgz#f3e2eef667859197f1328bb4f83b0b35b661c1ac" @@ -7675,6 +7723,10 @@ regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" +regenerator-runtime@^0.9.5: + version "0.9.6" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.9.6.tgz#d33eb95d0d2001a4be39659707c51b0cb71ce029" + regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd"