Skip to content

Commit d86573a

Browse files
committed
Clear results when selecting another Job ID
1 parent 7d8dd45 commit d86573a

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/actions/actionTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const SUBMIT_MULTIPLE_JOB = 'SUBMIT_MULTIPLE_JOB';
1919
export const LONG_SEQUENCE = 'LONG_SEQUENCE';
2020
export const UPDATE_JOB_ID = 'UPDATE_JOB_ID';
2121
export const CLEAR_JOB_ID = 'CLEAR_JOB_ID';
22+
export const CLEAR_RESULT = 'CLEAR_RESULT';
2223
export const TEXTAREA_CHANGE = 'TEXTAREA_CHANGE';
2324
export const EXAMPLE_SEQUENCE = 'EXAMPLE_SEQUENCE';
2425
export const CLEAR_SEQUENCE = 'CLEAR_SEQUENCE';

src/actions/actions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export function onClearJobId() {
109109
return {type: types.CLEAR_JOB_ID}
110110
}
111111

112+
export function onClearResult() {
113+
return {type: types.CLEAR_RESULT}
114+
}
115+
112116
export function longSequence() {
113117
return {type: types.LONG_SEQUENCE}
114118
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Results extends React.Component {
1919
if (e.target.value === 'Select a job ID'){
2020
store.dispatch(actionCreators.onClearJobId());
2121
} else {
22+
store.dispatch(actionCreators.onClearResult());
2223
store.dispatch(actionCreators.updateJobId(e.target.value));
2324
}
2425
}

src/reducers/rootReducer.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ const rootReducer = function (state = initialState, action) {
154154
case actions.CLEAR_JOB_ID:
155155
return Object.assign({}, state, {jobId: null, sequence: ""});
156156

157+
case actions.CLEAR_RESULT:
158+
return Object.assign({}, state, {
159+
jobId: null,
160+
sequence: "",
161+
hits: null,
162+
status: "notSubmitted",
163+
entries: [],
164+
facets: [],
165+
hitCount: 0,
166+
start: 0,
167+
size: 20,
168+
ordering: "e_value",
169+
selectedFacets: {},
170+
alignmentsCollapsed: true,
171+
textSearchError: false,
172+
infernalStatus: "notSubmitted",
173+
infernalEntries: [],
174+
exactMatch: null,
175+
});
176+
157177
case actions.LONG_SEQUENCE:
158178
return Object.assign({}, state, {status: "longSequence"});
159179

0 commit comments

Comments
 (0)