diff --git a/ui/lib/core/addon/components/confirmation-modal.hbs b/ui/lib/core/addon/components/confirmation-modal.hbs index 2a32d9184349..b3ce14a2e9e8 100644 --- a/ui/lib/core/addon/components/confirmation-modal.hbs +++ b/ui/lib/core/addon/components/confirmation-modal.hbs @@ -3,40 +3,45 @@ SPDX-License-Identifier: BUSL-1.1 ~}} - - - - \ No newline at end of file +{{#if @isActive}} + + + {{@title}} + + + {{yield}} + + + + + + + + + +{{/if}} \ No newline at end of file diff --git a/ui/lib/core/addon/components/confirmation-modal.js b/ui/lib/core/addon/components/confirmation-modal.js index 3e24fc928a85..a198903e1177 100644 --- a/ui/lib/core/addon/components/confirmation-modal.js +++ b/ui/lib/core/addon/components/confirmation-modal.js @@ -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 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,6 +17,7 @@ import Component from '@glimmer/component'; * @title="Do Dangerous Thing?" * @isActive={{isModalActive}} * @onClose={{action (mut isModalActive) false}} + * @confirmText="yes" * @onConfirmMsg="deleting this thing to delete." * /> * ``` @@ -22,31 +25,14 @@ import Component from '@glimmer/component'; * @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 to confirm ", 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 to confirm ", 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'; - } - - get type() { - return this.args.type || 'warning'; - } - - get toConfirmMsg() { - return this.args.toConfirmMsg || ''; + constructor() { + super(...arguments); + assert('@confirmText is required', this.args.confirmText); } } diff --git a/ui/lib/core/addon/templates/components/replication-action-demote.hbs b/ui/lib/core/addon/templates/components/replication-action-demote.hbs index 879fd458b2cf..43019f38f9af 100644 --- a/ui/lib/core/addon/templates/components/replication-action-demote.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-demote.hbs @@ -30,7 +30,6 @@ @title="Demote to secondary?" @onClose={{action (mut this.isModalActive) false}} @isActive={{this.isModalActive}} - @buttonClass="is-primary" @confirmText={{this.model.replicationModeForDisplay}} @toConfirmMsg="demoting this cluster" @onConfirm={{action "onSubmit" "demote" this.model.replicationAttrs.modeForUrl}} diff --git a/ui/lib/pki/addon/components/page/pki-configuration-details.hbs b/ui/lib/pki/addon/components/page/pki-configuration-details.hbs index 60ea1118a621..11485d3631eb 100644 --- a/ui/lib/pki/addon/components/page/pki-configuration-details.hbs +++ b/ui/lib/pki/addon/components/page/pki-configuration-details.hbs @@ -111,19 +111,18 @@ {{#if this.showDeleteAllIssuers}} - +

{{/if}} \ No newline at end of file