From e51ba172c1eee3a8bba6012061cd0a4a23d59e21 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Wed, 1 Apr 2020 08:52:10 -0600 Subject: [PATCH 01/43] Sidebranch: add new route on DR secondary (#8640) * setup, not complete * update routing * clean up * add test * add link from status menu * clean up * fixes per pr comments * revert back to two if statements due to refresh bug --- .../index.js} | 0 ui/app/mixins/cluster-route.js | 8 +++++++ ui/app/router.js | 4 +++- .../index.js} | 2 +- ui/app/templates/partials/status/cluster.hbs | 24 +++++++++++++++++++ .../replication-dr-promote/details.hbs | 13 ++++++++++ .../index.hbs} | 4 ++++ .../replication/dr/secondary-test.js | 18 ++++++++++++++ 8 files changed, 71 insertions(+), 2 deletions(-) rename ui/app/controllers/vault/cluster/{replication-dr-promote.js => replication-dr-promote/index.js} (100%) rename ui/app/routes/vault/cluster/{replication-dr-promote.js => replication-dr-promote/index.js} (83%) create mode 100644 ui/app/templates/vault/cluster/replication-dr-promote/details.hbs rename ui/app/templates/vault/cluster/{replication-dr-promote.hbs => replication-dr-promote/index.hbs} (94%) create mode 100644 ui/tests/acceptance/replication/dr/secondary-test.js diff --git a/ui/app/controllers/vault/cluster/replication-dr-promote.js b/ui/app/controllers/vault/cluster/replication-dr-promote/index.js similarity index 100% rename from ui/app/controllers/vault/cluster/replication-dr-promote.js rename to ui/app/controllers/vault/cluster/replication-dr-promote/index.js diff --git a/ui/app/mixins/cluster-route.js b/ui/app/mixins/cluster-route.js index b11940db7142..b16695627493 100644 --- a/ui/app/mixins/cluster-route.js +++ b/ui/app/mixins/cluster-route.js @@ -9,6 +9,7 @@ const CLUSTER = 'vault.cluster'; const CLUSTER_INDEX = 'vault.cluster.index'; const OIDC_CALLBACK = 'vault.cluster.oidc-callback'; const DR_REPLICATION_SECONDARY = 'vault.cluster.replication-dr-promote'; +const DR_REPLICATION_SECONDARY_DETAILS = 'vault.cluster.replication-dr-promote.details'; const EXCLUDED_REDIRECT_URLS = ['/vault/logout']; export { INIT, UNSEAL, AUTH, CLUSTER, CLUSTER_INDEX, DR_REPLICATION_SECONDARY }; @@ -70,6 +71,13 @@ export default Mixin.create({ return UNSEAL; } if (get(cluster, 'dr.isSecondary')) { + if (transition && transition.targetName === DR_REPLICATION_SECONDARY_DETAILS) { + return DR_REPLICATION_SECONDARY_DETAILS; + } + if (this.router.currentRouteName === DR_REPLICATION_SECONDARY_DETAILS) { + return DR_REPLICATION_SECONDARY_DETAILS; + } + return DR_REPLICATION_SECONDARY; } if (!isAuthed) { diff --git a/ui/app/router.js b/ui/app/router.js index 2682227e0265..916dacbb8829 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -127,7 +127,9 @@ Router.map(function() { this.route('show', { path: '/:policy_name' }); this.route('edit', { path: '/:policy_name/edit' }); }); - this.route('replication-dr-promote'); + this.route('replication-dr-promote', function() { + this.route('details'); + }); if (config.addRootMounts) { config.addRootMounts.call(this); } diff --git a/ui/app/routes/vault/cluster/replication-dr-promote.js b/ui/app/routes/vault/cluster/replication-dr-promote/index.js similarity index 83% rename from ui/app/routes/vault/cluster/replication-dr-promote.js rename to ui/app/routes/vault/cluster/replication-dr-promote/index.js index 84de8c5881be..3d716ad990db 100644 --- a/ui/app/routes/vault/cluster/replication-dr-promote.js +++ b/ui/app/routes/vault/cluster/replication-dr-promote/index.js @@ -1,5 +1,5 @@ import { inject as service } from '@ember/service'; -import Base from './cluster-route-base'; +import Base from '../cluster-route-base'; export default Base.extend({ replicationMode: service(), diff --git a/ui/app/templates/partials/status/cluster.hbs b/ui/app/templates/partials/status/cluster.hbs index 150e8dd0daac..b084a56d639c 100644 --- a/ui/app/templates/partials/status/cluster.hbs +++ b/ui/app/templates/partials/status/cluster.hbs @@ -62,6 +62,30 @@
{{/if}} + {{else}} + {{#if (has-permission 'status' routeParams='replication')}} + +
+ {{/if}} {{/if}} {{/if}} {{/unless}} diff --git a/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs new file mode 100644 index 000000000000..1d529aba03e1 --- /dev/null +++ b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs @@ -0,0 +1,13 @@ + + +

+ Disaster Recovery +

+
+ + MEEP + + +
\ No newline at end of file diff --git a/ui/app/templates/vault/cluster/replication-dr-promote.hbs b/ui/app/templates/vault/cluster/replication-dr-promote/index.hbs similarity index 94% rename from ui/app/templates/vault/cluster/replication-dr-promote.hbs rename to ui/app/templates/vault/cluster/replication-dr-promote/index.hbs index 2c4ef45f4a3f..53d37f2faf84 100644 --- a/ui/app/templates/vault/cluster/replication-dr-promote.hbs +++ b/ui/app/templates/vault/cluster/replication-dr-promote/index.hbs @@ -3,6 +3,10 @@

Disaster Recovery secondary is enabled

+ MEEP +