From df52cd0e9110ae5262e7b7bc2b3b29366822af8f Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 18:13:05 -0700 Subject: [PATCH 1/7] only show primary_cluster_addr for primary --- .../addon/templates/components/replication-table-rows.hbs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/lib/core/addon/templates/components/replication-table-rows.hbs b/ui/lib/core/addon/templates/components/replication-table-rows.hbs index 595acf2b0f4c..9c7b38848073 100644 --- a/ui/lib/core/addon/templates/components/replication-table-rows.hbs +++ b/ui/lib/core/addon/templates/components/replication-table-rows.hbs @@ -5,11 +5,13 @@ label='secondary_id' helperText="The ID of the secondary activation token used to enable replication." value=secondaryId}} - {{/if}} - {{info-table-row + {{else}} + {{info-table-row label='primary_cluster_addr' helperText='The configuration of the cluster. This was set when replication was enabled.' - value=primaryClusterAddr}} + value=primaryClusterAddr + }} + {{/if}} {{info-table-row label="Merkle root index" helperText="A snapshot in time of the merkle tree's root hash. Changes on every update to storage." From 4a45e75b3dedc8f5cfc570c48ad46f28e84bc024 Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 19:11:42 -0700 Subject: [PATCH 2/7] fix overflow on replication index --- .../components/replication-mode-summary.js | 2 +- .../components/replication-mode-summary.hbs | 100 ++++++++++-------- 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/ui/lib/core/addon/components/replication-mode-summary.js b/ui/lib/core/addon/components/replication-mode-summary.js index ad5b24daeee0..8b0126898761 100644 --- a/ui/lib/core/addon/components/replication-mode-summary.js +++ b/ui/lib/core/addon/components/replication-mode-summary.js @@ -15,7 +15,7 @@ export default Component.extend({ version: service(), router: service(), namespace: service(), - classNameBindings: ['isMenu::box', 'isMenu::level'], + classNameBindings: ['isMenu::box'], attributeBindings: ['href', 'target'], display: 'banner', isMenu: equal('display', 'menu'), diff --git a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs index 6fe04e678867..293622be2fae 100644 --- a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs +++ b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs @@ -1,4 +1,4 @@ -{{#if (eq display 'menu')}} +{{#if isMenu}}
{{#if replicationUnsupported}} @@ -53,59 +53,65 @@
{{else}} -
+
+
- {{#if (and (eq mode 'performance') (not (has-feature "Performance Replication")))}} -

- Performance Replication is a feature of Vault Enterprise Premium. -

-

- - Learn more - - -

- {{else if replicationEnabled}} -
+ {{#if (and (eq mode 'performance') (not (has-feature 'Performance Replication')))}} +

+ Performance Replication is a feature of Vault Enterprise Premium. +

+

+ + Learn more + + +

+ {{else if replicationEnabled}} +
Enabled -
- - {{capitalize modeForUrl}} - - {{#if secondaryId}} - - - {{secondaryId}} - - - {{/if}} - + + + {{capitalize modeForUrl}} + + {{#if secondaryId}} + - {{clusterIdDisplay}} + {{secondaryId}} - {{else}} -

- {{#if (eq mode 'dr')}} - {{model.replicationModeForDisplay}} is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). - {{else}} - {{model.replicationModeForDisplay}} Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. - {{/if}} -

{{/if}} -
-
-
- {{#if replicationDisabled}} - {{#link-to "mode.index" cluster.name mode class="button is-primary"}} - Enable - {{/link-to}} + + + {{clusterIdDisplay}} + + {{else}} - {{get (cluster-states modeState) "display"}} +

+ {{#if (eq mode 'dr')}} + {{model.replicationModeForDisplay}} + is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). + {{else}} + {{model.replicationModeForDisplay}} + Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. + {{/if}} +

{{/if}}
+
+
+ {{#if replicationDisabled}} + {{#link-to 'mode.index' cluster.name mode class='button is-primary'}} + Enable + {{/link-to}} + {{else}} + {{#link-to 'mode.index' cluster.name mode class="button is-secondary"}} + Details + {{/link-to}} + {{/if}} +
+
{{/if}} From 8793d10da65ea617c4fdf9b748770a58cc1f2f5f Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 19:12:04 -0700 Subject: [PATCH 3/7] remove display from cluster-states because it is not used anywhere --- ui/lib/core/addon/helpers/cluster-states.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/lib/core/addon/helpers/cluster-states.js b/ui/lib/core/addon/helpers/cluster-states.js index 3b0c52421aa0..6b149af36b34 100644 --- a/ui/lib/core/addon/helpers/cluster-states.js +++ b/ui/lib/core/addon/helpers/cluster-states.js @@ -17,25 +17,21 @@ export const CLUSTER_STATES = { }, 'stream-wals': { glyph: 'check-circle-outline', - display: 'Streaming', isOk: true, isSyncing: false, }, 'merkle-diff': { glyph: 'android-sync', - display: 'Determining sync status', isOk: true, isSyncing: true, }, connecting: { glyph: 'android-sync', - display: 'Streaming', isOk: true, isSyncing: true, }, 'merkle-sync': { glyph: 'android-sync', - display: 'Syncing', isOk: true, isSyncing: true, }, @@ -59,7 +55,6 @@ export const CLUSTER_STATES = { export function clusterStates([state]) { const defaultDisplay = { glyph: '', - display: '', isOk: null, isSyncing: null, }; From 244fcce01b116bc27741a260b15ca461ab39db51 Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 19:32:02 -0700 Subject: [PATCH 4/7] fix missing replication mode from description --- .../addon/templates/components/replication-mode-summary.hbs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs index 293622be2fae..de94ca67a844 100644 --- a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs +++ b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs @@ -92,11 +92,9 @@ {{else}}

{{#if (eq mode 'dr')}} - {{model.replicationModeForDisplay}} - is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). + DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). {{else}} - {{model.replicationModeForDisplay}} - Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. + Performance Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. {{/if}}

{{/if}} From 4df31e45cdc593808c976d034989cb4cf2cd312b Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 19:42:30 -0700 Subject: [PATCH 5/7] add comments --- .../addon/templates/components/replication-mode-summary.hbs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs index de94ca67a844..cfa2274ff87e 100644 --- a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs +++ b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs @@ -1,4 +1,5 @@ {{#if isMenu}} +{{!-- this is the status menu --}}
{{#if replicationUnsupported}} @@ -53,6 +54,7 @@
{{else}} +{{!-- this is the replication index page --}}
From d2ba8539099f9824c2b6e71050d81c543a4bffcb Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 19:51:39 -0700 Subject: [PATCH 6/7] use helper to consolidate replication descriptions --- .../addon/helpers/replication-mode-description.js | 14 ++++++++++++++ .../components/replication-mode-summary.hbs | 6 +----- .../app/helpers/replication-mode-description.js | 5 +++++ .../templates/components/replication-summary.hbs | 12 ++++-------- 4 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 ui/lib/core/addon/helpers/replication-mode-description.js create mode 100644 ui/lib/core/app/helpers/replication-mode-description.js diff --git a/ui/lib/core/addon/helpers/replication-mode-description.js b/ui/lib/core/addon/helpers/replication-mode-description.js new file mode 100644 index 000000000000..014ed5d92bd5 --- /dev/null +++ b/ui/lib/core/addon/helpers/replication-mode-description.js @@ -0,0 +1,14 @@ +import { helper as buildHelper } from '@ember/component/helper'; + +const REPLICATION_MODE_DESCRIPTIONS = { + dr: + 'Disaster Recovery Replication is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests until they are elected and become a new primary.', + performance: + 'Performance Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled.', +}; + +export function replicationModeDescription([mode]) { + return REPLICATION_MODE_DESCRIPTIONS[mode]; +} + +export default buildHelper(replicationModeDescription); diff --git a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs index cfa2274ff87e..774f87c037d0 100644 --- a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs +++ b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs @@ -93,11 +93,7 @@ {{else}}

- {{#if (eq mode 'dr')}} - DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). - {{else}} - Performance Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. - {{/if}} + {{replication-mode-description mode}}

{{/if}}
diff --git a/ui/lib/core/app/helpers/replication-mode-description.js b/ui/lib/core/app/helpers/replication-mode-description.js new file mode 100644 index 000000000000..40186c1a7fe6 --- /dev/null +++ b/ui/lib/core/app/helpers/replication-mode-description.js @@ -0,0 +1,5 @@ +export { + default, + replicationModeDescription, + REPLICATION_MODE_DESCRIPTIONS, +} from 'core/helpers/replication-mode-description'; diff --git a/ui/lib/replication/addon/templates/components/replication-summary.hbs b/ui/lib/replication/addon/templates/components/replication-summary.hbs index 3be2b984c127..2e512fd78e58 100644 --- a/ui/lib/replication/addon/templates/components/replication-summary.hbs +++ b/ui/lib/replication/addon/templates/components/replication-summary.hbs @@ -40,8 +40,7 @@ Disaster Recovery (DR) Replication

- DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward - service requests (until they are elected and become a new primary). + {{replication-mode-description 'dr'}}

{{else if (eq initialReplicationMode 'performance')}}

@@ -54,8 +53,7 @@

{{else}}

- Performance replication scales workloads horizontally across clusters to make requests faster. Local - secondaries handle read requests but forward writes to the primary to be handled. + {{replication-mode-description 'performance'}}

{{/if}} {{/if}} @@ -76,8 +74,7 @@ Disaster Recovery (DR)

- DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward - service requests (until they are elected and become a new primary). + {{replication-mode-description 'dr'}}

@@ -105,8 +102,7 @@

{{else}}

- Performance Replication scales workloads horizontally across clusters to make requests faster. Local - secondaries handle read requests but forward writes to the primary to be handled. + {{replication-mode-description 'performance'}}

{{/if}}
From 7cb5adfb235b5c5ea1c04d71ed1a7b7ca8226d4d Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Mon, 8 Jun 2020 20:16:50 -0700 Subject: [PATCH 7/7] fix text wrapping on medium screen sizes --- .../components/replication-mode-summary.scss | 11 +++++++ ui/app/styles/core.scss | 1 + .../components/replication-mode-summary.hbs | 33 ++++++++++--------- 3 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 ui/app/styles/components/replication-mode-summary.scss diff --git a/ui/app/styles/components/replication-mode-summary.scss b/ui/app/styles/components/replication-mode-summary.scss new file mode 100644 index 000000000000..27ba8a577026 --- /dev/null +++ b/ui/app/styles/components/replication-mode-summary.scss @@ -0,0 +1,11 @@ +.replication-description { + flex-shrink: 1; + + .title { + margin-bottom: $spacing-xs; + } + + .detail-tags { + margin-bottom: $spacing-m; + } +} diff --git a/ui/app/styles/core.scss b/ui/app/styles/core.scss index 1a55e8abd4dc..1a91cc109b87 100644 --- a/ui/app/styles/core.scss +++ b/ui/app/styles/core.scss @@ -83,6 +83,7 @@ @import './components/replication-dashboard'; @import './components/replication-doc-link'; @import './components/replication-header'; +@import './components/replication-mode-summary'; @import './components/replication-page'; @import './components/replication-primary-card'; @import './components/replication-summary'; diff --git a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs index 774f87c037d0..014897c334ab 100644 --- a/ui/lib/core/addon/templates/components/replication-mode-summary.hbs +++ b/ui/lib/core/addon/templates/components/replication-mode-summary.hbs @@ -56,7 +56,7 @@ {{else}} {{!-- this is the replication index page --}}
-
+
{{#if (and (eq mode 'performance') (not (has-feature 'Performance Replication')))}}

@@ -76,26 +76,27 @@

Enabled
- - {{capitalize modeForUrl}} - - {{#if secondaryId}} +
+ + {{capitalize modeForUrl}} + + {{#if secondaryId}} + + + {{secondaryId}} + + + {{/if}} - {{secondaryId}} + {{clusterIdDisplay}} - {{/if}} - - - {{clusterIdDisplay}} - - - {{else}} -

- {{replication-mode-description mode}} -

+
{{/if}} +

+ {{replication-mode-description mode}} +