2021-04-19 16:49:57 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import 'codemirror/theme/duotone-light.css';
|
2021-06-03 06:59:27 +00:00
|
|
|
import { changeOption } from './utils';
|
2021-11-15 06:18:09 +00:00
|
|
|
import { CodeHinter } from '../../CodeBuilder/CodeHinter';
|
2021-04-19 16:49:57 +00:00
|
|
|
|
|
|
|
|
class Redis extends React.Component {
|
2021-04-30 06:31:32 +00:00
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
2021-04-19 16:49:57 +00:00
|
|
|
|
2021-04-30 06:31:32 +00:00
|
|
|
this.state = {
|
2021-09-21 13:48:28 +00:00
|
|
|
options: this.props.options,
|
2021-04-30 06:31:32 +00:00
|
|
|
};
|
|
|
|
|
}
|
2021-04-19 16:49:57 +00:00
|
|
|
|
2021-04-30 06:31:32 +00:00
|
|
|
componentDidMount() {
|
|
|
|
|
this.setState({
|
2021-09-21 13:48:28 +00:00
|
|
|
options: this.props.options,
|
2021-04-30 06:31:32 +00:00
|
|
|
});
|
|
|
|
|
}
|
2021-04-19 16:49:57 +00:00
|
|
|
|
2021-04-30 06:31:32 +00:00
|
|
|
render() {
|
|
|
|
|
const { options } = this.state;
|
2021-04-19 16:49:57 +00:00
|
|
|
|
2021-04-30 06:31:32 +00:00
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{options && (
|
|
|
|
|
<div>
|
2021-04-30 08:10:57 +00:00
|
|
|
<div className="mb-3 mt-2">
|
2021-11-15 06:18:09 +00:00
|
|
|
<CodeHinter
|
2021-05-02 06:17:22 +00:00
|
|
|
height="auto"
|
2021-11-15 06:18:09 +00:00
|
|
|
currentState={this.props.currentState}
|
|
|
|
|
initialValue={options.query}
|
|
|
|
|
mode="sql"
|
|
|
|
|
placeholder={'PING'}
|
|
|
|
|
theme={this.props.darkMode ? 'monokai' : 'duotone-light'}
|
|
|
|
|
lineNumbers={true}
|
|
|
|
|
className="query-hinter"
|
|
|
|
|
onChange={(value) => changeOption(this, 'query', value)}
|
2021-04-30 06:31:32 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-04-19 16:49:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { Redis };
|