From 83592913262f4496ccc8ea9948ed3d951e5e8637 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Tue, 7 Apr 2020 18:57:47 -0600 Subject: [PATCH 01/16] setup styling for delta --- .../replication-page/replication-dashboard.js | 3 -- .../components/replication-dashboard.scss | 13 +++++--- .../templates/components/replication-page.hbs | 2 +- .../replication-dashboard/dashboard.hbs | 4 +-- .../replication-card.hbs | 33 +++++++++++++++++-- .../replication-dr-promote/details.hbs | 10 +++--- 6 files changed, 48 insertions(+), 17 deletions(-) delete mode 100644 ui/app/components/replication-page/replication-dashboard.js diff --git a/ui/app/components/replication-page/replication-dashboard.js b/ui/app/components/replication-page/replication-dashboard.js deleted file mode 100644 index 55706477346c4..0000000000000 --- a/ui/app/components/replication-page/replication-dashboard.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/app/styles/components/replication-dashboard.scss b/ui/app/styles/components/replication-dashboard.scss index dd750f610519d..a4f136f1f9ea4 100644 --- a/ui/app/styles/components/replication-dashboard.scss +++ b/ui/app/styles/components/replication-dashboard.scss @@ -31,6 +31,7 @@ grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr 0.8fr; padding: $spacing-l 0 18px $spacing-l; + line-height: 1.5; // If descriptions are smaller then height is affected, this keeps the cards consistent min-height: 200px; @@ -46,22 +47,22 @@ grid-column-end: 1; grid-row-start: 2; grid-row-end: 2; - - line-height: 1.5; } .grid-item-wal { grid-column-start: 2; grid-column-end: 2; grid-row-start: 2; grid-row-end: 2; - - line-height: 1.5; } .grid-item-stream { grid-column-start: 1; grid-column-end: 1; grid-row-start: 3; grid-row-end: 3; + + .hs-icon { + margin-bottom: 5px; + } } .grid-item-status { grid-column-start: 2; @@ -71,4 +72,8 @@ } } } + + .has-text-highlight { + color: $yellow-500; + } } diff --git a/ui/app/templates/components/replication-page.hbs b/ui/app/templates/components/replication-page.hbs index 9f35a281ce4b4..a81627b8c59e5 100644 --- a/ui/app/templates/components/replication-page.hbs +++ b/ui/app/templates/components/replication-page.hbs @@ -1,6 +1,6 @@ {{yield (hash header=(component 'replication-page/replication-header' model=model) - toggle=(component 'replication-page/replication-toggle' model=model) + toggle=(component 'replication-page/replication-toggle') dashboard=(component 'replication-page/replication-dashboard/dashboard' model=model) )}} {{!-- ARG TODO, not all of these need model or everything on it. Clean up --}} diff --git a/ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs b/ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs index 9d69ecc093d33..4d66b0ddd6fb1 100644 --- a/ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs +++ b/ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs @@ -1,8 +1,8 @@

Primary Cluster

-

If you set a primary_cluster_addr when enabling replication, it will appear here.

+

If you set a primary_cluster_addr when enabling replication, it will appear here.

