import React, { Component } from 'react'; // Component for the advanced params input field. export class Options extends Component { constructor(props) { super(props); this.state = { preOpts: {}, value: '', method: '' }; this.updateBox = this.updateBox.bind(this); this.optionsJSX = this.optionsJSX.bind(this); this.showAdvancedOptions = this.showAdvancedOptions.bind(this); } updateBox(value) { this.setState({ value: value }); } optionsJSX() { return ; } showAdvancedOptions(e) { const ids = ['blastn', 'tblastn', 'blastp', 'blastx', 'tblastx']; const method = this.state.method.toLowerCase(); // hide options for other algorithms and only show for selected algorithm for (const id of ids) { $(`#${id}`)[id === method ? 'show' : 'hide'](); } } render() { var classNames = 'form-control'; if (this.state.value.trim()) { classNames += ' yellow-background'; } return (
this.updateBox(e.target.value)} id="advanced" name="advanced" value={this.state.value} placeholder="eg: -evalue 1.0e-5 -num_alignments 100" title="View, and enter advanced parameters." /> {Object.keys(this.state.preOpts).length > 1 && this.optionsJSX()}
); } }