Client: FormGallery: Fixed methods

This commit is contained in:
Ilya Oleshko 2024-07-09 17:02:10 +03:00
parent 007b846f58
commit 02c33512bf
2 changed files with 62 additions and 34 deletions

View File

@ -149,31 +149,49 @@ export default inject(
clientLoadingStore,
infoPanelStore,
}) => {
const {
getCategoryTitle,
oformFromFolderId,
currentCategory,
fetchCurrentCategory,
setGallerySelected,
oformsLoadError,
} = oformsStore;
const { getFolderInfo } = filesStore;
const { canSubmitToFormGallery } = accessRightsStore;
const { setSubmitToGalleryDialogVisible } = dialogsStore;
const { isVisible, setIsVisible } = infoPanelStore;
const {
setIsSectionHeaderLoading,
setIsSectionFilterLoading,
setIsSectionBodyLoading,
} = clientLoadingStore;
return {
getCategoryTitle: oformsStore.getCategoryTitle,
getCategoryTitle,
oformFromFolderId: oformsStore.oformFromFolderId,
oformFromFolderId,
currentCategory: oformsStore.currentCategory,
fetchCurrentCategory: oformsStore.fetchCurrentCategory,
currentCategory,
fetchCurrentCategory,
setGallerySelected: oformsStore.setGallerySelected,
setGallerySelected,
canSubmitToFormGallery: accessRightsStore.canSubmitToFormGallery,
setSubmitToGalleryDialogVisible:
dialogsStore.setSubmitToGalleryDialogVisible,
canSubmitToFormGallery,
setSubmitToGalleryDialogVisible,
isInfoPanelVisible: infoPanelStore.isVisible,
setIsInfoPanelVisible: infoPanelStore.setIsVisible,
isInfoPanelVisible: isVisible,
setIsInfoPanelVisible: setIsVisible,
setIsLoading: () => {
clientLoadingStore.setIsSectionHeaderLoading(true, false);
clientLoadingStore.setIsSectionFilterLoading(true, false);
clientLoadingStore.setIsSectionBodyLoading(true, false);
setIsSectionHeaderLoading(true, false);
setIsSectionFilterLoading(true, false);
setIsSectionBodyLoading(true, false);
},
oformsLoadError: oformsStore.oformsLoadError,
getFolderInfo: filesStore.getFolderInfo,
oformsLoadError,
getFolderInfo,
};
},
)(withTranslation("Common")(observer(SectionHeaderContent)));

View File

@ -39,13 +39,13 @@ import Dialogs from "./Dialogs";
import ErrorView from "./ErrorView";
import SectionWrapper from "SRC_DIR/components/Section";
const FormGallery = ({
oformsLoadError,
currentCategory,
fetchCurrentCategory,
defaultOformLocale,
fetchOformLocales,
oformsFilter,
fetchCurrentCategory,
fetchOforms,
fetchOformsLocales,
oformsFilter,
oformsLoadError,
setOformFromFolderId,
}) => {
const location = useLocation();
@ -57,7 +57,7 @@ const FormGallery = ({
useEffect(() => {
const firstLoadFilter = OformsFilter.getFilter(location);
Promise.all([fetchOforms(firstLoadFilter), fetchOformLocales()]).finally(
Promise.all([fetchOforms(firstLoadFilter), fetchOformsLocales()]).finally(
() => {
setIsInitLoading(false);
},
@ -127,18 +127,28 @@ const FormGallery = ({
);
};
export default inject(({ oformsStore }) => ({
oformsLoadError: oformsStore.oformsLoadError,
export default inject(({ oformsStore }) => {
const {
currentCategory,
defaultOformLocale,
fetchCurrentCategory,
fetchOforms,
fetchOformsLocales,
oformsFilter,
oformsLoadError,
setOformFromFolderId,
setOformsFilter,
} = oformsStore;
currentCategory: oformsStore.currentCategory,
fetchCurrentCategory: oformsStore.fetchCurrentCategory,
defaultOformLocale: oformsStore.defaultOformLocale,
fetchOformLocales: oformsStore.fetchOformLocales,
oformsFilter: oformsStore.oformsFilter,
setOformsFilter: oformsStore.setOformsFilter,
fetchOforms: oformsStore.fetchOforms,
setOformFromFolderId: oformsStore.setOformFromFolderId,
}))(observer(FormGallery));
return {
currentCategory,
defaultOformLocale,
fetchCurrentCategory,
fetchOforms,
fetchOformsLocales,
oformsFilter,
oformsLoadError,
setOformFromFolderId,
setOformsFilter,
};
})(observer(FormGallery));