diff --git a/ui/app/adapters/cluster.js b/ui/app/adapters/cluster.js index 2552a72a68..5a8984ec33 100644 --- a/ui/app/adapters/cluster.js +++ b/ui/app/adapters/cluster.js @@ -169,7 +169,7 @@ export default ApplicationAdapter.extend({ urlFor(endpoint) { if (!ENDPOINTS.includes(endpoint)) { throw new Error( - `Calls to a ${endpoint} endpoint are not currently allowed in the vault cluster adapater` + `Calls to a ${endpoint} endpoint are not currently allowed in the vault cluster adapter` ); } return `${this.buildURL()}/${endpoint}`; diff --git a/ui/lib/core/addon/mixins/replication-actions.js b/ui/lib/core/addon/mixins/replication-actions.js index 10ab7e2ff4..26fe1effef 100644 --- a/ui/lib/core/addon/mixins/replication-actions.js +++ b/ui/lib/core/addon/mixins/replication-actions.js @@ -13,7 +13,6 @@ export default Mixin.create({ store: service(), router: service(), loading: or('save.isRunning', 'submitSuccess.isRunning'), - onEnable() {}, onDisable() {}, onPromote() {}, submitHandler: task(function* (action, clusterMode, data, event) { @@ -53,10 +52,9 @@ export default Mixin.create({ return yield this.submitSuccess.perform(resp, action, clusterMode); }).drop(), - submitSuccess: task(function* (resp, action, mode) { + submitSuccess: task(function* (resp, action) { + // enable action is handled separately in EnableReplicationForm component const cluster = this.cluster; - const replicationMode = this.selectedReplicationMode || this.replicationMode; - const store = this.store; if (!cluster) { return; } @@ -75,20 +73,6 @@ export default Mixin.create({ if (this.reset) { this.reset(); } - if (action === 'enable') { - // do something to show model is pending - cluster.set( - replicationMode, - store.createRecord('replication-attributes', { - mode: 'bootstrapping', - }) - ); - if (mode === 'secondary' && replicationMode === 'performance') { - // if we're enabing a secondary, there could be mount filtering, - // so we should unload all of the backends - store.unloadAll('secret-engine'); - } - } try { yield cluster.reload(); } catch (e) { @@ -101,11 +85,6 @@ export default Mixin.create({ if (action === 'promote') { yield this.onPromote(); } - if (action === 'enable') { - /// onEnable is a method available only to route vault.cluster.replication.index - // if action 'enable' is called from vault.cluster.replication.mode.index this method is not called - yield this.onEnable(replicationMode, mode); - } }).drop(), submitError(e) { diff --git a/ui/lib/replication/addon/components/enable-replication-form.hbs b/ui/lib/replication/addon/components/enable-replication-form.hbs new file mode 100644 index 0000000000..8f95d7ae69 --- /dev/null +++ b/ui/lib/replication/addon/components/enable-replication-form.hbs @@ -0,0 +1,178 @@ +{{! + Copyright (c) HashiCorp, Inc. + SPDX-License-Identifier: BUSL-1.1 +~}} + +
+ + +
+ +
+
+ +
+ {{#if (eq this.data.mode "secondary")}} + + {{/if}} +
+ {{#if (eq this.data.mode "primary")}} + {{#if @canEnablePrimary}} +
+ +
+ +
+

+ Overrides the cluster address that the primary gives to secondary nodes. +

+
+ {{else}} +

+ The token you are using is not authorized to enable primary replication. +

+ {{/if}} + {{else}} + {{#if @canEnableSecondary}} + {{#if (and (eq @replicationMode "dr") this.performanceReplicationEnabled (has-feature "Performance Replication"))}} +
+ + {{#if this.showExplanation}} +

+ When running as a DR Secondary Vault is read only. For this reason, we don't allow other Replication modes to + operate at the same time. This cluster is also currently operating as a Performance + {{capitalize @performanceMode}}. +

+ {{/if}} +
+ {{else}} +
+ +
+