Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/app/models/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default DS.Model.extend({
// this service exposes what mode the UI is currently viewing
// replicationAttrs will then return the relevant `replication-attributes` fragment
rm: service('replication-mode'),
drMode: alias('dr.mode'),
replicationMode: alias('rm.mode'),
replicationModeForDisplay: computed('replicationMode', function() {
return this.replicationMode === 'dr' ? 'Disaster Recovery' : 'Performance';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { gt } from '@ember/object/computed';
import { camelize } from '@ember/string';
import Component from '@ember/component';
import { get, computed } from '@ember/object';
import layout from '../templates/components/shamir-flow';

const DEFAULTS = {
key: null,
Expand All @@ -26,6 +27,7 @@ export default Component.extend(DEFAULTS, {
buttonText: 'Submit',
thresholdPath: 'required',
generateAction: false,
layout,

init() {
this._super(...arguments);
Expand Down
6 changes: 3 additions & 3 deletions ui/lib/core/addon/templates/components/replication-header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{/if}}
<PageHeader as |p|>
<p.top>
{{#if (not isSummaryDashboard) }}
{{#if (not (or isSummaryDashboard isSecondary)) }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If is drSecondary then don't show breadcrumb, there is a conditional higher up that is making sure this is DR.

{{#key-value-header
baseKey=baseKey
path="vault.cluster.replication-dr-promote"
Expand All @@ -25,8 +25,8 @@
<span class="sep">
/
</span>
{{#link-to "vault.cluster.replication-dr-promote"}}
Disaster Recovery
{{#link-to "vault.cluster.replication.index"}}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only time a breadcrumb shows on the route ui/vault/replication-dr-promote/details or the ui/vault/replication-dr-promote/ is when there is no DR Secondary and you land on the empty state component. In this case. you can use the breadcrumb to navigate back to the replication index page which lets you setup replication. See image here:
image

Replication
{{/link-to}}
</li>
{{/key-value-header}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
isSecondary=isSecondary
secondaryId=replicationDetails.secondaryId
isSummaryDashboard=isSummaryDashboard
isDisabled=isDisabled
)
dashboard=(component
'replication-dashboard'
Expand Down
1 change: 1 addition & 0 deletions ui/lib/core/app/components/shamir-flow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'core/components/shamir-flow';
1 change: 1 addition & 0 deletions ui/lib/core/app/components/shamir-modal-flow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'core/components/shamir-modal-flow';
13 changes: 13 additions & 0 deletions ui/lib/replication/addon/routes/mode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
import { setProperties } from '@ember/object';
import Route from '@ember/routing/route';

const SUPPORTED_REPLICATION_MODES = ['dr', 'performance'];
Expand All @@ -17,4 +19,15 @@ export default Route.extend({
this.replicationMode.setMode(replicationMode);
return this.modelFor('application');
},
afterModel(model) {
return hash({
// set new property on model to compare if the drMode changes when you are demoting the cluster
drModeInit: model.drMode,
}).then(({ drModeInit }) => {
setProperties(model, {
drModeInit,
});
return model;
});
},
});
1 change: 1 addition & 0 deletions ui/lib/replication/addon/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<section class="section">
<div class="container is-widescreen">
{{#if model.replicationIsInitializing }}
<nav class="navbar"></nav>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix! ✨

<LayoutLoading />
{{else}}
{{#if (eq model.mode 'unsupported')}}
Expand Down
95 changes: 50 additions & 45 deletions ui/lib/replication/addon/templates/mode.hbs
Original file line number Diff line number Diff line change
@@ -1,57 +1,62 @@
<section class="section">
<div class="container is-widescreen">
{{#if model.replicationAttrs.replicationEnabled}}
<PageHeader as |p|>
<p.top>
<nav class="key-value-header breadcrumb">
{{#if (and (eq model.drMode "secondary") (eq model.drModeInit "primary"))}}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this is indentation changes due to wrapping everything in conditional

<nav class="navbar"></nav>
Comment thread
Monkeychip marked this conversation as resolved.
<LayoutLoading />
{{else}}
{{#if model.replicationAttrs.replicationEnabled}}
<PageHeader as |p|>
<p.top>
<nav class="key-value-header breadcrumb">
<ul>
<li>
{{#link-to "index"}}
<span class="sep" data-test-replication-breadcrumb />
Replication
{{/link-to}}
</li>
<li>
<span class="sep"></span>
{{model.replicationModeForDisplay}}
</li>
</ul>
</nav>
</p.top>
<p.levelLeft>
<h1 class="has-top-margin-m title is-3 " data-test-replication-title=true>
{{model.replicationModeForDisplay}}
<span class="tag is-light has-text-grey-dark" data-test-replication-mode-display=true>
{{model.replicationAttrs.modeForHeader}}
</span>
</h1>
</p.levelLeft>
</PageHeader>
<div class="tabs-container box is-bottomless is-fullwidth is-paddingless is-marginless">
<nav class="tabs sub-nav">
<ul>
<li>
{{#link-to "index"}}
<span class="sep" data-test-replication-breadcrumb />
Replication
<li class="{{if (is-active-route 'vault.cluster.replication.mode.index') 'is-active' ''}}">
{{#link-to "mode" replicationMode data-test-replication-link="details"}}
Details
{{/link-to}}
</li>
<li>
<span class="sep"></span>
{{model.replicationModeForDisplay}}
<li class="{{if (is-active-route 'vault.cluster.replication.mode.manage') 'is-active' ''}}">
{{#link-to "mode.manage" replicationMode data-test-replication-link="manage"}}
Manage
{{/link-to}}
</li>
{{#if model.replicationAttrs.isPrimary}}
<li class="{{if (is-active-route 'vault.cluster.replication.mode.secondaries') 'is-active' ''}}">
{{#link-to "mode.secondaries" replicationMode data-test-replication-link="secondaries"}}
Secondaries
{{/link-to}}
</li>
{{/if}}
</ul>
</nav>
</p.top>
<p.levelLeft>
<h1 class="has-top-margin-m title is-3 " data-test-replication-title=true>
{{model.replicationModeForDisplay}}
<span class="tag is-light has-text-grey-dark" data-test-replication-mode-display=true>
{{model.replicationAttrs.modeForHeader}}
</span>
</h1>
</p.levelLeft>
</PageHeader>
<div class="tabs-container box is-bottomless is-fullwidth is-paddingless is-marginless">
<nav class="tabs sub-nav">
<ul>
<li class="{{if (is-active-route 'vault.cluster.replication.mode.index') 'is-active' ''}}">
{{#link-to "mode" replicationMode data-test-replication-link="details"}}
Details
{{/link-to}}
</li>
<li class="{{if (is-active-route 'vault.cluster.replication.mode.manage') 'is-active' ''}}">
{{#link-to "mode.manage" replicationMode data-test-replication-link="manage"}}
Manage
{{/link-to}}
</li>
{{#if model.replicationAttrs.isPrimary}}
<li class="{{if (is-active-route 'vault.cluster.replication.mode.secondaries') 'is-active' ''}}">
{{#link-to "mode.secondaries" replicationMode data-test-replication-link="secondaries"}}
Secondaries
{{/link-to}}
</li>
{{/if}}
</ul>
</nav>
</div>
</div>
{{/if}}
{{outlet}}
{{/if}}
{{outlet}}
</div>
</section>