@@ -3,9 +3,10 @@ import React, { Component } from 'react';
33export class Options extends Component {
44 constructor ( props ) {
55 super ( props ) ;
6- this . state = { preOpts : { } , value : '' } ;
6+ this . state = { preOpts : { } , value : '' , method : '' } ;
77 this . updateBox = this . updateBox . bind ( this ) ;
88 this . optionsJSX = this . optionsJSX . bind ( this ) ;
9+ this . showAdvancedOptions = this . showAdvancedOptions . bind ( this ) ;
910 }
1011
1112 updateBox ( value ) {
@@ -37,7 +38,14 @@ export class Options extends Component {
3738 </ ul >
3839 </ span > ;
3940 }
40-
41+ showAdvancedOptions ( e ) {
42+ const ids = [ 'blastn' , 'tblastn' , 'blastp' , 'blastx' , 'tblastx' ] ;
43+ const method = this . state . method . toLowerCase ( ) ;
44+ // hide options for other algorithms and only show for selected algorithm
45+ for ( const id of ids ) {
46+ $ ( `#${ id } ` ) [ id === method ? 'show' : 'hide' ] ( ) ;
47+ }
48+ }
4149 render ( ) {
4250 var classNames = 'form-control' ;
4351 if ( this . state . value . trim ( ) ) {
@@ -50,12 +58,14 @@ export class Options extends Component {
5058 < div className = "input-group" >
5159 < label className = "control-label" htmlFor = "advanced" >
5260 Advanced parameters:
53- < sup style = { { marginLeft : '2px' } } >
61+ { /* only show link to advanced parameters if blast method is known */ }
62+ { this . state . method && < sup style = { { marginLeft : '2px' } } >
5463 < a href = ''
64+ onClick = { this . showAdvancedOptions }
5565 data-toggle = "modal" data-target = "#help" >
5666 < i className = "fa fa-question-circle" > </ i >
5767 </ a >
58- </ sup >
68+ </ sup > }
5969 </ label >
6070 < input type = "text" className = { classNames }
6171 onChange = { e => this . updateBox ( e . target . value ) }
0 commit comments