sequenceserver 1.1.0.beta3 → 1.1.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,21 @@
1
1
  import React from 'react';
2
2
 
3
+ /**
4
+ * Takes errorData object with title, message, and more_info keys as props. The
5
+ * component displays a bootstrap modal when mounted. errorData.title is used
6
+ * to set modal title. errorData.message is inserted as HTML text in modal
7
+ * body. And errorData.more_info is shown using a pre tag in modal body.
8
+ *
9
+ * The component is stateless. The displayed modal dialog cannot be dismissed.
10
+ * The user must close the tab or press back button to go back to search form.
11
+ */
3
12
  class ErrorModal extends React.Component {
4
13
 
5
14
  constructor(props) {
6
15
  super(props);
7
16
  }
8
17
 
18
+ // HTML for Bootstrap modal.
9
19
  render() {
10
20
  return (
11
21
  <div
@@ -37,19 +47,21 @@ class ErrorModal extends React.Component {
37
47
  );
38
48
  }
39
49
 
50
+ // Show the modal once the component is mounted.
40
51
  componentDidMount() {
41
- $(React.findDOMNode(this.refs.errorModal)).modal('show');
52
+ // Caller can specify an amount of time to wait for before showing the
53
+ // modal. This is helpful if the caller wants to finish some work
54
+ // before showing error modal.
55
+ setTimeout(function () {
56
+ $(React.findDOMNode(this.refs.errorModal)).modal('show');
57
+ }.bind(this), this.props.beforeShow || 0);
42
58
  }
43
59
  }
44
60
 
61
+ /**
62
+ * Renders ErrorModal.
63
+ */
45
64
  export default function showErrorModal (errorData, beforeShow) {
46
- if (!beforeShow) {
47
- beforeShow = function () {};
48
- }
49
-
50
- setTimeout(function () {
51
- beforeShow();
52
- React.render(<ErrorModal errorData={errorData}/>,
53
- document.getElementById('view'));
54
- }, 500);
65
+ React.render(<ErrorModal errorData={errorData}
66
+ beforeShow={beforeShow}/>, document.getElementById('view'));
55
67
  }
data/public/js/search.js CHANGED
@@ -366,11 +366,13 @@ var Query = React.createClass({
366
366
  <div
367
367
  className="sequence">
368
368
  <textarea
369
- className="form-control text-monospace" id="sequence"
370
- rows="10" spellCheck="false" autoFocus="true"
371
- name="sequence" value={this.state.value}
372
- ref="textarea" onChange={this.handleInput}
373
- placeholder="Paste query sequence(s) or drag file containing query sequence(s) in FASTA format here ..." >
369
+ id="sequence" ref="textarea"
370
+ className="form-control text-monospace"
371
+ name="sequence" value={this.state.value}
372
+ placeholder="Paste query sequence(s) or drag file
373
+ containing query sequence(s) in FASTA format here ..."
374
+ spellCheck="false" autoFocus="true"
375
+ onChange={this.handleInput}>
374
376
  </textarea>
375
377
  </div>
376
378
  <div