Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication Management Sidebranch: Replication Action Disable #9061

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
67726cf
WIP: Add action-block core addon component + story
chelshaw May 18, 2020
8fcc493
WIP // preliminary styling for action-block
chelshaw May 18, 2020
b3be27c
Remove test div from dr details page
chelshaw May 18, 2020
0abd8bb
Refactor action-block to style only component
chelshaw May 20, 2020
e86bee8
Add confirmation-modal component
chelshaw May 21, 2020
3460dc2
Add confirmation styles for modal and bullet list helper class
chelshaw May 21, 2020
c308e90
Add manage link to dr secondary replication header
chelshaw May 21, 2020
5a75ef2
Update DR Secondary main page to replication manage view
chelshaw May 21, 2020
04390e7
Update replication actions component to allow passing in clusterMode,…
chelshaw May 21, 2020
57a6592
Update replication-action-disable to new action-block layout with con…
chelshaw May 21, 2020
4443c3b
Add margin to top and bottom of replication actions grid
chelshaw May 21, 2020
9cf739f
Add data-test attrs for confirmation-modal-test
chelshaw May 27, 2020
f142664
Remove unnecessary index tracking on replication-actions component
chelshaw May 27, 2020
fb47729
Update replication-actions-test for new layout and workflow with modal
chelshaw May 27, 2020
992805b
Update toConfirm param to toConfirmMsg
chelshaw May 27, 2020
2143c6c
Update disable replication-action to account for different messages d…
chelshaw May 27, 2020
afd926e
Remove unnecessary param on confirmation-modal
chelshaw May 28, 2020
25def90
Reformat for ease of reading, remove pauseTest
chelshaw May 28, 2020
65e34a4
add spaces to end of file
chelshaw May 28, 2020
423eb4d
Fix casing on replication confirmation message
chelshaw May 29, 2020
88ac65a
Fix styling for action-block in grid layout
chelshaw May 29, 2020
b6455e6
Remove unnecessary clusterMode and selectedAction from replication-ac…
chelshaw May 29, 2020
2fe79a3
Remove 'disable' from dr sec replication actions list while API endpo…
chelshaw May 29, 2020
8aa27a6
Fix icon alignment on modal title w/ icon
chelshaw May 29, 2020
fe863bb
Update confirmation modal test name
chelshaw May 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/app/styles/components/action-block.scss
Expand Up @@ -45,6 +45,7 @@
.replication-actions-grid-layout {
display: flex;
flex-wrap: wrap;
margin: $spacing-m 0;
}

.replication-actions-grid-item {
Expand Down
17 changes: 17 additions & 0 deletions ui/app/styles/components/modal.scss
Expand Up @@ -52,3 +52,20 @@ pre {
color: $yellow-dark;
}
}

.modal-confirm-section .is-help {
color: $grey;
margin: $spacing-xxs 0;
strong {
color: inherit;
}
}

.modal-confirm-section {
margin: $spacing-xl 0 $spacing-m;
}

.modal-card-foot-outlined {
background: #f7f8fa;
border-top: 1px solid #bac1cc;
}
5 changes: 5 additions & 0 deletions ui/app/styles/core/helpers.scss
Expand Up @@ -158,3 +158,8 @@
.has-border-danger {
border: 1px solid $danger;
}

