diff --git a/src/Common/TableEntity.tsx b/src/Common/TableEntity.tsx deleted file mode 100644 index aa98119c5..000000000 --- a/src/Common/TableEntity.tsx +++ /dev/null @@ -1,171 +0,0 @@ -import { - Dropdown, - IDropdownOption, - IDropdownStyles, - IImageProps, - Image, - IStackTokens, - Stack, - TextField, - TooltipHost -} from "@fluentui/react"; -import React, { FunctionComponent } from "react"; -import DeleteIcon from "../../images/delete.svg"; -import EditIcon from "../../images/Edit_entity.svg"; -import { CassandraType, TableType } from "../Explorer/Tables/Constants"; -import { userContext } from "../UserContext"; -import { EntityValue } from "./EntityValue"; - -const dropdownStyles: Partial = { dropdown: { width: 100 } }; - -export interface TableEntityProps { - entityTypeLabel?: string; - entityPropertyLabel?: string; - entityValueLabel?: string; - isDeleteOptionVisible: boolean; - entityProperty: string; - entityPropertyPlaceHolder: string; - selectedKey: string | number; - entityValuePlaceholder: string; - entityValue: string | Date; - isEntityTypeDate: boolean; - options: { key: string; text: string }[]; - isPropertyTypeDisable: boolean; - entityTimeValue: string; - isEntityValueDisable?: boolean; - onDeleteEntity?: () => void; - onEditEntity?: () => void; - onEntityPropertyChange: (event: React.FormEvent, newInput?: string) => void; - onEntityTypeChange: (event: React.FormEvent, selectedParam: IDropdownOption) => void; - onEntityValueChange: (event: React.FormEvent, newInput?: string) => void; - onSelectDate: (date: Date | null | undefined) => void; - onEntityTimeValueChange: (event: React.FormEvent, newInput?: string) => void; -} - -export const TableEntity: FunctionComponent = ({ - entityTypeLabel, - entityPropertyLabel, - isDeleteOptionVisible, - entityProperty, - selectedKey, - entityPropertyPlaceHolder, - entityValueLabel, - entityValuePlaceholder, - entityValue, - options, - isPropertyTypeDisable, - isEntityTypeDate, - entityTimeValue, - isEntityValueDisable, - onEditEntity, - onDeleteEntity, - onEntityPropertyChange, - onEntityTypeChange, - onEntityValueChange, - onSelectDate, - onEntityTimeValueChange, -}: TableEntityProps): JSX.Element => { - const imageProps: IImageProps = { - width: 16, - height: 30, - className: entityPropertyLabel ? "addRemoveIconLabel" : "addRemoveIcon", - }; - - const sectionStackTokens: IStackTokens = { childrenGap: 12 }; - - const handleKeyPress = (event: React.KeyboardEvent) => { - if (event.key === "Enter" || event.key === "Space") { - onEditEntity(); - } - }; - const handleKeyPressdelete = (event: React.KeyboardEvent) => { - if (event.key === "Enter" || event.key === "Space") { - onDeleteEntity(); - } - }; - - const getEntityValueType = (): string => { - const { Int, Smallint, Tinyint } = CassandraType; - const { Double, Int32, Int64 } = TableType; - - if ( - selectedKey === Double || - selectedKey === Int32 || - selectedKey === Int64 || - selectedKey === Int || - selectedKey === Smallint || - selectedKey === Tinyint - ) { - return "number"; - } - return "string"; - }; - - return ( - <> - - - - - {!isEntityValueDisable && ( - - -
- editEntity -
-
- - )} - {isDeleteOptionVisible && userContext.apiType !== "Cassandra" && ( - - delete entity - - )} -
- - ); -};