/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ import React, { useEffect, useState } from "react"; import { EuiButton, EuiButtonEmpty, EuiFieldText, EuiModal, EuiModalBody, EuiModalFooter, EuiModalHeader, EuiModalHeaderTitle, EuiSpacer, EuiCallOut, EuiText, } from "@elastic/eui"; import { filterByMinimatch } from "../../../../../utils/helper"; import { SYSTEM_INDEX } from "../../../../../utils/constants"; interface CloseIndexModalProps { selectedItems: string[]; visible: boolean; onClose: () => void; onConfirm: () => void; } export default function CloseIndexModal(props: CloseIndexModalProps) { const [value, setValue] = useState(""); const { onClose, onConfirm, visible, selectedItems } = props; useEffect(() => { if (visible) { setValue(""); } }, [visible]); if (!visible) { return null; } const showWarning = selectedItems.filter((item) => filterByMinimatch(item as string, SYSTEM_INDEX)).length > 0; return ( Close indices <>

The following index will be closed. It is not possible to index documents or to search for documents in a closed index.

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