{{#if model.dr.primaryClusterAddr}} - {{model.dr.primaryClusterAddr}} + {{model.dr.primaryClusterAddr}} {{else}} no known primary cluster address {{/if}} diff --git a/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs b/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs index 0f1f8e3c4a5fb..286b090d52297 100644 --- a/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs +++ b/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs @@ -5,9 +5,36 @@

{{description_1}}

+ {{!-- Check if card is for showing Delta information --}} + {{#if @property_3}} + {{property_1}} +

{{metric_1}}

+ {{else}} + {{property_2}} +

{{description_2}}

+ {{/if}} +
+ + {{#if @property_3}} +

{{metric_3}} + +

+ {{else}} +

{{metric_1}}

+ {{/if}} + + {{#if @property_3}} +
{{property_2}} -

{{description_2}}

+

{{metric_2}}

-

{{metric_1}}

-

{{metric_2}}

+ {{else}} +

{{metric_2}}

+ {{/if}} + 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 3bf4132aaa67e..68a9d6363670c 100644 --- a/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs +++ b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs @@ -23,10 +23,12 @@ @title="Write-Ahead Logs (WALs)" @property_1="Last Remote WAL" @property_2="Last WAL entry from primary" - @description_1="Index of the last Write-Ahead Logs (WAL) entry written on the local storage." - @description_2="Index of the last WAL entry from the primary." - @metric_1={{if model.dr.lastRemoteWAL model.dr.lastRemoteWAL 'unknown' }} - @metric_2={{if model.dr.lastWAL model.dr.lastWAL 'unknown'}} + @property_3="Delta" + @description_1="The difference between the last remote WAL and the last WAL entry from the primary." + @metric_1={{if model.dr.lastRemoteWAL model.dr.lastRemoteWAL '0' }} + @metric_2={{if model.dr.lastWAL model.dr.lastWAL '0'}} + {{!-- angel calc using computed in controller --}} + @metric_3=0 /> Date: Wed, 8 Apr 2020 12:33:48 -0600 Subject: [PATCH 02/16] clean up --- .../components/replication-dashboard.scss | 7 +++++- .../templates/components/replication-page.hbs | 2 +- ...ard.hbs => replication-card-secondary.hbs} | 9 +++++-- ...ashboard.hbs => replication-dashboard.hbs} | 0 .../replication-page/replication-header.hbs | 3 --- .../replication-dr-promote/details.hbs | 25 +++++++++++-------- .../cluster/replication-dr-promote/index.hbs | 4 --- 7 files changed, 28 insertions(+), 22 deletions(-) rename ui/app/templates/components/replication-page/replication-dashboard/{replication-card.hbs => replication-card-secondary.hbs} (80%) rename ui/app/templates/components/replication-page/replication-dashboard/{dashboard.hbs => replication-dashboard.hbs} (100%) diff --git a/ui/app/styles/components/replication-dashboard.scss b/ui/app/styles/components/replication-dashboard.scss index a4f136f1f9ea4..388a58ff28f3d 100644 --- a/ui/app/styles/components/replication-dashboard.scss +++ b/ui/app/styles/components/replication-dashboard.scss @@ -34,7 +34,12 @@ line-height: 1.5; // If descriptions are smaller then height is affected, this keeps the cards consistent - min-height: 200px; + min-height: 220px; + + @include until(1320px) { + // prevent an issue with the card descriptions wrapping and expanding height + min-height: 250px; + } .grid-item-title { grid-column-start: 1; diff --git a/ui/app/templates/components/replication-page.hbs b/ui/app/templates/components/replication-page.hbs index a81627b8c59e5..f9509d228cb26 100644 --- a/ui/app/templates/components/replication-page.hbs +++ b/ui/app/templates/components/replication-page.hbs @@ -1,6 +1,6 @@ {{yield (hash header=(component 'replication-page/replication-header' model=model) toggle=(component 'replication-page/replication-toggle') - dashboard=(component 'replication-page/replication-dashboard/dashboard' model=model) + dashboard=(component 'replication-page/replication-dashboard/replication-dashboard' model=model) )}} {{!-- ARG TODO, not all of these need model or everything on it. Clean up --}} diff --git a/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs b/ui/app/templates/components/replication-page/replication-dashboard/replication-card-secondary.hbs similarity index 80% rename from ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs rename to ui/app/templates/components/replication-page/replication-dashboard/replication-card-secondary.hbs index 286b090d52297..3f5ccf56e7e96 100644 --- a/ui/app/templates/components/replication-page/replication-dashboard/replication-card.hbs +++ b/ui/app/templates/components/replication-page/replication-dashboard/replication-card-secondary.hbs @@ -1,8 +1,13 @@

{{title}}

- {{property_1}} -

{{description_1}}

+ {{#if property_3}} + {{property_3}} +

{{description_3}}

+ {{else}} + {{property_1}} +

{{description_1}}

+ {{/if}}
{{!-- Check if card is for showing Delta information --}} diff --git a/ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs b/ui/app/templates/components/replication-page/replication-dashboard/replication-dashboard.hbs similarity index 100% rename from ui/app/templates/components/replication-page/replication-dashboard/dashboard.hbs rename to ui/app/templates/components/replication-page/replication-dashboard/replication-dashboard.hbs diff --git a/ui/app/templates/components/replication-page/replication-header.hbs b/ui/app/templates/components/replication-page/replication-header.hbs index b115f07163e97..6bbb3794b1c7d 100644 --- a/ui/app/templates/components/replication-page/replication-header.hbs +++ b/ui/app/templates/components/replication-page/replication-header.hbs @@ -1,5 +1,4 @@ {{!-- DR Secondary has a different Nav Header with access only to the Status menu --}} -{{!-- ARG TODO all links are hard coded as well as titles right now, they will need to by dynamic --}} {{#if (and (eq model.rm.mode 'dr') (eq model.dr.mode 'secondary') )}} @@ -14,7 +13,6 @@ {{/if}} - {{#key-value-header @@ -49,7 +47,6 @@
{{!-- ARG TODO connection state is likely wrong here, waiting for reply from RFC --}} -

{{if data.dr.state data.dr.state 'unknown'}}

-

{{if data.drStateDisplay data.drStateDisplay 'unknown'}}

+

{{state}}

+

{{connection}}

{{else}}

{{title}} @@ -42,12 +42,12 @@

last_wal -

{{if data.dr.lastWAL (format-number data.dr.lastWAL) '0'}}

+

{{lastWAL}}

{{format-number delta}}

last_remote_wal -

{{if data.dr.lastRemoteWAL (format-number data.dr.lastRemoteWAL) '0'}}

+

{{lastRemoteWAL}}

{{/if}}
From 2412f012494a57d995cd869a7b155435fc605c79 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 13 Apr 2020 14:42:11 -0600 Subject: [PATCH 13/16] attempting to fix test --- ui/lib/core/addon/components/replication-secondary-card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/lib/core/addon/components/replication-secondary-card.js b/ui/lib/core/addon/components/replication-secondary-card.js index 89b691096deb5..6e9d607b1a49c 100644 --- a/ui/lib/core/addon/components/replication-secondary-card.js +++ b/ui/lib/core/addon/components/replication-secondary-card.js @@ -13,7 +13,7 @@ export default Component.extend({ delta: computed('data', function() { let dr = this.data.dr; let lastWAL = dr && dr.lastWAL ? dr.lastWAL : 0; - let lastRemoteWAL = dr.lastRemoteWAL ? dr.lastRemoteWAL : 0; + let lastRemoteWAL = dr && dr.lastRemoteWAL ? dr.lastRemoteWAL : 0; return Math.abs(lastWAL - lastRemoteWAL); }), From 4811cfb5130b3b2f20f578d6bcccfcd7a1adcc5b Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 13 Apr 2020 15:53:16 -0600 Subject: [PATCH 14/16] move to computed components --- .../cluster/replication-dr-promote/details.hbs | 4 ---- .../components/replication-secondary-card.js | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) 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 4adc2edb21619..988c3db0174d6 100644 --- a/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs +++ b/ui/app/templates/vault/cluster/replication-dr-promote/details.hbs @@ -13,14 +13,10 @@ diff --git a/ui/lib/core/addon/components/replication-secondary-card.js b/ui/lib/core/addon/components/replication-secondary-card.js index 6e9d607b1a49c..6baeca9073151 100644 --- a/ui/lib/core/addon/components/replication-secondary-card.js +++ b/ui/lib/core/addon/components/replication-secondary-card.js @@ -10,6 +10,21 @@ import layout from '../templates/components/replication-secondary-card'; export default Component.extend({ layout, + state: computed('data', function() { + let dr = this.data.dr; + return dr.state ? dr.state : 'unknown'; + }), + connection: computed('data', function() { + return this.data.drStateDisplay ? this.data.drStateDisplay : 'unknown'; + }), + lastWAL: computed('data', function() { + let dr = this.data.dr; + return dr.lastWAL ? dr.lastWAL : '0'; + }), + lastRemoteWAL: computed('data', function() { + let dr = this.data.dr; + return dr.lastRemoteWAL ? dr.lastRemoteWAL : '0'; + }), delta: computed('data', function() { let dr = this.data.dr; let lastWAL = dr && dr.lastWAL ? dr.lastWAL : 0; From 731b5b7167505d8ada645be88e8fd069f6fd8671 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 13 Apr 2020 16:17:26 -0600 Subject: [PATCH 15/16] fix test error --- .../addon/components/replication-secondary-card.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ui/lib/core/addon/components/replication-secondary-card.js b/ui/lib/core/addon/components/replication-secondary-card.js index 6baeca9073151..3a91b2c8fd3ef 100644 --- a/ui/lib/core/addon/components/replication-secondary-card.js +++ b/ui/lib/core/addon/components/replication-secondary-card.js @@ -19,17 +19,13 @@ export default Component.extend({ }), lastWAL: computed('data', function() { let dr = this.data.dr; - return dr.lastWAL ? dr.lastWAL : '0'; + return dr && dr.lastWAL ? dr.lastWAL : 0; }), lastRemoteWAL: computed('data', function() { let dr = this.data.dr; - return dr.lastRemoteWAL ? dr.lastRemoteWAL : '0'; + return dr && dr.lastRemoteWAL ? dr.lastRemoteWAL : 0; }), delta: computed('data', function() { - let dr = this.data.dr; - let lastWAL = dr && dr.lastWAL ? dr.lastWAL : 0; - let lastRemoteWAL = dr && dr.lastRemoteWAL ? dr.lastRemoteWAL : 0; - - return Math.abs(lastWAL - lastRemoteWAL); + return Math.abs(this.get('lastWAL') - this.get('lastRemoteWAL')); }), }); From 8b981fd5bd7e2113080e894740f2e50a68378575 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 13 Apr 2020 17:11:37 -0600 Subject: [PATCH 16/16] fix state of null error --- ui/lib/core/addon/components/replication-secondary-card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/lib/core/addon/components/replication-secondary-card.js b/ui/lib/core/addon/components/replication-secondary-card.js index 3a91b2c8fd3ef..99579db697717 100644 --- a/ui/lib/core/addon/components/replication-secondary-card.js +++ b/ui/lib/core/addon/components/replication-secondary-card.js @@ -12,7 +12,7 @@ export default Component.extend({ layout, state: computed('data', function() { let dr = this.data.dr; - return dr.state ? dr.state : 'unknown'; + return dr && dr.state ? dr.state : 'unknown'; }), connection: computed('data', function() { return this.data.drStateDisplay ? this.data.drStateDisplay : 'unknown';