Skip to content

Commit 11af7eb

Browse files
authored
Merge pull request #645 from Lazy-poet/issue/608
Issue/608
2 parents bf24a05 + 1e0eca9 commit 11af7eb

File tree

11 files changed

+1489
-193
lines changed

11 files changed

+1489
-193
lines changed

public/js/form.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,17 @@ export class Form extends Component {
156156
}
157157

158158
handleAlgoChanged(algo) {
159-
if (this.state.preDefinedOpts.hasOwnProperty(algo)) {
159+
if (algo in this.state.preDefinedOpts) {
160160
var preDefinedOpts = this.state.preDefinedOpts[algo];
161161
this.refs.opts.setState({
162+
method: algo,
162163
preOpts: preDefinedOpts,
163164
value: (preDefinedOpts['last search'] ||
164165
preDefinedOpts['default']).join(' ')
165166
});
166167
}
167168
else {
168-
this.refs.opts.setState({ preOpts: {}, value: '' });
169+
this.refs.opts.setState({ preOpts: {}, value: '', method: '' });
169170
}
170171
}
171172

public/js/options.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import React, { Component } from 'react';
33
export 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)}

public/sequenceserver-search.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

views/_options.erb

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)