Merge branch 'feature/mobx' of github.com:ONLYOFFICE/AppServer into feature/mobx
This commit is contained in:
commit
e1f7c37a6b
@ -15,7 +15,7 @@ import {
|
||||
//setIsLoading,
|
||||
} from "../../../store/files/actions";
|
||||
import {
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getSettingsSelectedTreeNode,
|
||||
getExpandedSetting,
|
||||
getEnableThirdParty,
|
||||
@ -211,7 +211,7 @@ function mapStateToProps(state) {
|
||||
expandedSetting: getExpandedSetting(state),
|
||||
enableThirdParty: getEnableThirdParty(state),
|
||||
isAdmin: isAdmin(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
//selectedFolder: getSelectedTreeNode(state),
|
||||
};
|
||||
}
|
||||
@ -232,10 +232,12 @@ export default connect(mapStateToProps, {
|
||||
//setIsLoading,
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { setIsLoading, filesStore } = mainFilesStore;
|
||||
const { setIsLoading, filesStore, isLoading } = mainFilesStore;
|
||||
const { setSelectedFolder } = filesStore.selectedFolderStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
|
||||
setIsLoading,
|
||||
setSelectedFolder,
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ import { /* setAction, */ startUpload } from "../../../store/files/actions";
|
||||
import {
|
||||
canCreate,
|
||||
getFilter,
|
||||
getSelectedFolder,
|
||||
//getSelectedFolder,
|
||||
//getFirstLoad,
|
||||
getIsPrivacyFolder,
|
||||
} from "../../../store/files/selectors";
|
||||
|
@ -24,9 +24,9 @@ import {
|
||||
//getSelectedFolderId,
|
||||
getFilter,
|
||||
getTreeFolders,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getIsRecycleBinFolder,
|
||||
getSelection,
|
||||
//getSelection,
|
||||
isRootFolder,
|
||||
getIsPrivacyFolder,
|
||||
} from "../../../store/files/selectors";
|
||||
@ -308,10 +308,10 @@ const mapStateToProps = (state) => {
|
||||
//currentFolderId: getSelectedFolderId(state),
|
||||
filter: getFilter(state),
|
||||
treeFolders: getTreeFolders(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
isRecycleBinFolder: getIsRecycleBinFolder(state),
|
||||
isPrivacy: getIsPrivacyFolder(state),
|
||||
selection: getSelection(state),
|
||||
//selection: getSelection(state),
|
||||
isRootFolder: isRootFolder(state),
|
||||
};
|
||||
};
|
||||
@ -332,11 +332,13 @@ export default connect(mapStateToProps, {
|
||||
//fetchFiles,
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore } = mainFilesStore;
|
||||
const { fetchFiles } = filesStore;
|
||||
const { filesStore, isLoading } = mainFilesStore;
|
||||
const { fetchFiles, selection, selectedFolderStore } = filesStore;
|
||||
|
||||
return {
|
||||
currentFolderId: filesStore.selectedFolderStore.id,
|
||||
currentFolderId: selectedFolderStore.id,
|
||||
selection,
|
||||
isLoading,
|
||||
|
||||
fetchFiles,
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ import { TIMEOUT } from "../../../helpers/constants";
|
||||
import {
|
||||
//getSelectedFolderId,
|
||||
getFilter,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
} from "../../../store/files/selectors";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
@ -178,7 +178,7 @@ const mapStateToProps = (state) => {
|
||||
return {
|
||||
//currentFolderId: getSelectedFolderId(state),
|
||||
filter: getFilter(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
};
|
||||
};
|
||||
|
||||
@ -194,11 +194,12 @@ export default connect(mapStateToProps, {
|
||||
//fetchFiles,
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore } = mainFilesStore;
|
||||
const { filesStore, isLoading } = mainFilesStore;
|
||||
const { fetchFiles } = filesStore;
|
||||
|
||||
return {
|
||||
currentFolderId: filesStore.selectedFolderStore.id,
|
||||
isLoading,
|
||||
|
||||
fetchFiles,
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ import {
|
||||
//getFileAction,
|
||||
getFilter,
|
||||
//getFolders,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getIsPrivacyFolder,
|
||||
getIsRecycleBinFolder,
|
||||
getNewRowItems,
|
||||
@ -766,7 +766,7 @@ function mapStateToProps(state, props) {
|
||||
//selectedFolder: getSelectedFolder(state),
|
||||
//folders: getFolders(state),
|
||||
newRowItems: getNewRowItems(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
isPrivacy: getIsPrivacyFolder(state),
|
||||
isDesktop: isDesktopClient(state),
|
||||
|
||||
@ -808,7 +808,7 @@ export default connect(mapStateToProps, {
|
||||
replaceFileStream,
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { filesStore, setIsLoading, isLoading } = mainFilesStore;
|
||||
const { folders, fetchFiles } = filesStore;
|
||||
const { type, extension, id } = filesStore.fileActionStore;
|
||||
|
||||
@ -821,6 +821,7 @@ export default connect(mapStateToProps, {
|
||||
selectedFolderPathParts: filesStore.selectedFolderStore.pathParts,
|
||||
newItems: filesStore.selectedFolderStore.new,
|
||||
parentFolder: filesStore.selectedFolderStore.parentId,
|
||||
isLoading,
|
||||
|
||||
setIsLoading,
|
||||
fetchFiles,
|
||||
|
@ -20,7 +20,7 @@ import {
|
||||
//getFileAction,
|
||||
getFilter,
|
||||
//getFolders,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getNewRowItems,
|
||||
//getSelectedFolder,
|
||||
//getSelectedFolderNew,
|
||||
@ -454,7 +454,7 @@ function mapStateToProps(state, props) {
|
||||
//folders: getFolders(state),
|
||||
newRowItems: getNewRowItems(state),
|
||||
dragging: getDragging(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
canWebEdit: canWebEdit(props.item.fileExst)(state),
|
||||
};
|
||||
}
|
||||
@ -477,7 +477,7 @@ export default connect(mapStateToProps, {
|
||||
//fetchFiles,
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { filesStore, setIsLoading, isLoading } = mainFilesStore;
|
||||
const { folders, fetchFiles } = filesStore;
|
||||
const { type, extension, id } = filesStore.fileActionStore;
|
||||
|
||||
@ -491,6 +491,7 @@ export default connect(mapStateToProps, {
|
||||
selectedFolderPathParts: filesStore.selectedFolderStore.pathParts,
|
||||
newItems: filesStore.selectedFolderStore.new,
|
||||
parentFolder: filesStore.selectedFolderStore.parentId,
|
||||
isLoading,
|
||||
|
||||
setIsLoading,
|
||||
fetchFiles,
|
||||
|
@ -3,7 +3,7 @@ import { withRouter } from "react-router";
|
||||
import { connect } from "react-redux";
|
||||
import { ReactSVG } from "react-svg";
|
||||
import { withTranslation, Trans } from "react-i18next";
|
||||
import equal from "fast-deep-equal/react";
|
||||
//import equal from "fast-deep-equal/react";
|
||||
import copy from "copy-to-clipboard";
|
||||
import styled from "styled-components";
|
||||
import queryString from "query-string";
|
||||
@ -36,10 +36,10 @@ import {
|
||||
markItemAsFavorite,
|
||||
removeItemFromFavorite,
|
||||
fetchFavoritesFolder,
|
||||
deselectFile,
|
||||
//deselectFile,
|
||||
updateFile,
|
||||
//fetchFiles,
|
||||
selectFile,
|
||||
//selectFile,
|
||||
//setAction,
|
||||
//setDragging,
|
||||
setDragItem,
|
||||
@ -48,7 +48,7 @@ import {
|
||||
setUpdateTree,
|
||||
setSecondaryProgressBarData,
|
||||
//setSelected,
|
||||
setSelection,
|
||||
//setSelection,
|
||||
setTreeFolders,
|
||||
getFileInfo,
|
||||
addFileToRecentlyViewed,
|
||||
@ -75,7 +75,7 @@ import {
|
||||
//getSelectedFolderParentId,
|
||||
//getSelected,
|
||||
//getSelectedFolderTitle,
|
||||
getSelection,
|
||||
//getSelection,
|
||||
getTreeFolders,
|
||||
getViewAs,
|
||||
loopTreeFolders,
|
||||
@ -973,7 +973,7 @@ class SectionBodyContent extends React.Component {
|
||||
});
|
||||
};
|
||||
|
||||
needForUpdate = (currentProps, nextProps) => {
|
||||
/*needForUpdate = (currentProps, nextProps) => {
|
||||
if (currentProps.widthProp !== nextProps.widthProp) {
|
||||
return true;
|
||||
}
|
||||
@ -997,7 +997,7 @@ class SectionBodyContent extends React.Component {
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
};*/
|
||||
|
||||
onContentRowSelect = (checked, file) => {
|
||||
if (!file) return;
|
||||
@ -1974,7 +1974,7 @@ class SectionBodyContent extends React.Component {
|
||||
viewAs={viewAs}
|
||||
{...checkedProps}
|
||||
{...contextOptionsProps}
|
||||
needForUpdate={this.needForUpdate}
|
||||
//needForUpdate={this.needForUpdate}
|
||||
>
|
||||
<FilesTileContent
|
||||
item={item}
|
||||
@ -2063,7 +2063,7 @@ class SectionBodyContent extends React.Component {
|
||||
isPrivacy={isPrivacy}
|
||||
{...checkedProps}
|
||||
{...contextOptionsProps}
|
||||
needForUpdate={this.needForUpdate}
|
||||
//needForUpdate={this.needForUpdate}
|
||||
selectItem={this.onSelectItem.bind(this, item)}
|
||||
contextButtonSpacerWidth={displayShareButton}
|
||||
>
|
||||
@ -2148,7 +2148,7 @@ const mapStateToProps = (state) => {
|
||||
privacyInstructions: getPrivacyInstructionsLink(state),
|
||||
//selected: getSelected(state),
|
||||
//selectedFolderId: getSelectedFolderId(state),
|
||||
selection: getSelection(state),
|
||||
//selection: getSelection(state),
|
||||
settings: getSettings(state),
|
||||
//title: getSelectedFolderTitle(state),
|
||||
treeFolders: getTreeFolders(state),
|
||||
@ -2194,15 +2194,15 @@ const mapStateToProps = (state) => {
|
||||
// })(withRouter(withTranslation()(SectionBodyContent)));
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
deselectFile,
|
||||
//deselectFile,
|
||||
updateFile,
|
||||
//fetchFiles,
|
||||
selectFile,
|
||||
//selectFile,
|
||||
setTreeFolders,
|
||||
setDragItem,
|
||||
setMediaViewerData,
|
||||
setSecondaryProgressBarData,
|
||||
setSelection,
|
||||
//setSelection,
|
||||
//setSelected,
|
||||
setUpdateTree,
|
||||
//setIsLoading,
|
||||
@ -2227,10 +2227,13 @@ export default connect(mapStateToProps, {
|
||||
setSelected,
|
||||
fileActionStore,
|
||||
firstLoad,
|
||||
getFilesList,
|
||||
fetchFiles
|
||||
filesList,
|
||||
fetchFiles,
|
||||
setSelection,
|
||||
selection,
|
||||
selectFile,
|
||||
deselectFile,
|
||||
} = filesStore;
|
||||
|
||||
|
||||
const { type, extension, id, setAction } = fileActionStore;
|
||||
|
||||
@ -2243,16 +2246,20 @@ export default connect(mapStateToProps, {
|
||||
folders,
|
||||
selected,
|
||||
firstLoad,
|
||||
filesList: getFilesList(),
|
||||
filesList,
|
||||
title: filesStore.selectedFolderStore.title,
|
||||
parentId: filesStore.selectedFolderStore.parentId,
|
||||
selectedFolderId: filesStore.selectedFolderStore.id,
|
||||
selection,
|
||||
|
||||
setDragging,
|
||||
setAction,
|
||||
setSelected,
|
||||
setIsLoading,
|
||||
fetchFiles
|
||||
setSelection,
|
||||
fetchFiles,
|
||||
selectFile,
|
||||
deselectFile,
|
||||
};
|
||||
})(withRouter(withTranslation()(observer(SectionBodyContent))))
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ import {
|
||||
//getSelectedFolderTitle,
|
||||
getFilter,
|
||||
//getSelectedFolderId,
|
||||
getSelection,
|
||||
//getSelection,
|
||||
//getSelectedFolderParentId,
|
||||
//getIsRootFolder,
|
||||
getHeaderVisible,
|
||||
@ -701,7 +701,7 @@ const mapStateToProps = (state) => {
|
||||
isPrivacy: getIsPrivacyFolder(state),
|
||||
isDesktop: isDesktopClient(state),
|
||||
//parentId: getSelectedFolderParentId(state),
|
||||
selection: getSelection(state),
|
||||
//selection: getSelection(state),
|
||||
//title: getSelectedFolderTitle(state),
|
||||
filter: getFilter(state),
|
||||
deleteDialogVisible: getUserAccess(state),
|
||||
@ -739,7 +739,7 @@ export default connect(mapStateToProps, {
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { setSelected, fileActionStore, fetchFiles } = filesStore;
|
||||
const { setSelected, fileActionStore, fetchFiles, selection } = filesStore;
|
||||
const { setAction } = fileActionStore;
|
||||
|
||||
return {
|
||||
@ -747,6 +747,7 @@ export default connect(mapStateToProps, {
|
||||
title: filesStore.selectedFolderStore.title,
|
||||
parentId: filesStore.selectedFolderStore.parentId,
|
||||
currentFolderId: filesStore.selectedFolderStore.id,
|
||||
selection,
|
||||
|
||||
setSelected,
|
||||
setAction,
|
||||
|
@ -35,7 +35,7 @@ import {
|
||||
getSecondaryProgressData,
|
||||
getTreeFolders,
|
||||
getViewAs,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
//getDragging,
|
||||
//getFirstLoad,
|
||||
isSecondaryProgressFinished,
|
||||
@ -337,7 +337,7 @@ function mapStateToProps(state) {
|
||||
secondaryProgressData: getSecondaryProgressData(state),
|
||||
treeFolders: getTreeFolders(state),
|
||||
viewAs: getViewAs(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
//homepage: getSettingsHomepage(state),
|
||||
//dragging: getDragging(state),
|
||||
//firstLoad: getFirstLoad(state),
|
||||
@ -367,7 +367,13 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { dragging, setDragging, setIsLoading, filesStore } = mainFilesStore;
|
||||
const {
|
||||
dragging,
|
||||
setDragging,
|
||||
setIsLoading,
|
||||
filesStore,
|
||||
isLoading,
|
||||
} = mainFilesStore;
|
||||
const { firstLoad, setFirstLoad, fileActionStore, fetchFiles } = filesStore;
|
||||
const { id } = fileActionStore;
|
||||
|
||||
@ -377,6 +383,7 @@ export default connect(
|
||||
dragging,
|
||||
fileActionId: id,
|
||||
currentFolderId: filesStore.selectedFolderStore.id,
|
||||
isLoading,
|
||||
|
||||
setFirstLoad,
|
||||
setDragging,
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
openConnectWindow,
|
||||
setConnectItem,
|
||||
setShowThirdPartyPanel,
|
||||
fetchFiles,
|
||||
//fetchFiles,
|
||||
setSelectedNode,
|
||||
} from "../../../../../store/files/actions";
|
||||
import {
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
setForceSave,
|
||||
} from "../../../../../store/files/actions";
|
||||
import {
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getSettingsSelectedTreeNode,
|
||||
getSettingsTreeStoreOriginalFiles,
|
||||
getSettingsTreeConfirmDelete,
|
||||
@ -23,6 +23,7 @@ import {
|
||||
getSettingsTree,
|
||||
} from "../../../../../store/files/selectors";
|
||||
import ConnectClouds from "./ConnectedClouds";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const { isAdmin } = store.auth.selectors;
|
||||
|
||||
@ -189,11 +190,20 @@ function mapStateToProps(state) {
|
||||
forceSave: getSettingsTreeForceSave(state),
|
||||
storeForceSave: getSettingsTreeStoreForceSave(state),
|
||||
enableThirdParty: getSettingsTreeEnableThirdParty(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
settingsTree: getSettingsTree(state),
|
||||
};
|
||||
}
|
||||
|
||||
// export default connect(mapStateToProps, {
|
||||
// setUpdateIfExist,
|
||||
// setStoreOriginal,
|
||||
// setEnableThirdParty,
|
||||
// setConfirmDelete,
|
||||
// setStoreForceSave,
|
||||
// setForceSave,
|
||||
// })(SectionBodyContent);
|
||||
|
||||
export default connect(mapStateToProps, {
|
||||
setUpdateIfExist,
|
||||
setStoreOriginal,
|
||||
@ -201,4 +211,12 @@ export default connect(mapStateToProps, {
|
||||
setConfirmDelete,
|
||||
setStoreForceSave,
|
||||
setForceSave,
|
||||
})(SectionBodyContent);
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { isLoading } = mainFilesStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
};
|
||||
})(observer(SectionBodyContent))
|
||||
);
|
||||
|
@ -15,7 +15,9 @@ import {
|
||||
//setFirstLoad,
|
||||
setSelectedNode,
|
||||
} from "../../../store/files/actions";
|
||||
import { getSettingsTree, getIsLoading } from "../../../store/files/selectors";
|
||||
import {
|
||||
getSettingsTree /* getIsLoading */,
|
||||
} from "../../../store/files/selectors";
|
||||
|
||||
import { setDocumentTitle } from "../../../helpers/utils";
|
||||
import { inject, observer } from "mobx-react";
|
||||
@ -129,7 +131,7 @@ const Settings = (props) => {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
settingsTree: getSettingsTree(state),
|
||||
};
|
||||
}
|
||||
@ -152,10 +154,12 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore } = mainFilesStore;
|
||||
const { filesStore, isLoading } = mainFilesStore;
|
||||
const { setFirstLoad } = filesStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
|
||||
setFirstLoad,
|
||||
};
|
||||
})(withRouter(observer(Settings)))
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
} from "../../../../../store/files/actions";
|
||||
import {
|
||||
getFileVersions,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
} from "../../../../../store/files/selectors";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
@ -70,7 +70,7 @@ class SectionBodyContent extends React.Component {
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
versions: getFileVersions(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
};
|
||||
};
|
||||
|
||||
@ -92,10 +92,12 @@ export default connect(
|
||||
mapDispatchToProps
|
||||
)(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { filesStore, setIsLoading, isLoading } = mainFilesStore;
|
||||
const { setFirstLoad } = filesStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
|
||||
setFirstLoad,
|
||||
setIsLoading,
|
||||
};
|
||||
|
@ -18,9 +18,10 @@ import {
|
||||
} from "../../../store/files/actions";
|
||||
import {
|
||||
getFilter,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getFileVersions,
|
||||
} from "../../../store/files/selectors";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "VersionHistory",
|
||||
@ -116,7 +117,7 @@ VersionHistory.propTypes = {
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
isTabletView: getIsTabletView(state),
|
||||
filter: getFilter(state),
|
||||
versions: getFileVersions(state),
|
||||
@ -131,7 +132,20 @@ const mapDispatchToProps = (dispatch) => {
|
||||
};
|
||||
};
|
||||
|
||||
// export default connect(
|
||||
// mapStateToProps,
|
||||
// mapDispatchToProps
|
||||
// )(withRouter(VersionHistory));
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(VersionHistory));
|
||||
)(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { isLoading } = mainFilesStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
};
|
||||
})(withRouter(observer(VersionHistory)))
|
||||
);
|
||||
|
@ -19,8 +19,8 @@ import {
|
||||
setChangeOwnerPanelVisible,
|
||||
} from "../../../store/files/actions";
|
||||
import {
|
||||
getSelection,
|
||||
getIsLoading,
|
||||
//getSelection,
|
||||
//getIsLoading,
|
||||
//getFiles,
|
||||
//getFolders,
|
||||
getShowOwnerChangePanel,
|
||||
@ -203,9 +203,9 @@ const ChangeOwnerPanel = (props) => (
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
selection: getSelection(state),
|
||||
//selection: getSelection(state),
|
||||
groupsCaption: getSettingsCustomNamesGroupsCaption(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
//files: getFiles(state),
|
||||
//folders: getFolders(state),
|
||||
visible: getShowOwnerChangePanel(state),
|
||||
@ -227,12 +227,14 @@ export default connect(mapStateToProps, {
|
||||
});
|
||||
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { files, folders } = filesStore;
|
||||
const { filesStore, setIsLoading, isLoading } = mainFilesStore;
|
||||
const { files, folders, selection } = filesStore;
|
||||
|
||||
return {
|
||||
files,
|
||||
folders,
|
||||
selection,
|
||||
isLoading,
|
||||
|
||||
setIsLoading,
|
||||
};
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
} from "../../../store/files/actions";
|
||||
import {
|
||||
getFilter,
|
||||
getSelection,
|
||||
//getSelection,
|
||||
//getPathParts,
|
||||
//getSelectedFolderId,
|
||||
getIsRecycleBinFolder,
|
||||
@ -209,7 +209,7 @@ const OperationsPanel = (props) => (
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
filter: getFilter(state),
|
||||
selection: getSelection(state),
|
||||
//selection: getSelection(state),
|
||||
//expandedKeys: getPathParts(state),
|
||||
//currentFolderId: getSelectedFolderId(state),
|
||||
isRecycleBin: getIsRecycleBinFolder(state),
|
||||
@ -228,10 +228,12 @@ export default connect(mapStateToProps, {
|
||||
})(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore } = mainFilesStore;
|
||||
const { selection, selectedFolderStore } = filesStore;
|
||||
|
||||
return {
|
||||
expandedKeys: filesStore.selectedFolderStore.pathParts,
|
||||
currentFolderId: filesStore.selectedFolderStore.id,
|
||||
expandedKeys: selectedFolderStore.pathParts,
|
||||
currentFolderId: selectedFolderStore.id,
|
||||
selection,
|
||||
};
|
||||
})(withRouter(observer(OperationsPanel)))
|
||||
);
|
||||
|
@ -27,10 +27,10 @@ import {
|
||||
import {
|
||||
getAccessOption,
|
||||
getExternalAccessOption,
|
||||
getSelection,
|
||||
//getSelection,
|
||||
getSharePanelVisible,
|
||||
getCanShareOwnerChange,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
//getFiles,
|
||||
//getFolders,
|
||||
getIsPrivacyFolder,
|
||||
@ -639,7 +639,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
groupsCaption: getSettingsCustomNamesGroupsCaption(state),
|
||||
sharingPanelVisible: getSharePanelVisible(state),
|
||||
canShareOwnerChange: getCanShareOwnerChange(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
//files: getFiles(state),
|
||||
//folders: getFolders(state),
|
||||
//settings: getSettings(state),
|
||||
@ -668,13 +668,15 @@ export default connect(mapStateToProps, {
|
||||
});
|
||||
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { filesStore, setIsLoading } = mainFilesStore;
|
||||
const { files, folders } = filesStore;
|
||||
const { filesStore, setIsLoading, isLoading } = mainFilesStore;
|
||||
const { files, folders, selection } = filesStore;
|
||||
|
||||
return {
|
||||
homepage: store.settingsStore.homepage,
|
||||
files,
|
||||
folders,
|
||||
//selection,
|
||||
isLoading,
|
||||
|
||||
setIsLoading,
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ import { createI18N } from "../../../helpers/i18n";
|
||||
import { setIsVerHistoryPanel } from "../../../store/files/actions";
|
||||
import {
|
||||
getVerHistoryFileId,
|
||||
getIsLoading,
|
||||
//getIsLoading,
|
||||
getFileVersions,
|
||||
} from "../../../store/files/selectors";
|
||||
|
||||
@ -23,6 +23,7 @@ import {
|
||||
} from "../StyledPanels";
|
||||
|
||||
import { SectionBodyContent } from "../../pages/VersionHistory/Section/";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "VersionHistory",
|
||||
@ -124,7 +125,7 @@ function mapStateToProps(state) {
|
||||
fileId: getVerHistoryFileId(state),
|
||||
isTabletView: getIsTabletView(state),
|
||||
homepage: getSettingsHomepage(state),
|
||||
isLoading: getIsLoading(state),
|
||||
//isLoading: getIsLoading(state),
|
||||
versions: getFileVersions(state),
|
||||
};
|
||||
}
|
||||
@ -136,7 +137,20 @@ function mapDispatchToProps(dispatch) {
|
||||
};
|
||||
}
|
||||
|
||||
// export default connect(
|
||||
// mapStateToProps,
|
||||
// mapDispatchToProps
|
||||
// )(VersionHistoryPanel);
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(VersionHistoryPanel);
|
||||
)(
|
||||
inject(({ store, mainFilesStore }) => {
|
||||
const { isLoading } = mainFilesStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
};
|
||||
})(observer(VersionHistoryPanel))
|
||||
);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { makeObservable, action, observable } from "mobx";
|
||||
import { makeObservable, action, observable, computed } from "mobx";
|
||||
import { api, constants, store } from "asc-web-common";
|
||||
import FileActionStore from "./FileActionStore";
|
||||
import SelectedFolderStore from "./SelectedFolderStore";
|
||||
@ -15,6 +15,7 @@ class FilesStore {
|
||||
firstLoad = true;
|
||||
files = [];
|
||||
folders = [];
|
||||
selection = [];
|
||||
selected = "close";
|
||||
filter = FilesFilter.getDefault(); //TODO: FILTER
|
||||
|
||||
@ -28,14 +29,18 @@ class FilesStore {
|
||||
folders: observable,
|
||||
selected: observable,
|
||||
filter: observable, //TODO: FILTER
|
||||
selection: observable,
|
||||
|
||||
setFirstLoad: action,
|
||||
setFiles: action,
|
||||
setFolders: action,
|
||||
setSelected: action,
|
||||
setFilesFilter: action, //TODO: FILTER
|
||||
setSelection: action,
|
||||
fetchFiles: action,
|
||||
getFilesList: action,
|
||||
filesList: computed,
|
||||
selectFile: action,
|
||||
deselectFile: action,
|
||||
});
|
||||
|
||||
this.fileActionStore = new FileActionStore();
|
||||
@ -63,6 +68,10 @@ class FilesStore {
|
||||
this.filter = filter;
|
||||
};
|
||||
|
||||
setSelection = (selection) => {
|
||||
this.selection = selection;
|
||||
};
|
||||
|
||||
fetchFiles = (folderId, filter, clearFilter = true) => {
|
||||
const filterData = filter ? filter.clone() : FilesFilter.getDefault();
|
||||
filterData.folder = folderId;
|
||||
@ -128,7 +137,7 @@ class FilesStore {
|
||||
});
|
||||
};
|
||||
|
||||
getFilesList = () => {
|
||||
get filesList() {
|
||||
const items =
|
||||
this.folders && this.files
|
||||
? [...this.folders, ...this.files]
|
||||
@ -169,11 +178,13 @@ class FilesStore {
|
||||
|
||||
//const canOpenPlayer = isMediaOrImage(item.fileExst)(state);
|
||||
//const contextOptions = getFilesContextOptions(item,isRecycleBin,isRecent,isFavorites,isVisitor,canOpenPlayer,canChangeOwner,haveAccess,canShare,isPrivacy,isRootFolder);
|
||||
//const checked = isFileSelected(selection, id, parentId);
|
||||
const checked = this.isFileSelected(this.selection, id, parentId);
|
||||
|
||||
//const selectedItem = selection.find((x) => x.id === id && x.fileExst === fileExst);
|
||||
const selectedItem = this.selection.find(
|
||||
(x) => x.id === id && x.fileExst === fileExst
|
||||
);
|
||||
|
||||
//const isFolder = selectedItem ? false : fileExst ? false : true;
|
||||
const isFolder = selectedItem ? false : fileExst ? false : true;
|
||||
|
||||
//const draggable = selectedItem && !isRecycleBin && selectedItem.id !== actionId;
|
||||
|
||||
@ -187,7 +198,7 @@ class FilesStore {
|
||||
|
||||
return {
|
||||
access,
|
||||
//checked,
|
||||
checked,
|
||||
comment,
|
||||
contentLength,
|
||||
//contextOptions,
|
||||
@ -201,7 +212,7 @@ class FilesStore {
|
||||
foldersCount,
|
||||
//icon,
|
||||
id,
|
||||
//isFolder,
|
||||
isFolder,
|
||||
locked,
|
||||
new: item.new,
|
||||
parentId,
|
||||
@ -224,6 +235,29 @@ class FilesStore {
|
||||
//canShare,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
isFileSelected = (selection, fileId, parentId) => {
|
||||
const item = selection.find(
|
||||
(x) => x.id === fileId && x.parentId === parentId
|
||||
);
|
||||
|
||||
return item !== undefined;
|
||||
};
|
||||
|
||||
selectFile = (file) => {
|
||||
console.log("selectFile", file);
|
||||
const { id, parentId } = file;
|
||||
const isFileSelected = this.isFileSelected(this.selection, id, parentId);
|
||||
console.log("isFileSelected", isFileSelected);
|
||||
if (!isFileSelected) this.selection.push(file);
|
||||
};
|
||||
|
||||
deselectFile = (file) => {
|
||||
const { id, parentId } = file;
|
||||
const isFileSelected = this.isFileSelected(this.selection, id, parentId);
|
||||
if (isFileSelected)
|
||||
this.selection = this.selection.filter((x) => x.id !== id);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user