Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { connect } from 'react-redux';
import { fetchUsers } from 'state/users/actions';
import { fetchProfileTypes } from 'state/profile-types/actions';
import { getProfileTypesOptions } from 'state/profile-types/selectors';
import UserSearchForm from 'ui/users/list/UserSearchForm';
import { convertToQueryString, FILTER_OPERATORS } from '@entando/utils';
import { PROFILE_FILTER_VALUE_MAP, PROFILE_FILTER_OPTIONS } from 'ui/users/common/const';
const FIELD_OPERATORS = {
username: FILTER_OPERATORS.LIKE,
};
const generateQueryString = (values) => {
const newValues = { ...values };
delete newValues.withProfile;
const withProfile = PROFILE_FILTER_VALUE_MAP[values.withProfile] !== null ?
`&withProfile=${PROFILE_FILTER_VALUE_MAP[values.withProfile]}` : '';
return convertToQueryString({
formValues: newValues,
operators: FIELD_OPERATORS,
sorting: {
attribute: 'username',
},
}).concat(withProfile);
};
import { connect } from 'react-redux';
import { convertToQueryString, FILTER_OPERATORS, formattedText } from '@entando/utils';
import { fetchWidgetList } from 'state/widgets/actions';
import { fetchPlugins, fetchFragments } from 'state/fragments/actions';
import FragmentSearchForm from 'ui/fragments/list/FragmentSearchForm';
import { getWidgetTypesOptions, getPluginsOptions } from 'state/fragments/selectors';
const FIELD_OPERATORS = {
code: FILTER_OPERATORS.EQUAL,
widgetType: FILTER_OPERATORS.GREATER_THAN,
plugin: FILTER_OPERATORS.LIKE,
};
export const mapStateToProps = state => ({
widgetTypes: getWidgetTypesOptions(state),
plugins: getPluginsOptions(state),
});
export const mapDispatchToProps = dispatch => ({
onWillMount: () => {
dispatch(fetchWidgetList());
dispatch(fetchPlugins());
},
onSubmit: (values) => {
const queryString = values.pluginCode === formattedText('app.all') ? '' :
export const filterBySearch = (keyword, paginationMetadata) => {
const filter = {
formValues: { name: keyword, description: keyword },
operators: { name: FILTER_OPERATORS.LIKE, description: FILTER_OPERATORS.LIKE },
};
return applyFilter(filter, paginationMetadata);
};
import { connect } from 'react-redux';
import { fetchLabels } from 'state/labels/actions';
import LabelSearchForm from 'ui/labels/list/LabelSearchForm';
import { convertToQueryString, FILTER_OPERATORS } from '@entando/utils';
const FIELD_OPERATORS = {
text: FILTER_OPERATORS.LIKE,
};
export const mapDispatchToProps = dispatch => ({
onSubmit: (values) => {
dispatch(fetchLabels({ page: 1, pageSize: 10 }, convertToQueryString({
formValues: values,
operators: FIELD_OPERATORS,
})));
},
});
const LabelSearchFormContainer = connect(
null,
mapDispatchToProps,
)(LabelSearchForm);
export default LabelSearchFormContainer;