import React from "react"; import { Button, Form, FormGroup, Modal, ModalBody, ModalFooter, ModalHeader, } from "@patternfly/react-core"; import { Table, TableText, Tr, Tbody, Td } from "@patternfly/react-table"; // Utils import { IPAParamDefinition, getParamProperties, updateIpaObject, } from "../../utils/ipaObjectUtils"; import InputWithValidation from "src/components/layouts/InputWithValidation"; interface PropsToTable extends IPAParamDefinition { title: string; } const ConfigObjectclassTable = (props: PropsToTable) => { const { value } = getParamProperties(props); const values = value ? (value as string[]) : []; const [isOpen, setIsOpen] = React.useState(false); const [newOC, setNewOC] = React.useState(""); const removeOC = (name: string) => { if (props.ipaObject !== undefined && props.onChange !== undefined) { const newOCList = values.filter((item) => item !== name); updateIpaObject(props.ipaObject, props.onChange, newOCList, props.name); } }; const addOC = () => { if (props.ipaObject !== undefined && props.onChange !== undefined) { const newOCList = [...values, newOC]; updateIpaObject(props.ipaObject, props.onChange, newOCList, props.name); } setIsOpen(false); }; return ( {values.map((item) => { const removeButton = ( ); return ( ); })}
{item} {removeButton}
setIsOpen(false)} >
values.indexOf(value.toLowerCase()) === -1, }, ]} />
,
); }; export default ConfigObjectclassTable;