-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HMS-2994): add delete confirmation modal
When the kebab item 'delete' is clicked on the page that list the domains, and at the detail domain page. Signed-off-by: Alejandro Visiedo <[email protected]>
- Loading branch information
Showing
4 changed files
with
108 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '~@redhat-cloud-services/frontend-components-utilities/styles/variables'; |
44 changes: 44 additions & 0 deletions
44
src/Components/ConfirmDeleteDomain/ConfirmDeleteDomain.tsx
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Button, Modal } from '@patternfly/react-core'; | ||
import './ConfirmDeleteDomain.scss'; | ||
import React from 'react'; | ||
import { Domain } from '../../Api/api'; | ||
|
||
interface ConfirmDeleteDomainProps { | ||
domain?: Domain; | ||
isOpen?: boolean; | ||
onDelete?: (domain?: Domain) => void; | ||
onCancel?: () => void; | ||
} | ||
|
||
/** | ||
* Modal dialog to confirm a domain deletion. | ||
* | ||
* @param props the props given by the smart component. | ||
*/ | ||
const ConfirmDeleteDomain: React.FC<ConfirmDeleteDomainProps> = (props) => { | ||
const onDeleteWrapper = () => { | ||
props.onDelete !== undefined && props.onDelete(props.domain); | ||
}; | ||
return ( | ||
<Modal | ||
isOpen={props.isOpen} | ||
titleIconVariant={'warning'} | ||
variant="small" | ||
title="Delete identity domain registration" | ||
ouiaId="ModalConfirmDeletion" | ||
onClose={props.onCancel} | ||
actions={[ | ||
<Button key="delete" variant="danger" onClick={onDeleteWrapper} ouiaId="ButtonModalConfirmDeletionDelete"> | ||
Delete | ||
</Button>, | ||
<Button key="cancel" variant="link" onClick={props.onCancel} ouiaId="ButtonModalConfirmDeletionCancel"> | ||
Cancel | ||
</Button>, | ||
]} | ||
> | ||
Are you sure you want to delete? Deleting will avoid new host enrollments on "{props.domain?.domain_name || ''}" domain. | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ConfirmDeleteDomain; |
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