Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getData = (props, setUpdatingParams = false) => {
const source = getQueryParameters(props.location.search, 'source');
const _limit =
toInteger(getQueryParameters(props.location.search, '_limit')) ||
this.getCurrentModelDefaultLimit();
const _page =
toInteger(getQueryParameters(props.location.search, '_page')) || 1;
const _sort = this.findPageSort(props); // TODO sort
const _q = getQueryParameters(props.location.search, '_q') || '';
const params = { _limit, _page, _sort, _q };
const filters = generateFiltersFromSearch(props.location.search);
this.props.setParams(params, filters);
this.props.getData(props.match.params.slug, source, setUpdatingParams);
};
removeRelation,
reorderDiffRow,
reorderRow,
resetProps,
setEditFieldToSelect,
setListFieldToEditIndex,
shouldToggleModalSubmit,
}) {
strapi.useInjectReducer({ key: 'settingViewModel', reducer, pluginId });
strapi.useInjectSaga({ key: 'settingViewModel', saga, pluginId });
const [showWarningSubmit, setWarningSubmit] = useState(false);
const [showWarningCancel, setWarningCancel] = useState(false);
const toggleWarningSubmit = () => setWarningSubmit(prevState => !prevState);
const toggleWarningCancel = () => setWarningCancel(prevState => !prevState);
const source = getQueryParameters(search, 'source');
const redirectUrl = getQueryParameters(search, 'redirectUrl');
useEffect(() => {
getData(name, source);
return () => {
resetProps();
};
}, [getData, name, resetProps, source]);
useEffect(() => {
if (showWarningSubmit) {
toggleWarningSubmit();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [shouldToggleModalSubmit]);
const getAttributes = useMemo(() => {
const [reducerState, dispatch] = useReducer(reducer, initialState, () =>
init(initialState, layout, isCreatingEntry)
);
const state = reducerState.toJS();
const {
didCheckErrors,
errors,
groupLayoutsData,
initialData,
modifiedData,
isLoading,
isLoadingForLayouts,
} = state;
const source = getQueryParameters(search, 'source');
const shouldShowLoader =
isLoadingForLayouts || (!isCreatingEntry && isLoading);
useEffect(() => {
const fetchGroupLayouts = async () => {
try {
const data = await Promise.all(
groupLayoutsToGet.map(uid =>
request(`/${pluginId}/groups/${uid}`, {
method: 'GET',
signal,
})
)
);
const groupLayouts = data.reduce((acc, current) => {
getActionType = () => {
return getQueryParameters(this.getSearch(), 'actionType');
};
getAttributeType = () =>
getQueryParameters(this.getSearch(), 'attributeType');
getAttributeIndex = () => {
return getQueryParameters(this.getSearch(), 'attributeName');
};
getFeatureType = () => getQueryParameters(this.getSearch(), 'modalType');
getAttributeName = () =>
getQueryParameters(this.getSearch(), 'attributeName');
getFeatureNameFromSearch = () =>
getQueryParameters(this.getSearch(), `${this.getFeatureType()}Name`);
getSource = () => {
const {
match: {
params: { modelName },
},
} = this.props;
const source = getQueryParameters(modelName, 'source');
return !!source ? source : null;
};