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
{
Object.entries(this.state.preOpts).map(
([key, value], index) => {
value = value.join(' ');
if (value.trim() === this.state.value.trim())
var className = 'yellow-background';
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 (