Skip to content

Commit

Permalink
Revert "#27 #28 added autocompletion with topterms for general search…
Browse files Browse the repository at this point in the history
… field"

This reverts commit c462e6e.
  • Loading branch information
leoek committed Nov 5, 2018
1 parent 510cb41 commit e90bf27
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
11 changes: 4 additions & 7 deletions frontend/src/components/SearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { withStyles } from "@material-ui/core/styles";
import { Field, reduxForm } from "redux-form";
import { translate } from "react-i18next";
import classnames from "classnames";
import { getSearchIsFetching, getSuggestValue } from "../redux/selectors";
import { getSearchIsFetching } from "../redux/selectors";

import { RenderCheckbox, InputAutoSuggest } from "./common/InputFields";
import { RenderTextField, RenderCheckbox } from "./common/InputFields";

const styles = theme => ({
root: {
Expand Down Expand Up @@ -107,13 +107,10 @@ export class SearchForm extends Component {
lg={10}
className={classes.formItemContainer}
>
<InputAutoSuggest
<Field
label={t("searchform.search.querylbl")}
name="query"
options={{
endpoint: "top"
}}
suggestionsSelector={getSuggestValue("topTerms")("query")}
component={RenderTextField}
className={classes.formItem}
/>
</Grid>
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/components/common/InputFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ const RawInputAutoSuggest = ({
count,
suggestions,
classes,
fetchSuggestRequest,
options
fetchSuggestRequest
}) => (
<Field
label={label}
Expand All @@ -73,8 +72,7 @@ const RawInputAutoSuggest = ({
fetchSuggestRequest({
s: value,
field: name,
count,
options
count
})
}
handleClearSuggestions={() => false}
Expand All @@ -84,11 +82,9 @@ const RawInputAutoSuggest = ({
export const InputAutoSuggest = compose(
connect(
(state, ownProps) => {
const { name, suggestionsSelector } = ownProps;
const { name } = ownProps;
return {
suggestions: suggestionsSelector
? suggestionsSelector(state)
: getSuggestions(name)(state)
suggestions: getSuggestions(name)(state)
};
},
{ fetchSuggestRequest }
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import datasheetFormat, { ingredientFormat } from "./datasheetFormat";
const devEnv = process.env.NODE_ENV === "development";

const devConfig = {
//apiBaseUrl: "http://localhost:8080"
apiBaseUrl: "https://api.mss.leoek.tech"
apiBaseUrl: "http://localhost:8080"
//apiBaseUrl: "https://api.mss.leoek.tech"
};

export const baseConfig = {
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/redux/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,13 @@ export const FETCH_SUGGEST_REQUEST = "MSS/FETCH_SUGGEST_REQUEST";
export const fetchSuggestRequest = ({
s,
field,
count = config.DEFAULTS.suggestionCount,
options
count = config.DEFAULTS.suggestionCount
}) => ({
type: FETCH_SUGGEST_REQUEST,
payload: {
s,
field,
count,
options
count
}
});

Expand Down
5 changes: 2 additions & 3 deletions frontend/src/redux/sagas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ const handleResponseJsonError = (errorMessage, statusCode) => {

export function* fetchSuggestSaga(action) {
const { payload = {} } = action;
const { field, s, count, options = {} } = payload;
const { endpoint = "suggest" } = options;
const { field, s, count } = payload;
const parameters = {
field,
count,
s
};
const response = yield get({
endpoint,
endpoint: "suggest",
parameters
});
const reponseData = yield response.json().catch(handleResponseJsonError);
Expand Down

0 comments on commit e90bf27

Please sign in to comment.