import React from 'react'; import 'codemirror/theme/duotone-light.css'; import SelectSearch, { fuzzySearch } from 'react-select-search'; import { CodeHinter } from '../../CodeBuilder/CodeHinter'; import { changeOption } from './utils'; class Dynamodb extends React.Component { constructor(props) { super(props); this.state = { options: this.props.options, }; } componentDidMount() { this.setState({ options: this.props.options, }); } changeOperation = (operation) => { this.setState( { options: { ...this.state.options, operation, }, }, () => { this.props.optionsChanged(this.state.options); } ); }; render() { const { options } = this.state; return (
{options && (
{ this.changeOperation(value); }} filterOptions={fuzzySearch} placeholder="Select.." />
{['query_table'].includes(this.state.options.operation) && (
changeOption(this, 'query_condition', value)} />
)} {['scan_table'].includes(this.state.options.operation) && (
changeOption(this, 'scan_condition', value)} />
)} {['get_item', 'delete_item'].includes(this.state.options.operation) && (
changeOption(this, 'table', value)} />
changeOption(this, 'key', value)} />
)}
)}
); } } export { Dynamodb };