ul.bullet {
list-style: disc;
padding-left: $spacing-m;
}
74 changes: 37 additions & 37 deletions ui/app/templates/vault/cluster/replication-dr-promote/details.hbs
@@ -1,44 +1,44 @@
<section class="section">
<div class="container is-widescreen">
<ReplicationPage @model={{model}} as |Page|>
<Page.header
@showTabs={{false}}
<Page.header
@showTabs={{true}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line was the only change, the rest is whitespace

/>
{{#if Page.isDisabled}}
<EmptyState
@title="Disaster Recovery secondary not set up"
@message={{Page.message}}
@icon="alert-circle-outline"
@bottomBorder={{true}}
>
<nav class="breadcrumb">
<ul class="is-grouped-split">
<li>
{{#link-to "vault.cluster.secrets.backends" }}
<span class="sep"/>
Go back
{{/link-to}}
</li>
<li>
<LearnLink @path="/vault/operations/ops-disaster-recovery" @class="has-text-grey">
Need help?
</LearnLink>
</li>
</ul>
</nav>
</EmptyState>
{{else}}
<Page.dashboard
{{!-- passing in component to render so that the yielded components are flexible based on the dashboard --}}
@componentToRender='replication-secondary-card' as |Dashboard|>
<Dashboard.card
@title="States"
/>
{{#if Page.isDisabled}}
<EmptyState
@title="Disaster Recovery secondary not set up"
@message={{Page.message}}
@icon="alert-circle-outline"
@bottomBorder={{true}}
>
<nav class="breadcrumb">
<ul class="is-grouped-split">
<li>
{{#link-to "vault.cluster.secrets.backends" }}
<span class="sep"/>
Go back
{{/link-to}}
</li>
<li>
<LearnLink @path="/vault/operations/ops-disaster-recovery" @class="has-text-grey">
Need help?
</LearnLink>
</li>
</ul>
</nav>
</EmptyState>
{{else}}
<Page.dashboard
{{!-- passing in component to render so that the yielded components are flexible based on the dashboard --}}
@componentToRender='replication-secondary-card' as |Dashboard|>
<Dashboard.card
@title="States"
/>
<Dashboard.card
@title="Primary cluster"
/>
<Dashboard.rows/>
</Page.dashboard>
<Dashboard.card
@title="Primary cluster"
/>
<Dashboard.rows/>
</Page.dashboard>
{{/if}}
</ReplicationPage>
</div>
Expand Down
101 changes: 40 additions & 61 deletions ui/app/templates/vault/cluster/replication-dr-promote/index.hbs
@@ -1,62 +1,41 @@
<SplashPage as |Page|>
<Page.header>
<h1 class="title is-4">
Disaster Recovery secondary is&nbsp;enabled
</h1>
</Page.header>
<Page.content>
<nav class="tabs sub-nav is-marginless">
<ul>
<li class="{{if (eq action '') 'is-active'}}">
{{#link-to 'vault.cluster.replication-dr-promote' (query-params action='')}}
Operation token
{{/link-to}}
</li>
<li class="{{if (eq action 'update') 'is-active'}}">
{{#link-to 'vault.cluster.replication-dr-promote' (query-params action='update')}}
Update primary
{{/link-to}}
</li>
<li class="{{if (eq action 'promote') 'is-active'}}">
{{#link-to 'vault.cluster.replication-dr-promote' (query-params action='promote')}}
Promote
{{/link-to}}
</li>
</ul>
</nav>
{{#if (eq action 'promote')}}
<AlertBanner
@type="warning"
@title="Caution"
@message="Vault Replication is not designed for active-active usage and enabling two performance primaries should never be done, as it can lead to data loss if they or their secondaries are ever reconnected."
@class="unseal-warning"
data-test-cluster-status
<section class="section">
<div class="container is-widescreen">
<ReplicationPage @model={{model}} as |Page|>
<Page.header
@showTabs={{true}}
/>
<ReplicationActions
@replicationMode="dr"
@selectedAction="promote"
@model={{model}}
/>
{{/if}}
{{#if (eq action 'update')}}
<ReplicationActions
@replicationMode="dr"
@selectedAction="update-primary"
@model={{model}}
/>
{{/if}}
{{#unless action}}
<ShamirFlow
@action="generate-dr-operation-token"
@buttonText="Promote cluster"
@fetchOnInit=true
@generateAction=true
>
<p>
Generate an Operation Token by entering a portion of the master key.
Once all portions are entered, the generated operation token may be used to manage your secondary Disaster Recovery cluster.
</p>
</ShamirFlow>
{{/unless}}
</Page.content>
</SplashPage>
{{#if Page.isDisabled}}
<EmptyState
@title="Disaster Recovery secondary not set up"
@message={{Page.message}}
@icon="alert-circle-outline"
@bottomBorder={{true}}
>
<nav class="breadcrumb">
<ul class="is-grouped-split">
<li>
{{#link-to "vault.cluster.secrets.backends" }}
<span class="sep"/>
Go back
{{/link-to}}
</li>
<li>
<LearnLink @path="/vault/operations/ops-disaster-recovery" @class="has-text-grey">
Need help?
</LearnLink>
</li>
</ul>
</nav>
</EmptyState>
{{else}}
<section>
<ReplicationActions
@replicationMode="dr"
@clusterMode="secondary"
@model={{model}}
/>
</section>
{{/if}}
</ReplicationPage>
</div>
</section>
35 changes: 35 additions & 0 deletions ui/lib/core/addon/components/confirmation-modal.js
@@ -0,0 +1,35 @@
/**
* @module ConfirmationModal
* ConfirmationModal components are used to provide an alternative to ConfirmationButton that automatically prompts the user to fill in confirmation text before they can continue with a potentially destructive action. It is built off the Modal component
*
* @example
* ```js
* <ConfirmationModal
* @onConfirm={action "destructiveAction"}
* @title="Do Dangerous Thing?"
* @isActive={{isModalActive}}
* @onClose={{action (mut isModalActive) false}}
* />
* ```
* @param {function} onConfirm - onConfirm is the action that happens when user clicks onConfirm after filling in the confirmation block
* @param {boolean} isActive - Controls whether the modal is "active" eg. visible or not.
* @param {string} title - Title of the modal
* @param {function} onClose - specify what to do when user attempts to close modal
* @param {string} [buttonText=Confirm] - Button text on the confirm button
* @param {string} [confirmText=Yes] - The confirmation text that the user must type before continuing
* @param {string} [buttonClass=is-danger] - extra class to add to confirm button (eg. "is-danger")
* @param {sting} [type=warning] - Applies message-type styling to header. Override to default with empty string
* @param {string} [toConfirmMsg] - Finishes the sentence "Type YES to confirm ..."
*/

import Component from '@ember/component';
import layout from '../templates/components/confirmation-modal';

export default Component.extend({
layout,
buttonClass: 'is-danger',
buttonText: 'Confirm',
confirmText: 'Yes',
type: 'warning',
toConfirmMsg: '',
});
2 changes: 1 addition & 1 deletion ui/lib/core/addon/helpers/replication-action-for-mode.js
Expand Up @@ -8,7 +8,7 @@ const ACTIONS = {
},
dr: {
primary: ['disable', 'recover', 'reindex', 'demote'],
secondary: ['promote'],
secondary: ['disable', 'promote'],
bootstrapping: ['disable', 'recover', 'reindex'],
},
};
Expand Down
46 changes: 46 additions & 0 deletions ui/lib/core/addon/templates/components/confirmation-modal.hbs
@@ -0,0 +1,46 @@
<Modal
@title={{title}}
@onClose={{onClose}}
@isActive={{isActive}}
@type={{type}}
@showCloseButton={{true}}
>
<section class="modal-card-body">
<div class="box is-shadowless is-fullwidth is-sideless">

{{yield}}

<div class="modal-confirm-section">
<p class="has-text-weight-semibold is-size-6">
Confirm
</p>
<p class="is-help">Type <strong>{{confirmText}}</strong> to confirm {{toConfirmMsg}}</p>
{{input
type="text"
value=confirmationInput
name="confirmationInput"
class="input has-margin-top"
autocomplete="off"
chelshaw marked this conversation as resolved.
Show resolved Hide resolved
spellcheck="false"
data-test-confirmation-modal-input="confirmationInput"
}}
</div>
</div>
</section>
<footer class="modal-card-foot modal-card-foot-outlined">
<button
class="button {{buttonClass}}"
disabled={{unless (eq confirmationInput confirmText) true}}
onclick={{onConfirm}}
data-test-confirm-button
>
{{buttonText}}
</button>
<button
class="button is-secondary"
onclick={{action (mut isActive) false}}
data-test-cancel-button>
Cancel
</button>
</footer>
</Modal>