Skip to content

Commit 6f8d995

Browse files
committed
Show message for sequence greater than 7000 and less than 10 nucleotides
1 parent d032e36 commit 6f8d995

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/actions/actionTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const SET_STATUS_TIMEOUT = 'SET_STATUS_TIMEOUT';
1616
// submission form
1717
export const SUBMIT_JOB = 'SUBMIT_JOB';
1818
export const SUBMIT_MULTIPLE_JOB = 'SUBMIT_MULTIPLE_JOB';
19-
export const LONG_SEQUENCE = 'LONG_SEQUENCE';
19+
export const INVALID_SEQUENCE = 'INVALID_SEQUENCE';
2020
export const UPDATE_JOB_ID = 'UPDATE_JOB_ID';
2121
export const CLEAR_JOB_ID = 'CLEAR_JOB_ID';
2222
export const CLEAR_RESULT = 'CLEAR_RESULT';

src/actions/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ export function onClearResult() {
113113
return {type: types.CLEAR_RESULT}
114114
}
115115

116-
export function longSequence() {
117-
return {type: types.LONG_SEQUENCE}
116+
export function invalidSequence() {
117+
return {type: types.INVALID_SEQUENCE}
118118
}
119119

120120
export function fetchStatus(jobId) {

src/containers/SequenceSearch/components/SearchForm/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class SearchForm extends React.Component {
4444
store.dispatch(actions.onMultipleSubmit(getSequence, this.props.databases));
4545
} else if (state.sequence && state.sequence.match("^([0-9a-fA-F]{8})-(([0-9a-fA-F]{4}\\-){3})([0-9a-fA-F]{12})$")) {
4646
store.dispatch(actions.updateJobId(state.sequence));
47-
} else if (state.sequence && state.sequence.length <= 7000) {
47+
} else if (state.sequence && (state.sequence.length < 10 || state.sequence.length > 7000)) {
48+
store.dispatch(actions.invalidSequence());
49+
} else if (state.sequence) {
4850
store.dispatch(actions.onSubmit(state.sequence, this.props.databases));
49-
} else if (state.sequence && state.sequence.length > 7000) {
50-
store.dispatch(actions.longSequence());
5151
}
5252

5353
state.sequence = "";
@@ -97,10 +97,10 @@ class SearchForm extends React.Component {
9797
)
9898
}
9999
{
100-
this.props.status === "longSequence" && (
100+
this.props.status === "invalidSequence" && (
101101
<div className="small-12 columns">
102-
<div className="callout alert">
103-
<h4>The sequence cannot be longer than 7000 nucleotides</h4>
102+
<div className="callout warning">
103+
{this.props.sequence.length < 10 ? <p>The sequence cannot be shorter than 10 nucleotides</p> : <p>The sequence cannot be longer than 7000 nucleotides</p>}
104104
</div>
105105
</div>
106106
)

src/reducers/rootReducer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ const rootReducer = function (state = initialState, action) {
174174
exactMatch: null,
175175
});
176176

177-
case actions.LONG_SEQUENCE:
178-
return Object.assign({}, state, {status: "longSequence"});
177+
case actions.INVALID_SEQUENCE:
178+
return Object.assign({}, state, {status: "invalidSequence"});
179179

180180
case actions.FETCH_STATUS:
181181
if (action.status === 'error') {

0 commit comments

Comments
 (0)