diff --git a/src/plugins/credential_management/public/components/edit_credential/edit_credential.tsx b/src/plugins/credential_management/public/components/edit_credential/edit_credential.tsx index 3e9e4880097a..acdf1d2720b4 100644 --- a/src/plugins/credential_management/public/components/edit_credential/edit_credential.tsx +++ b/src/plugins/credential_management/public/components/edit_credential/edit_credential.tsx @@ -20,6 +20,10 @@ import { EuiButton, EuiPageContent, EuiFieldPassword, + EuiFlexItem, + EuiToolTip, + EuiButtonIcon, + EuiConfirmModal, } from '@elastic/eui'; import { DocLinksStart } from 'src/core/public'; import { getCreateBreadcrumbs } from '../breadcrumbs'; @@ -36,6 +40,7 @@ interface EditCredentialState { dual: boolean; toasts: EuiGlobalToastListToast[]; docLinks: DocLinksStart; + isVisible: boolean; } export interface EditCredentialProps extends RouteComponentProps { @@ -61,6 +66,7 @@ export class EditCredentialComponent extends React.Component< dual: true, toasts: [], docLinks: context.services.docLinks, + isVisible: false, }; } @@ -72,6 +78,23 @@ export class EditCredentialComponent extends React.Component< return ( +
+ + + + + +
+ { + this.state.isVisible ? + { this.setState({ isVisible: false }) }} + onConfirm={async () => { + const { savedObjects } = this.context.services; + try { + //await deleteCredentials(savedObjects.client, [this.props.credential]); + await savedObjects.client.delete('credential', this.props.credential.id); + this.props.history.push(''); + } catch (e) { + console.log(e); + } + }} + cancelButtonText="Cancel" + confirmButtonText="Delete" + defaultFocusedButton="confirm"> +

This will also delete their credential materials. All data sources using this credential will be invalid for access, and they must choose new credentials.

+

To confirm deletion, enter delete in the text input field.

+

Note: this action is irrevocable!

+
: null + } ); } + removeCredential = async () => { + this.setState({ isVisible: true }) + } + updateCredential = async () => { const { savedObjects } = this.context.services; try {