diff --git a/ui/packages/consul-ui/app/adapters/service.js b/ui/packages/consul-ui/app/adapters/service.js index 30af669234..bc15702ada 100644 --- a/ui/packages/consul-ui/app/adapters/service.js +++ b/ui/packages/consul-ui/app/adapters/service.js @@ -42,5 +42,5 @@ export default class ServiceAdapter extends Adapter { index, }} `; - } + } } diff --git a/ui/packages/consul-ui/app/utils/get-environment.js b/ui/packages/consul-ui/app/utils/get-environment.js index 678b57d276..8e6d695343 100644 --- a/ui/packages/consul-ui/app/utils/get-environment.js +++ b/ui/packages/consul-ui/app/utils/get-environment.js @@ -280,10 +280,12 @@ export default function (config = {}, win = window, doc = document) { case 'CONSUL_SERVICE_DASHBOARD_URL': case 'CONSUL_BASE_UI_URL': case 'CONSUL_HTTP_PROTOCOL': - case 'CONSUL_HTTP_MAX_CONNECTIONS': + case 'CONSUL_HTTP_MAX_CONNECTIONS': { // We allow the operator to set these ones via various methods // although UI developer config is preferred - return ui(str) || operator(str, env); + const _ui = ui(str); + return typeof _ui !== 'undefined' ? _ui : operator(str, env); + } default: return ui(str); } diff --git a/ui/packages/consul-ui/tests/acceptance/dc/services/show-topology.feature b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/index.feature similarity index 89% rename from ui/packages/consul-ui/tests/acceptance/dc/services/show-topology.feature rename to ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/index.feature index ea78a29711..b1ae7cbdc9 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/services/show-topology.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/index.feature @@ -1,5 +1,5 @@ @setupApplicationTest -Feature: dc / services / show-topology: Show Topology tab for Service +Feature: dc / services / show / topology / index: Show Topology tab for Service Scenario: Given a service, the Topology tab should display Given 1 datacenter model with the value "dc1" And 1 node models @@ -35,6 +35,6 @@ Feature: dc / services / show-topology: Show Topology tab for Service dc: dc1 service: service-0 --- - And I don't see topology on the tabs + And I don't see topologyIsVisible on the tabs Then the url should be /dc1/services/service-0/instances diff --git a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/metrics.feature b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/metrics.feature index 4038309243..fdfc9c1d1d 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/metrics.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/metrics.feature @@ -48,7 +48,7 @@ Feature: dc / services / show / topology / metrics service: web --- And I see the "[data-test-sparkline]" element - Scenario: Metrics enabled but serivce source is Consul API Gateway + Scenario: Metrics enabled but service source is Consul API Gateway Given 1 datacenter model with the value "datacenter" And the local datacenter is "datacenter" And 1 service model from yaml diff --git a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/tproxy.feature b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/notices.feature similarity index 78% rename from ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/tproxy.feature rename to ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/notices.feature index 270d46d6af..2c54e91f29 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/tproxy.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/notices.feature @@ -1,5 +1,5 @@ @setupApplicationTest -Feature: dc / services / show / topology / tproxy +Feature: dc / services / show / topology / notices Background: Given 1 datacenter model with the value "datacenter" And the local datacenter is "datacenter" @@ -18,7 +18,7 @@ Feature: dc / services / show / topology / tproxy Name: web Kind: ~ --- - Scenario: Default allow is set to true + Scenario: default ACL policy is set to "allow" Given 1 topology model from yaml --- FilteredByACLs: false @@ -47,7 +47,7 @@ Feature: dc / services / show / topology / tproxy Scenario: A Downstream service has a wildcard intention Given 1 topology model from yaml --- - FilteredByACLs: true + FilteredByACLs: false TransparentProxy: false Downstreams: - Name: db-1 @@ -69,9 +69,34 @@ Feature: dc / services / show / topology / tproxy service: web --- Then the url should be /datacenter/services/web/topology - And I see the tabs.topologyTab.filteredByACLs object And I see the tabs.topologyTab.wildcardIntention object - Scenario: TProxy for a downstream is set to false + Scenario: Response is filtered by ACLs + Given 1 topology model from yaml + --- + FilteredByACLs: true + TransparentProxy: false + Downstreams: + - Name: db-1 + Namespace: default + Datacenter: datacenter + Intention: + Allowed: false + Upstreams: + - Name: db-2 + Namespace: default + Datacenter: datacenter + Intention: + Allowed: false + --- + When I visit the service page for yaml + --- + dc: datacenter + service: web + --- + Then the url should be /datacenter/services/web/topology + And I see the tabs.topologyTab.filteredByACLs object + + Scenario: TProxy for a downstream is set to false and globally false Given 1 topology model from yaml --- FilteredByACLs: false @@ -94,7 +119,7 @@ Feature: dc / services / show / topology / tproxy --- Then the url should be /datacenter/services/web/topology And I see the tabs.topologyTab.notDefinedIntention object - Scenario: TProxy for a downstream is set to true + Scenario: TProxy for a downstream is set to true and globally false Given 1 topology model from yaml --- FilteredByACLs: false diff --git a/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/tproxy-steps.js b/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/index-steps.js similarity index 100% rename from ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/tproxy-steps.js rename to ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/index-steps.js diff --git a/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show-topology-steps.js b/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/notices-steps.js similarity index 86% rename from ui/packages/consul-ui/tests/acceptance/steps/dc/services/show-topology-steps.js rename to ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/notices-steps.js index 06173e1e01..bf28aa4b1a 100644 --- a/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show-topology-steps.js +++ b/ui/packages/consul-ui/tests/acceptance/steps/dc/services/show/topology/notices-steps.js @@ -1,4 +1,4 @@ -import steps from '../../steps'; +import steps from '../../../../steps'; // step definitions that are shared between features should be moved to the // tests/acceptance/steps/steps.js file diff --git a/ui/packages/consul-ui/tests/unit/utils/get-environment-test.js b/ui/packages/consul-ui/tests/unit/utils/get-environment-test.js index 531bb98065..208c1e070e 100644 --- a/ui/packages/consul-ui/tests/unit/utils/get-environment-test.js +++ b/ui/packages/consul-ui/tests/unit/utils/get-environment-test.js @@ -207,4 +207,17 @@ module('Unit | Utility | getEnvironment', function () { env = getEnvironment(config, win, doc); assert.ok(env('CONSUL_NSPACES_ENABLED')); }); + test('it returns the correct dev value when already set via config and is reset to false', function (assert) { + const config = { + environment: 'test', + }; + const doc = { + cookie: 'CONSUL_ACLS_ENABLE=0', + getElementsByTagName: makeGetElementsBy(''), + getElementsByName: makeGetElementsBy('{}'), + querySelector: () => makeOperatorConfig({ ACLsEnabled: true }), + }; + let env = getEnvironment(config, win, doc); + assert.notOk(env('CONSUL_ACLS_ENABLED')); + }); });