diff --git a/ui/app/components/namespace-link.js b/ui/app/components/namespace-link.js index 7b59935560..399f6f5436 100644 --- a/ui/app/components/namespace-link.js +++ b/ui/app/components/namespace-link.js @@ -1,3 +1,4 @@ +import Ember from 'ember'; import { inject as service } from '@ember/service'; import { alias } from '@ember/object/computed'; import Component from '@ember/component'; @@ -30,4 +31,23 @@ export default Component.extend({ isCurrentNamespace: computed('targetNamespace', 'currentNamespace', function() { return this.currentNamespace === this.targetNamespace; }), + + get namespaceLink() { + if (Ember.testing) { + if (this.normalizedNamespace) { + return `/ui/vault/secrets?namespace=${this.normalizedNamespace}`; + } + return `/ui/vault/secrets`; + } + + let origin = + window.location.protocol + + '//' + + window.location.hostname + + (window.location.port ? ':' + window.location.port : ''); + + if (!this.normalizedNamespace) return `${origin}/ui/vault/secrets`; + // The full URL/origin is required so that the page is reloaded. + return `${origin}/ui/vault/secrets?namespace=${encodeURIComponent(this.normalizedNamespace)}`; + }, }); diff --git a/ui/app/templates/components/namespace-link.hbs b/ui/app/templates/components/namespace-link.hbs index a999b0d3c1..82a892f119 100644 --- a/ui/app/templates/components/namespace-link.hbs +++ b/ui/app/templates/components/namespace-link.hbs @@ -1,5 +1,5 @@ diff --git a/ui/app/templates/vault/cluster/access/namespaces/index.hbs b/ui/app/templates/vault/cluster/access/namespaces/index.hbs index 75d7282e88..4a1bf1b9f9 100644 --- a/ui/app/templates/vault/cluster/access/namespaces/index.hbs +++ b/ui/app/templates/vault/cluster/access/namespaces/index.hbs @@ -38,9 +38,9 @@ {{#with (concat currentNamespace (if currentNamespace "/") list.item.id) as |targetNamespace|}} {{#if (contains targetNamespace accessibleNamespaces)}}
  • - + Switch to Namespace - +
  • {{/if}} {{/with}} diff --git a/ui/package.json b/ui/package.json index a33897afd8..dec520b00e 100644 --- a/ui/package.json +++ b/ui/package.json @@ -99,7 +99,6 @@ "ember-engines": "^0.8.3", "ember-export-application-global": "^2.0.1", "ember-fetch": "^8.0.2", - "ember-href-to": "^4.1.0", "ember-inflector": "^3.0.0", "ember-link-action": "^1.0.0", "ember-load-initializers": "^2.1.2", diff --git a/ui/yarn.lock b/ui/yarn.lock index fa530a7f00..b15799bf3e 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -8716,13 +8716,6 @@ ember-get-config@^0.2.2: broccoli-file-creator "^1.1.1" ember-cli-babel "^6.3.0" -ember-href-to@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ember-href-to/-/ember-href-to-4.1.0.tgz#daa8b398bc5a51ba3ba5ff736e099f0a0d010b7b" - integrity sha512-h8xSzt9lQAUzk4JvXNnZjRj29hOWKo92VIHzH68io13UurDBaMmJ4WtXa0iy/awlSFs6h8BwpEWQeaCYIZDRuQ== - dependencies: - ember-cli-babel "^7.13.2" - "ember-inflector@^2.0.0 || ^3.0.0", ember-inflector@^3.0.0, ember-inflector@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/ember-inflector/-/ember-inflector-3.0.1.tgz#04be6df4d7e4000f6d6bd70787cdc995f77be4ab"