/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { useEffect, useState } from "react"; import { EuiButton, EuiButtonEmpty, EuiCallOut, EuiFieldText, EuiModal, EuiModalBody, EuiModalFooter, EuiModalHeader, EuiModalHeaderTitle, EuiSpacer, EuiText, } from "@elastic/eui"; import { filterByMinimatch } from "../../../../../utils/helper"; import { SYSTEM_INDEX } from "../../../../../utils/constants"; interface DeleteIndexModalProps { selectedItems: string[]; visible: boolean; onClose: () => void; onConfirm: () => void; } export default function DeleteIndexModal(props: DeleteIndexModalProps) { const [value, setValue] = useState(""); const { onClose, onConfirm, visible, selectedItems } = props; useEffect(() => { if (visible) { setValue(""); } }, [visible]); if (!visible) { return null; } const hasSystemIndex = props.selectedItems.some((index) => filterByMinimatch(index, SYSTEM_INDEX)); return ( Delete indices {hasSystemIndex ? ( <> These indexes may contain critical system data. Deleting system indexes may break OpenSearch. ) : null}

The following index will be permanently deleted. This action cannot be undone.

    {selectedItems.map((item) => (
  • {item}
  • ))}
To confirm your action, type delete. setValue(e.target.value)} />
Cancel Delete
); }