-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UI: Part 5 - hds adoption replace <Modal> #23471
Merged
hellobontempo
merged 10 commits into
ui/VAULT-17315-hds-adoption-replace-Modal
from
ui/VAULT-20470/part-5-modals
Oct 3, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4497b54
replace confirmation modals
hellobontempo 346e9f4
[VAULT-20630] CI: Fix the CI workflow issue where we check out base r…
kubawi 1ce065b
update changelog with links to published advisories (#23424)
mickael-hc f202ec6
[VAULT-20630] CI: Use 'ref' (not 'base_ref') as a default git referen…
kubawi e51314d
UI: [VAULT-20626] Hide replication if user doesnt have permissions (#…
kiannaquach 5085466
UI: [VAULT-19693] Only make vault configuration call when in root nam…
kiannaquach e79e62b
docs: link to the VSO+HVS quick-start tutorial (#23461)
benashz 5f1b13e
Allow AWS secret engine to send empty policy document (#23470)
Monkeychip 8411b2f
move deps
hellobontempo 942f2e3
Merge branch 'ui/VAULT-17315-hds-adoption-replace-Modal' into ui/VAUL…
hellobontempo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,13 @@ | |
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
import { assert } from '@ember/debug'; | ||
|
||
import Component from '@glimmer/component'; | ||
/** | ||
* @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 | ||
* ConfirmationModal components wrap the <Hds::Modal> component to present a critical (red) type-to-confirm modal. | ||
* They are used for extremely destructive actions that require extra consideration before confirming. | ||
* | ||
* @example | ||
* ```js | ||
|
@@ -15,38 +17,22 @@ import Component from '@glimmer/component'; | |
* @title="Do Dangerous Thing?" | ||
* @isActive={{isModalActive}} | ||
* @onClose={{action (mut isModalActive) false}} | ||
* @confirmText="yes" | ||
* @onConfirmMsg="deleting this thing to delete." | ||
* /> | ||
* ``` | ||
* @param {function} onConfirm - onConfirm is the action that happens when user clicks onConfirm after filling in the confirmation block | ||
* @param {function} onClose - specify what to do when user attempts to close modal | ||
* @param {boolean} isActive - Controls whether the modal is "active" eg. visible or not. | ||
* @param {string} title - Title of the modal | ||
* @param {string} [confirmText=Yes] - The confirmation text that the user must type before continuing | ||
* @param {string} [toConfirmMsg=''] - Finishes the sentence "Type <confirmText> to confirm <toConfirmMsg>", default is an empty string (ex. 'secret deletion') | ||
* @param {string} confirmText - The confirmation text that the user must type before continuing | ||
* @param {string} [toConfirmMsg] - Finishes the sentence "Type <confirmText> to confirm <toConfirmMsg>", default is an empty string (ex. 'secret deletion') | ||
* @param {string} [buttonText=Confirm] - Button text on the confirm button | ||
* @param {string} [buttonClass=is-danger] - extra class to add to confirm button (eg. "is-danger") | ||
* @param {string} [type=warning] - The header styling based on type, passed into the message-types helper (in the Modal component). | ||
*/ | ||
|
||
export default class ConfirmationModal extends Component { | ||
get buttonClass() { | ||
return this.args.buttonClass || 'is-danger'; | ||
} | ||
|
||
get buttonText() { | ||
return this.args.buttonText || 'Confirm'; | ||
} | ||
|
||
get confirmText() { | ||
return this.args.confirmText || 'Yes'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nowhere used the default arg so I removed this to simplify the component |
||
} | ||
|
||
get type() { | ||
return this.args.type || 'warning'; | ||
} | ||
|
||
get toConfirmMsg() { | ||
return this.args.toConfirmMsg || ''; | ||
constructor() { | ||
super(...arguments); | ||
assert('@confirmText is required', this.args.confirmText); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ | |
@title="Demote to secondary?" | ||
@onClose={{action (mut this.isModalActive) false}} | ||
@isActive={{this.isModalActive}} | ||
@buttonClass="is-primary" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
@confirmText={{this.model.replicationModeForDisplay}} | ||
@toConfirmMsg="demoting this cluster" | ||
@onConfirm={{action "onSubmit" "demote" this.model.replicationAttrs.modeForUrl}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per design, this modal will always be critical because it's destructive. Previously structure didn't have red modals, which is why we used the warning yellow.