/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import { EuiButton, EuiCallOut, EuiConfirmModal, EuiFieldText, EuiForm, EuiFormRow, EuiLoadingSpinner, EuiModal, EuiModalBody, EuiModalFooter, EuiModalHeader, EuiModalHeaderTitle, EuiOverlayMask, EuiSpacer, } from '@elastic/eui'; import React from 'react'; import { useState } from 'react'; export interface DeleteLogTypeModalProps { logTypeName: string; detectionRulesCount: number; loading?: boolean; closeModal: () => void; onConfirm: () => void; } export const DeleteLogTypeModal: React.FC = ({ detectionRulesCount, logTypeName, loading, closeModal, onConfirm, }) => { const [confirmDeleteText, setConfirmDeleteText] = useState(''); if (loading) { return ( ); } const onConfirmClick = () => { onConfirm(); closeModal(); }; return ( {detectionRulesCount > 0 ? (

This log type can't be deleted

1 ? 'rules' : 'rule' }.`} iconType={'iInCircle'} color="warning" />

Only log types that don’t have any associated rules can be deleted. Consider editing log type or deleting associated detection rules.

Close
) : (

The log type will be permanently deleted. This action is irreversible.

Type {logTypeName} to confirm

setConfirmDeleteText(e.target.value)} />
)}
); };