From 9f8b87cdda89e0eba7c846b5a6758f1aee23e161 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 20 Jun 2018 20:54:27 +0100 Subject: [PATCH] Check for NOT connect-proxy --- ui-v2/app/routes/dc/intentions/create.js | 2 +- ui-v2/app/routes/dc/intentions/edit.js | 2 +- .../dc/intentions/filtered-select.feature | 34 +++++++++++++++++++ .../dc/intentions/filtered-select-steps.js | 10 ++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 ui-v2/tests/acceptance/dc/intentions/filtered-select.feature create mode 100644 ui-v2/tests/acceptance/steps/dc/intentions/filtered-select-steps.js diff --git a/ui-v2/app/routes/dc/intentions/create.js b/ui-v2/app/routes/dc/intentions/create.js index 9de6897872..e2e57dc8fe 100644 --- a/ui-v2/app/routes/dc/intentions/create.js +++ b/ui-v2/app/routes/dc/intentions/create.js @@ -25,7 +25,7 @@ export default Route.extend(WithIntentionActions, { ...model, ...{ items: [{ Name: '*' }].concat( - model.items.toArray().filter(item => get(item, 'Kind') === 'consul') + model.items.toArray().filter(item => get(item, 'Kind') !== 'connect-proxy') ), }, }; diff --git a/ui-v2/app/routes/dc/intentions/edit.js b/ui-v2/app/routes/dc/intentions/edit.js index 50cc4b9660..91c6b9f09a 100644 --- a/ui-v2/app/routes/dc/intentions/edit.js +++ b/ui-v2/app/routes/dc/intentions/edit.js @@ -19,7 +19,7 @@ export default Route.extend(WithAclActions, { ...model, ...{ items: [{ Name: '*' }].concat( - model.items.toArray().filter(item => get(item, 'Kind') === 'consul') + model.items.toArray().filter(item => get(item, 'Kind') !== 'connect-proxy') ), }, }; diff --git a/ui-v2/tests/acceptance/dc/intentions/filtered-select.feature b/ui-v2/tests/acceptance/dc/intentions/filtered-select.feature new file mode 100644 index 0000000000..def1a23444 --- /dev/null +++ b/ui-v2/tests/acceptance/dc/intentions/filtered-select.feature @@ -0,0 +1,34 @@ +@setupApplicationTest +Feature: dc / intentions / filtered select: Intention Service Select Dropdowns + In order to use services as intention sources and destinations + As a user + I want to be able to choose see existing services in the dropdown, but not existing proxy services + Scenario: Opening the [Name] dropdown with 2 services and 2 proxy services + Given 1 datacenter model with the value "datacenter" + And 4 service models from yaml + --- + - Name: service-0 + Kind: consul + - Name: service-1 + Kind: consul + - Name: service-2 + Kind: connect-proxy + - Name: service-3 + Kind: connect-proxy + --- + When I visit the intention page for yaml + --- + dc: datacenter + intention: intention + --- + Then the url should be /datacenter/intentions/intention + And I click "[data-test-[Name]-element] .ember-power-select-trigger" + Then I see "* (All Services)" in ".ember-power-select-option:nth-last-child(3)" + Then I see "service-0" in ".ember-power-select-option:nth-last-child(2)" + Then I see "service-1" in ".ember-power-select-option:last-child" + Where: + --------------- + | Name | + | source | + | destination | + --------------- diff --git a/ui-v2/tests/acceptance/steps/dc/intentions/filtered-select-steps.js b/ui-v2/tests/acceptance/steps/dc/intentions/filtered-select-steps.js new file mode 100644 index 0000000000..a7eff3228b --- /dev/null +++ b/ui-v2/tests/acceptance/steps/dc/intentions/filtered-select-steps.js @@ -0,0 +1,10 @@ +import steps from '../../steps'; + +// step definitions that are shared between features should be moved to the +// tests/acceptance/steps/steps.js file + +export default function(assert) { + return steps(assert).then('I should find a file', function() { + assert.ok(true, this.step); + }); +}