diff --git a/js/components/common/Components/SearchField/index.js b/js/components/common/Components/SearchField/index.js
index 289f28649..8b0543b58 100644
--- a/js/components/common/Components/SearchField/index.js
+++ b/js/components/common/Components/SearchField/index.js
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
-import { makeStyles, TextField, InputAdornment } from '@material-ui/core';
+import { makeStyles, TextField, InputAdornment, IconButton } from '@material-ui/core';
import { Search } from '@material-ui/icons';
import classNames from 'classnames';
import { debounce } from 'lodash';
@@ -31,9 +31,18 @@ const useStyles = makeStyles(theme => ({
}
}));
-const SearchField = ({ className, id, placeholder, size, onChange, disabled, searchString }) => {
+const SearchField = ({
+ className,
+ id,
+ placeholder,
+ size,
+ onChange,
+ disabled,
+ searchString,
+ searchIconAction = null
+}) => {
const classes = useStyles();
- let value = searchString ?? '';
+ let value = searchString ?? '';
const debounced = useMemo(
() =>
@@ -57,7 +66,17 @@ const SearchField = ({ className, id, placeholder, size, onChange, disabled, sea
InputProps={{
startAdornment: (
-
+ {searchIconAction ? (
+ searchIconAction(true)}
+ >
+
+
+ ) : (
+
+ )}
),
className: classes.input
diff --git a/js/components/preview/molecule/moleculeList.js b/js/components/preview/molecule/moleculeList.js
index 06f58d1f7..208277912 100644
--- a/js/components/preview/molecule/moleculeList.js
+++ b/js/components/preview/molecule/moleculeList.js
@@ -45,7 +45,8 @@ import {
withDisabledMoleculesNglControlButtons,
removeSelectedTypesInHitNavigator,
selectAllHits,
- autoHideTagEditorDialogsOnScroll
+ autoHideTagEditorDialogsOnScroll,
+ searchForObservations
} from './redux/dispatchActions';
import { DEFAULT_FILTER, PREDEFINED_FILTERS } from '../../../reducers/selection/constants';
import { Edit, FilterList } from '@material-ui/icons';
@@ -288,6 +289,8 @@ export const MoleculeList = memo(({ hideProjects }) => {
const object_selection = useSelector(state => state.selectionReducers.mol_group_selection);
+ const searchSettings = useSelector(state => state.selectionReducers.searchSettings);
+
const all_mol_lists = useSelector(state => state.apiReducers.all_mol_lists);
const directDisplay = useSelector(state => state.apiReducers.direct_access);
const directAccessProcessed = useSelector(state => state.apiReducers.direct_access_processed);
@@ -321,17 +324,13 @@ export const MoleculeList = memo(({ hideProjects }) => {
}, [object_selection]);*/
let joinedMoleculeLists = useMemo(() => {
- // const searchedString = currentActionList.find(action => action.type === 'SEARCH_STRING_HIT_NAVIGATOR');
if (searchString) {
- return allMoleculesList.filter(molecule => molecule.code.toLowerCase().includes(searchString.toLowerCase()));
- // } else if (searchedString) {
- // return getJoinedMoleculeList.filter(molecule =>
- // molecule.protein_code.toLowerCase().includes(searchedString.searchStringHitNavigator.toLowerCase())
- // );
+ // return allMoleculesList.filter(molecule => molecule.code.toLowerCase().includes(searchString.toLowerCase()));
+ return dispatch(searchForObservations(searchString, allMoleculesList, searchSettings));
} else {
return getJoinedMoleculeList;
}
- }, [getJoinedMoleculeList, allMoleculesList, searchString]);
+ }, [searchString, dispatch, allMoleculesList, searchSettings, getJoinedMoleculeList]);
const addSelectedMoleculesFromUnselectedSites = useCallback(
(joinedMoleculeLists, list) => {
@@ -849,40 +848,7 @@ export const MoleculeList = memo(({ hideProjects }) => {
const openGlobalTagEditor = () => {};
- // let filterSearchString = '';
- // const getSearchedString = () => {
- // filterSearchString = currentActionList.find(action => action.type === 'SEARCH_STRING_HIT_NAVIGATOR');
- // };
- // getSearchedString();
-
- // useEffect(() => {
- // if (filterSearchString?.searchStringHitNavigator !== '') {
- // setSearchString(filterSearchString.searchStringHitNavigator);
- // }
- // }, [filterSearchString]);
-
const actions = [
- /* do not disable filter by itself if it does not have any result */
- /*
-
- ,*/
({
container: {
@@ -277,7 +280,6 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
const moleculesPerPage = 30;
const [currentPage, setCurrentPage] = useState(0);
const searchString = useSelector(state => state.previewReducers.molecule.searchStringLHS);
- // const [searchString, setSearchString] = useState(null);
const [sortDialogAnchorEl, setSortDialogAnchorEl] = useState(null);
const oldUrl = useRef('');
const setOldUrl = url => {
@@ -327,6 +329,9 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
const proteinsHasLoaded = useSelector(state => state.nglReducers.proteinsHasLoaded);
+ const searchSettingsDialogOpen = useSelector(state => state.selectionReducers.searchSettingsDialogOpen);
+ const searchSettings = useSelector(state => state.selectionReducers.searchSettings);
+
const [predefinedFilter, setPredefinedFilter] = useState(filter !== undefined ? filter.predefined : DEFAULT_FILTER);
const [ascending, setAscending] = useState(true);
@@ -467,17 +472,12 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
}, [object_selection]);*/
let joinedMoleculeLists = useMemo(() => {
- // const searchedString = currentActionList.find(action => action.type === 'SEARCH_STRING_HIT_NAVIGATOR');
if (searchString) {
- return allMoleculesList.filter(molecule => molecule.code.toLowerCase().includes(searchString.toLowerCase()));
- // } else if (searchedString) {
- // return getJoinedMoleculeList.filter(molecule =>
- // molecule.protein_code.toLowerCase().includes(searchedString.searchStringHitNavigator.toLowerCase())
- // );
+ return dispatch(searchForObservations(searchString, allMoleculesList, searchSettings));
} else {
return getJoinedMoleculeList;
}
- }, [getJoinedMoleculeList, allMoleculesList, searchString]);
+ }, [searchString, dispatch, allMoleculesList, getJoinedMoleculeList, searchSettings]);
const addSelectedMoleculesFromUnselectedSites = useCallback(
(joinedMoleculeLists, list) => {
@@ -1014,6 +1014,10 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
return molecules;
};
+ const openSearchSettingsDialog = open => {
+ dispatch(setSearchSettingsDialogOpen(open));
+ };
+
const actions = [
{
// searchString={filterSearchString?.searchStringHitNavigator ?? ''}
searchString={searchString ?? ''}
placeholder="Search"
+ searchIconAction={openSearchSettingsDialog}
/>,
{
setIsOpenLPCAlert(false);
}}
/>
+ {searchSettingsDialogOpen && (
+
+ )}
{isObservationDialogOpen && (
)}
diff --git a/js/components/preview/molecule/observationsDialog.js b/js/components/preview/molecule/observationsDialog.js
index 09527cf83..f23bd201a 100644
--- a/js/components/preview/molecule/observationsDialog.js
+++ b/js/components/preview/molecule/observationsDialog.js
@@ -24,6 +24,7 @@ import {
removeObservationsFromPose,
removeSelectedMolTypes,
removeSurface,
+ searchForObservations,
updateObservationsInPose,
updatePose,
withDisabledMoleculesNglControlButtons
@@ -49,9 +50,19 @@ import MoleculeView from './moleculeView';
import { TagEditor } from '../tags/modal/tagEditor';
import { ToastContext } from '../../toast';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';
-import { updateLHSCompound, updateMoleculeInMolLists, updateMoleculeTag, updateTag } from '../../../reducers/api/actions';
+import {
+ updateLHSCompound,
+ updateMoleculeInMolLists,
+ updateMoleculeTag,
+ updateTag
+} from '../../../reducers/api/actions';
import { createPoseErrorMessage } from './api/poseApi';
-import { augumentTagObjectWithId, createMoleculeTagObject, DEFAULT_TAG_COLOR, getMoleculeTagForTag } from '../tags/utils/tagUtils';
+import {
+ augumentTagObjectWithId,
+ createMoleculeTagObject,
+ DEFAULT_TAG_COLOR,
+ getMoleculeTagForTag
+} from '../tags/utils/tagUtils';
import { updateExistingTag } from '../tags/api/tagsApi';
import { XCA_TAGS_CATEGORIES } from './moleculeView/moleculeView';
@@ -251,6 +262,8 @@ export const ObservationsDialog = memo(
const tagList = useSelector(state => state.apiReducers.moleculeTags);
const targetId = useSelector(state => state.apiReducers.target_on);
+ const searchSettings = useSelector(state => state.selectionReducers.searchSettings);
+
const poses = useSelector(state => state.apiReducers.lhs_compounds_list);
const compatiblePoses = useMemo(() => {
const someObservation = observationsDataList[0];
@@ -270,9 +283,9 @@ export const ObservationsDialog = memo(
const tagEditorRef = useRef();
const getCalculatedTagColumnWidth = (tagText, font = null) => {
- const canvas = document.createElement("canvas");
- const ctx = canvas.getContext("2d");
- ctx.font = `${(font ?? '12px')} "Roboto", "Helvetica", "Arial", sans-serif`;
+ const canvas = document.createElement('canvas');
+ const ctx = canvas.getContext('2d');
+ ctx.font = `${font ?? '12px'} "Roboto", "Helvetica", "Arial", sans-serif`;
// 16 as padding buffer
const calculatedWidth = ctx.measureText(tagText).width + 16;
return calculatedWidth;
@@ -302,19 +315,20 @@ export const ObservationsDialog = memo(
setHeaderWidths(old => {
const newWidths = { ...old };
newWidths[tagCategory] = calculatedWidth;
- return { ...newWidths }
+ return { ...newWidths };
});
}
};
const moleculeList = useMemo(() => {
if (searchString !== null) {
- return observationsDataList.filter(molecule =>
- molecule.code.toLowerCase().includes(searchString.toLowerCase())
- );
+ // return observationsDataList.filter(molecule =>
+ // molecule.code.toLowerCase().includes(searchString.toLowerCase())
+ // );
+ return dispatch(searchForObservations(searchString, observationsDataList, searchSettings));
}
return observationsDataList;
- }, [observationsDataList, searchString]);
+ }, [dispatch, observationsDataList, searchSettings, searchString]);
const allSelectedMolecules = useMemo(
() => observationsDataList.filter(molecule => moleculesToEditIds.includes(molecule.id)),
@@ -630,7 +644,9 @@ export const ObservationsDialog = memo(
const totalApproximateHeight = observationsApproximateHeight + headerFooterApproximateHeight;
/*if (totalApproximateHeight > maxHeight) {
height = maxHeight;
- } else*/ if (totalApproximateHeight < MIN_PANEL_HEIGHT) {
+ } else*/ if (
+ totalApproximateHeight < MIN_PANEL_HEIGHT
+ ) {
height = MIN_PANEL_HEIGHT;
} else {
height = totalApproximateHeight;
@@ -646,15 +662,20 @@ export const ObservationsDialog = memo(
* @param {string} category
* @return {array}
*/
- const getTagsForCategory = useCallback(category => {
- const tagCategory = tagCategoriesList.find(tagCategory => tagCategory.category === category);
- return tagCategory ? tagList.filter(tag => {
- if (tag.category === tagCategory.id) {
- // console.log('good tag', { ...tag });
- return true;
- } else return false;
- }) : [];
- }, [tagCategoriesList, tagList]);
+ const getTagsForCategory = useCallback(
+ category => {
+ const tagCategory = tagCategoriesList.find(tagCategory => tagCategory.category === category);
+ return tagCategory
+ ? tagList.filter(tag => {
+ if (tag.category === tagCategory.id) {
+ // console.log('good tag', { ...tag });
+ return true;
+ } else return false;
+ })
+ : [];
+ },
+ [tagCategoriesList, tagList]
+ );
const updateCmp = (cmp, obs) => {
let newCmp = { ...cmp };
@@ -849,7 +870,10 @@ export const ObservationsDialog = memo(
}
// then tag
await tagObservations(tag, mainObservationTag);
- toastInfo(`Tag for observations was changed from "${mainObservationTag.upload_name}" to "${tag.upload_name}". They could disappear based on your tag selection`, { autoHideDuration: 5000 });
+ toastInfo(
+ `Tag for observations was changed from "${mainObservationTag.upload_name}" to "${tag.upload_name}". They could disappear based on your tag selection`,
+ { autoHideDuration: 5000 }
+ );
};
/**
@@ -858,10 +882,17 @@ export const ObservationsDialog = memo(
* @param {string} category category of tag
* @returns {boolean}
*/
- const disableXCATagChange = useCallback(category => {
- // #1522 CanonSite tags should not be allowed to change if there are selected only some observations
- return category === 'CanonSites' && allSelectedMolecules.length > 0 && (allSelectedMolecules.length !== moleculeList.length);
- }, [allSelectedMolecules, moleculeList]);
+ const disableXCATagChange = useCallback(
+ category => {
+ // #1522 CanonSite tags should not be allowed to change if there are selected only some observations
+ return (
+ category === 'CanonSites' &&
+ allSelectedMolecules.length > 0 &&
+ allSelectedMolecules.length !== moleculeList.length
+ );
+ },
+ [allSelectedMolecules, moleculeList]
+ );
return (
@@ -1006,27 +1037,40 @@ export const ObservationsDialog = memo(
{expandView && (
-
- {XCA_TAGS_CATEGORIES.map(
- (tagCategory, index) => (
-
- {PLURAL_TO_SINGULAR[tagCategory]}
-
- )
- )}
-
+
+ {XCA_TAGS_CATEGORIES.map((tagCategory, index) => (
+
+ {PLURAL_TO_SINGULAR[tagCategory]}
+
+ ))}
+
CentroidRes
-
+
LongCode
-
+
Path
@@ -1158,19 +1202,34 @@ export const ObservationsDialog = memo(
Change XCA tags
- {XCA_TAG_CATEGORIES.map(category =>
-
+ {XCA_TAG_CATEGORIES.map(category => (
+
Change {PLURAL_TO_SINGULAR[category]}
- {!disableXCATagChange(category) &&
-
+ {!disableXCATagChange(category) && (
+
{getTagsForCategory(category)?.map(tag => (
- handleXCAtagChange(tag)}>
+ handleXCAtagChange(tag)}
+ >
{tag.upload_name}
))}
- }
+
+ )}
- )}
+ ))}
diff --git a/js/components/preview/molecule/redux/dispatchActions.js b/js/components/preview/molecule/redux/dispatchActions.js
index ac0044287..0348b1911 100644
--- a/js/components/preview/molecule/redux/dispatchActions.js
+++ b/js/components/preview/molecule/redux/dispatchActions.js
@@ -1213,3 +1213,31 @@ export const updatePose = newPose => async (dispatch, getState) => {
export const createPose = newPose => async (dispatch, getState) => {
return createPoseApi(newPose);
};
+
+const observationSearchFunctions = {
+ shortcode: (obs, searchTerm) => {
+ return obs.code.toLowerCase().includes(searchTerm.toLowerCase());
+ },
+ aliases: (obs, searchTerm) => {
+ return true;
+ },
+ compoundId: (obs, searchTerm) => {
+ return obs.compound_code.toLowerCase().includes(searchTerm.toLowerCase());
+ }
+};
+
+export const searchForObservations = (searchTerm, observations, searchSettings) => (dispatch, getState) => {
+ if (!observations || observations.length === 0) return [];
+ if (!searchTerm) return observations;
+
+ let result = [];
+
+ const searchBy = searchSettings.searchBy;
+ const searchByKeys = Object.keys(searchBy).filter(key => searchBy[key]);
+
+ result = observations.filter(obs => {
+ return searchByKeys.reduce((acc, key) => acc || observationSearchFunctions[key](obs, searchTerm), false);
+ });
+
+ return result;
+};
diff --git a/js/components/preview/molecule/searchSettingsDialog.js b/js/components/preview/molecule/searchSettingsDialog.js
new file mode 100644
index 000000000..2916f403e
--- /dev/null
+++ b/js/components/preview/molecule/searchSettingsDialog.js
@@ -0,0 +1,115 @@
+import React, { memo, useState } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+import { Grid, makeStyles, Checkbox, Typography, FormControlLabel } from '@material-ui/core';
+import { Button, Modal } from '../../common';
+import { setSearchSettings } from '../../../reducers/selection/actions';
+
+const useStyles = makeStyles(theme => ({
+ body: {
+ width: '100%',
+ marginTop: theme.spacing(2),
+ marginBottom: theme.spacing(1)
+ },
+ margin: {
+ marginTop: theme.spacing(1)
+ },
+ checkbox: {
+ margin: theme.spacing(0)
+ }
+}));
+
+export const SearchSettingsDialog = memo(({ openDialog, setOpenDialog }) => {
+ const dispatch = useDispatch();
+ const classes = useStyles();
+
+ const searchSettings = useSelector(state => state.selectionReducers.searchSettings);
+
+ const [shortcode, setShortcode] = useState(searchSettings.searchBy.shortcode);
+ const [aliases, setAliases] = useState(searchSettings.searchBy.aliases);
+ const [compoundId, setCompoundId] = useState(searchSettings.searchBy.compoundId);
+
+ const handleCloseModal = () => {
+ setOpenDialog(false);
+ };
+
+ const handleSaveButton = () => {
+ dispatch(setSearchSettings({ searchBy: { shortcode, aliases, compoundId } }));
+ setOpenDialog(false);
+ };
+
+ return (
+
+ <>
+ Search settings
+
+ Search by:
+
+
+
+ {
+ setShortcode(prev => !prev);
+ }}
+ />
+ }
+ label="Shortcode"
+ labelPlacement="end"
+ className={classes.checkbox}
+ />
+
+
+ {
+ setAliases(prev => !prev);
+ }}
+ />
+ }
+ label="Aliases"
+ labelPlacement="end"
+ className={classes.checkbox}
+ />
+
+
+ {
+ setCompoundId(prev => !prev);
+ }}
+ />
+ }
+ label="Compound ID"
+ labelPlacement="end"
+ className={classes.checkbox}
+ />
+
+
+
+
+
+
+
+
+
+
+ >
+
+ );
+});
diff --git a/js/reducers/selection/actions.js b/js/reducers/selection/actions.js
index cb8f6afdd..3a5883e2b 100644
--- a/js/reducers/selection/actions.js
+++ b/js/reducers/selection/actions.js
@@ -4,14 +4,14 @@
import { constants } from './constants';
-export const setToBuyList = function (to_buy_list) {
+export const setToBuyList = function(to_buy_list) {
return {
type: constants.SET_TO_BUY_LIST,
to_buy_list: to_buy_list
};
};
-export const appendToBuyList = function (item, index, skipTracking = false) {
+export const appendToBuyList = function(item, index, skipTracking = false) {
return {
type: constants.APPEND_TO_BUY_LIST,
item: item,
@@ -20,7 +20,7 @@ export const appendToBuyList = function (item, index, skipTracking = false) {
};
};
-export const removeFromToBuyList = function (item, index, skipTracking = false) {
+export const removeFromToBuyList = function(item, index, skipTracking = false) {
return {
type: constants.REMOVE_FROM_TO_BUY_LIST,
item: item,
@@ -29,21 +29,21 @@ export const removeFromToBuyList = function (item, index, skipTracking = false)
};
};
-export const appendToBuyListAll = function (items) {
+export const appendToBuyListAll = function(items) {
return {
type: constants.APPEND_TO_BUY_LIST_ALL,
items: items
};
};
-export const removeFromToBuyListAll = function (items) {
+export const removeFromToBuyListAll = function(items) {
return {
type: constants.REMOVE_FROM_BUY_LIST_ALL,
items: items
};
};
-export const setVectorList = function (vectList) {
+export const setVectorList = function(vectList) {
return {
type: constants.SET_VECTOR_LIST,
vector_list: vectList
@@ -57,7 +57,7 @@ export const setCurrentVector = vectorSmile => {
};
};
-export const setFragmentDisplayList = function (fragmentDisplayList, skipTracking = false) {
+export const setFragmentDisplayList = function(fragmentDisplayList, skipTracking = false) {
return {
type: constants.SET_FRAGMENT_DISPLAY_LIST,
fragmentDisplayList: fragmentDisplayList,
@@ -65,7 +65,7 @@ export const setFragmentDisplayList = function (fragmentDisplayList, skipTrackin
};
};
-export const appendFragmentDisplayList = function (item, skipTracking = false) {
+export const appendFragmentDisplayList = function(item, skipTracking = false) {
return {
type: constants.APPEND_FRAGMENT_DISPLAY_LIST,
item: item,
@@ -73,7 +73,7 @@ export const appendFragmentDisplayList = function (item, skipTracking = false) {
};
};
-export const removeFromFragmentDisplayList = function (item, skipTracking = false) {
+export const removeFromFragmentDisplayList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_FRAGMENT_DISPLAY_LIST,
item: item,
@@ -81,7 +81,7 @@ export const removeFromFragmentDisplayList = function (item, skipTracking = fals
};
};
-export const setProteinList = function (proteinList, skipTracking = false) {
+export const setProteinList = function(proteinList, skipTracking = false) {
return {
type: constants.SET_PROTEIN_LIST,
proteinList: proteinList,
@@ -89,7 +89,7 @@ export const setProteinList = function (proteinList, skipTracking = false) {
};
};
-export const appendProteinList = function (item, skipTracking = false) {
+export const appendProteinList = function(item, skipTracking = false) {
return {
type: constants.APPEND_PROTEIN_LIST,
item: item,
@@ -97,14 +97,14 @@ export const appendProteinList = function (item, skipTracking = false) {
};
};
-export const removeFromProteinList = function (item, skipTracking = false) {
+export const removeFromProteinList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_PROTEIN_LIST,
item: item,
skipTracking: skipTracking
};
};
-export const setComplexList = function (complexList, skipTracking = false) {
+export const setComplexList = function(complexList, skipTracking = false) {
return {
type: constants.SET_COMPLEX_LIST,
complexList: complexList,
@@ -112,7 +112,7 @@ export const setComplexList = function (complexList, skipTracking = false) {
};
};
-export const appendComplexList = function (item, skipTracking = false) {
+export const appendComplexList = function(item, skipTracking = false) {
return {
type: constants.APPEND_COMPLEX_LIST,
item: item,
@@ -120,7 +120,7 @@ export const appendComplexList = function (item, skipTracking = false) {
};
};
-export const removeFromComplexList = function (item, skipTracking = false) {
+export const removeFromComplexList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_COMPLEX_LIST,
item: item,
@@ -128,7 +128,7 @@ export const removeFromComplexList = function (item, skipTracking = false) {
};
};
-export const setSurfaceList = function (surfaceList, skipTracking = false) {
+export const setSurfaceList = function(surfaceList, skipTracking = false) {
return {
type: constants.SET_SURFACE_LIST,
surfaceList: surfaceList,
@@ -136,7 +136,7 @@ export const setSurfaceList = function (surfaceList, skipTracking = false) {
};
};
-export const appendSurfaceList = function (item, skipTracking = false) {
+export const appendSurfaceList = function(item, skipTracking = false) {
return {
type: constants.APPEND_SURFACE_LIST,
item: item,
@@ -144,7 +144,7 @@ export const appendSurfaceList = function (item, skipTracking = false) {
};
};
-export const removeFromSurfaceList = function (item, skipTracking = false) {
+export const removeFromSurfaceList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_SURFACE_LIST,
item: item,
@@ -168,14 +168,14 @@ export const removeFromDensityListType = (item, skipTracking = false) => {
};
};
-export const setDensityList = function (densityList) {
+export const setDensityList = function(densityList) {
return {
type: constants.SET_DENSITY_LIST,
densityList: densityList
};
};
-export const appendDensityList = function (item, skipTracking = false) {
+export const appendDensityList = function(item, skipTracking = false) {
return {
type: constants.APPEND_DENSITY_LIST,
item: item,
@@ -183,7 +183,7 @@ export const appendDensityList = function (item, skipTracking = false) {
};
};
-export const removeFromDensityList = function (item, skipTracking = false) {
+export const removeFromDensityList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_DENSITY_LIST,
item: item,
@@ -191,14 +191,14 @@ export const removeFromDensityList = function (item, skipTracking = false) {
};
};
-export const setDensityListCustom = function (densityListCustom) {
+export const setDensityListCustom = function(densityListCustom) {
return {
type: constants.SET_DENSITY_LIST_CUSTOM,
densityListCustom: densityListCustom
};
};
-export const appendDensityListCustom = function (item, skipTracking = false) {
+export const appendDensityListCustom = function(item, skipTracking = false) {
return {
type: constants.APPEND_DENSITY_LIST_CUSTOM,
item: item,
@@ -206,7 +206,7 @@ export const appendDensityListCustom = function (item, skipTracking = false) {
};
};
-export const removeFromDensityListCustom = function (item, skipTracking = false) {
+export const removeFromDensityListCustom = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_DENSITY_LIST_CUSTOM,
item: item,
@@ -214,7 +214,7 @@ export const removeFromDensityListCustom = function (item, skipTracking = false)
};
};
-export const setQualityList = function (qualityList, skipTracking = false) {
+export const setQualityList = function(qualityList, skipTracking = false) {
return {
type: constants.SET_QUALITY_LIST,
qualityList: qualityList,
@@ -222,21 +222,21 @@ export const setQualityList = function (qualityList, skipTracking = false) {
};
};
-export const appendInformationList = function (item) {
+export const appendInformationList = function(item) {
return {
type: constants.APPEND_INFORMATION_LIST,
item: item
};
};
-export const removeFromInformationList = function (item) {
+export const removeFromInformationList = function(item) {
return {
type: constants.REMOVE_FROM_INFORMATION_LIST,
item: item
};
};
-export const appendQualityList = function (item, skipTracking = false) {
+export const appendQualityList = function(item, skipTracking = false) {
return {
type: constants.APPEND_QUALITY_LIST,
item: item,
@@ -244,7 +244,7 @@ export const appendQualityList = function (item, skipTracking = false) {
};
};
-export const removeFromQualityList = function (item, skipTracking = false) {
+export const removeFromQualityList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_QUALITY_LIST,
item: item,
@@ -252,7 +252,7 @@ export const removeFromQualityList = function (item, skipTracking = false) {
};
};
-export const setVectorOnList = function (vectorOnList, skipTracking = false) {
+export const setVectorOnList = function(vectorOnList, skipTracking = false) {
return {
type: constants.SET_VECTOR_ON_LIST,
vectorOnList: vectorOnList,
@@ -260,7 +260,7 @@ export const setVectorOnList = function (vectorOnList, skipTracking = false) {
};
};
-export const appendVectorOnList = function (item, skipTracking = false) {
+export const appendVectorOnList = function(item, skipTracking = false) {
return {
type: constants.APPEND_VECTOR_ON_LIST,
item: item,
@@ -268,7 +268,7 @@ export const appendVectorOnList = function (item, skipTracking = false) {
};
};
-export const removeFromVectorOnList = function (item, skipTracking = false) {
+export const removeFromVectorOnList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_VECTOR_ON_LIST,
item: item,
@@ -283,7 +283,7 @@ export const reloadSelectionReducer = savedSelectionReducers => {
};
};
-export const resetSelectionState = function () {
+export const resetSelectionState = function() {
return {
type: constants.RESET_SELECTION_STATE
};
@@ -374,7 +374,7 @@ export const setArrowUpDown = (item, newItem, arrowType, data) => ({
}
});
-export const setSelectedTagList = function (selectedTagList, skipTracking = false) {
+export const setSelectedTagList = function(selectedTagList, skipTracking = false) {
return {
type: constants.SET_SELECTED_TAG_LIST,
selectedTagList: selectedTagList,
@@ -382,7 +382,7 @@ export const setSelectedTagList = function (selectedTagList, skipTracking = fals
};
};
-export const appendSelectedTagList = function (item, skipTracking = false) {
+export const appendSelectedTagList = function(item, skipTracking = false) {
return {
type: constants.APPEND_SELECTED_TAG_LIST,
item: item,
@@ -390,7 +390,7 @@ export const appendSelectedTagList = function (item, skipTracking = false) {
};
};
-export const removeFromSelectedTagList = function (item, skipTracking = false) {
+export const removeFromSelectedTagList = function(item, skipTracking = false) {
return {
type: constants.REMOVE_FROM_SELECTED_TAG_LIST,
item: item,
@@ -652,3 +652,17 @@ export const updateInToBeDisplayedList = item => {
item: item
};
};
+
+export const setSearchSettingsDialogOpen = isOpen => {
+ return {
+ type: constants.SET_SEARCH_SETTINGS_DIALOG_OPEN,
+ isOpen: isOpen
+ };
+};
+
+export const setSearchSettings = settings => {
+ return {
+ type: constants.SET_SEARCH_SETTINGS,
+ settings: settings
+ };
+};
diff --git a/js/reducers/selection/constants.js b/js/reducers/selection/constants.js
index b66b797ce..922085e9a 100644
--- a/js/reducers/selection/constants.js
+++ b/js/reducers/selection/constants.js
@@ -110,7 +110,10 @@ export const constants = {
SET_TO_BE_DISPLAYED_LIST: prefix + 'SET_TO_BE_DISPLAYED_LIST',
APPEND_TO_BE_DISPLAYED_LIST: prefix + 'APPEND_TO_BE_DISPLAYED_LIST',
REMOVE_FROM_TO_BE_DISPLAYED_LIST: prefix + 'REMOVE_FROM_TO_BE_DISPLAYED_LIST',
- UPDATE_IN_TO_BE_DISPLAYED_LIST: prefix + 'UPDATE_IN_TO_BE_DISPLAYED_LIST'
+ UPDATE_IN_TO_BE_DISPLAYED_LIST: prefix + 'UPDATE_IN_TO_BE_DISPLAYED_LIST',
+
+ SET_SEARCH_SETTINGS_DIALOG_OPEN: prefix + 'SET_SEARCH_SETTINGS_DIALOG_OPEN',
+ SET_SEARCH_SETTINGS: prefix + 'SET_SEARCH_SETTINGS'
};
export const PREDEFINED_FILTERS = {
diff --git a/js/reducers/selection/selectionReducers.js b/js/reducers/selection/selectionReducers.js
index 982995ec6..5af8eaaab 100644
--- a/js/reducers/selection/selectionReducers.js
+++ b/js/reducers/selection/selectionReducers.js
@@ -68,11 +68,25 @@ export const INITIAL_STATE = {
// display: true
// }
- toBeDisplayedList: []
+ toBeDisplayedList: [],
+ searchSettingsDialogOpen: false,
+ searchSettings: {
+ searchBy: {
+ shortcode: true,
+ aliases: false,
+ compoundId: false
+ }
+ }
};
export function selectionReducers(state = INITIAL_STATE, action = {}) {
switch (action.type) {
+ case constants.SET_SEARCH_SETTINGS_DIALOG_OPEN:
+ return { ...state, searchSettingsDialogOpen: action.isOpen };
+
+ case constants.SET_SEARCH_SETTINGS:
+ return { ...state, searchSettings: JSON.parse(JSON.stringify(action.settings)) };
+
case constants.SET_TO_BE_DISPLAYED_LIST:
return { ...state, toBeDisplayedList: action.toBeDisplayedList };