ToolJet/frontend/src/Editor/QueryManager/QueryEditors/Redis.jsx

49 lines
1.1 KiB
React
Raw Normal View History

2021-04-19 16:49:57 +00:00
import React from 'react';
import 'codemirror/theme/duotone-light.css';
import { changeOption } from './utils';
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 = {
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({
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>
<div className="mb-3 mt-2">
<CodeHinter
height="auto"
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 };