Skip to content

Commit

Permalink
Merge pull request #645 from Lazy-poet/issue/608
Browse files Browse the repository at this point in the history
Issue/608
  • Loading branch information
yannickwurm committed Jul 20, 2023
2 parents bf24a05 + 1e0eca9 commit 11af7eb
Show file tree
Hide file tree
Showing 11 changed files with 1,489 additions and 193 deletions.
5 changes: 3 additions & 2 deletions public/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,17 @@ export class Form extends Component {
}

handleAlgoChanged(algo) {
if (this.state.preDefinedOpts.hasOwnProperty(algo)) {
if (algo in this.state.preDefinedOpts) {
var preDefinedOpts = this.state.preDefinedOpts[algo];
this.refs.opts.setState({
method: algo,
preOpts: preDefinedOpts,
value: (preDefinedOpts['last search'] ||
preDefinedOpts['default']).join(' ')
});
}
else {
this.refs.opts.setState({ preOpts: {}, value: '' });
this.refs.opts.setState({ preOpts: {}, value: '', method: '' });
}
}

Expand Down
18 changes: 14 additions & 4 deletions public/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import React, { Component } from 'react';
export class Options extends Component {
constructor(props) {
super(props);
this.state = { preOpts: {}, value: '' };
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) {
Expand Down Expand Up @@ -37,7 +38,14 @@ export class Options extends Component {
</ul>
</span>;
}

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()) {
Expand All @@ -50,12 +58,14 @@ export class Options extends Component {
<div className="input-group">
<label className="control-label" htmlFor="advanced">
Advanced parameters:
<sup style={{ marginLeft: '2px' }}>
{/* only show link to advanced parameters if blast method is known */}
{this.state.method && <sup style={{ marginLeft: '2px' }}>
<a href=''
onClick={this.showAdvancedOptions}
data-toggle="modal" data-target="#help">
<i className="fa fa-question-circle"></i>
</a>
</sup>
</sup>}
</label>
<input type="text" className={classNames}
onChange={e => this.updateBox(e.target.value)}
Expand Down
4 changes: 2 additions & 2 deletions public/sequenceserver-search.min.js

Large diffs are not rendered by default.

156 changes: 0 additions & 156 deletions views/_options.erb

This file was deleted.

Loading

0 comments on commit 11af7eb

Please sign in to comment.