From 4ea6ff9433e76dee120a94ad82158c563ad49a92 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Thu, 26 Mar 2020 15:48:16 -0600 Subject: [PATCH 01/15] setup, not complete --- .../vault/cluster/replication-dr-promote/details.js | 6 ++++++ ui/app/mixins/cluster-route.js | 6 ++++++ ui/app/router.js | 4 +++- .../vault/cluster/replication-dr-promote/details.hbs | 9 +++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 ui/app/controllers/vault/cluster/replication-dr-promote/details.js create mode 100644 ui/app/templates/vault/cluster/replication-dr-promote/details.hbs diff --git a/ui/app/controllers/vault/cluster/replication-dr-promote/details.js b/ui/app/controllers/vault/cluster/replication-dr-promote/details.js new file mode 100644 index 0000000000000..3739548974af8 --- /dev/null +++ b/ui/app/controllers/vault/cluster/replication-dr-promote/details.js @@ -0,0 +1,6 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ + // queryParams: ['action'], + // action: '', +}); diff --git a/ui/app/mixins/cluster-route.js b/ui/app/mixins/cluster-route.js index b11940db71425..cf820061a97de 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,11 @@ export default Mixin.create({ return UNSEAL; } if (get(cluster, 'dr.isSecondary')) { + if (transition && transition.targetName === DR_REPLICATION_SECONDARY_DETAILS) { + console.log('here2'); + return DR_REPLICATION_SECONDARY_DETAILS; + } + console.log('here1'); return DR_REPLICATION_SECONDARY; } if (!isAuthed) { diff --git a/ui/app/router.js b/ui/app/router.js index 2682227e02656..916dacbb88292 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/templates/vault/cluster/replication-dr-promote/details.hbs b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs new file mode 100644 index 0000000000000..c57a97ef269f3 --- /dev/null +++ b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs @@ -0,0 +1,9 @@ + +

+ Disaster Recovery secondary is enabled +

+
+ +

blah

+
+ From 2be992e0bd2d3e51e74395bd12df1185c55b72f3 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 30 Mar 2020 10:58:05 -0600 Subject: [PATCH 02/15] update routing --- .../index.js} | 0 ui/app/mixins/cluster-route.js | 5 +++-- .../index.js} | 2 +- .../vault/cluster/replication-dr-promote/details.hbs | 7 +++++-- .../index.hbs} | 4 ++++ 5 files changed, 13 insertions(+), 5 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%) rename ui/app/templates/vault/cluster/{replication-dr-promote.hbs => replication-dr-promote/index.hbs} (94%) 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 cf820061a97de..0c5d422c0e84a 100644 --- a/ui/app/mixins/cluster-route.js +++ b/ui/app/mixins/cluster-route.js @@ -72,10 +72,11 @@ export default Mixin.create({ } if (get(cluster, 'dr.isSecondary')) { if (transition && transition.targetName === DR_REPLICATION_SECONDARY_DETAILS) { - console.log('here2'); return DR_REPLICATION_SECONDARY_DETAILS; } - console.log('here1'); + if (this.router.currentRouteName === DR_REPLICATION_SECONDARY_DETAILS) { + return DR_REPLICATION_SECONDARY_DETAILS; + } return DR_REPLICATION_SECONDARY; } if (!isAuthed) { 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 84de8c5881bec..3d716ad990dbf 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/vault/cluster/replication-dr-promote/details.hbs b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs index c57a97ef269f3..2e48f4c20ab18 100644 --- a/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs +++ b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs @@ -1,9 +1,12 @@

- Disaster Recovery secondary is enabled + Details Page

-

blah

+ MEEP
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 2c4ef45f4a3f0..dd7bedd665f1c 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