Web: Files: fixed opening SharingPanel

This commit is contained in:
Nikita Gopienko 2020-10-14 17:22:20 +03:00
parent a6c29d8931
commit 5cf2798aa4
3 changed files with 9 additions and 10 deletions

View File

@ -25,6 +25,7 @@ import {
getTreeFolders, getTreeFolders,
getIsLoading, getIsLoading,
getIsRecycleBinFolder, getIsRecycleBinFolder,
getSelection,
} from "../../../store/files/selectors"; } from "../../../store/files/selectors";
import { createI18N } from "../../../helpers/i18n"; import { createI18N } from "../../../helpers/i18n";
const i18n = createI18N({ const i18n = createI18N({
@ -282,6 +283,7 @@ const mapStateToProps = (state) => {
treeFolders: getTreeFolders(state), treeFolders: getTreeFolders(state),
isLoading: getIsLoading(state), isLoading: getIsLoading(state),
isRecycleBinFolder: getIsRecycleBinFolder(state), isRecycleBinFolder: getIsRecycleBinFolder(state),
selection: getSelection(state)
}; };
}; };

View File

@ -17,7 +17,7 @@ import { connect } from "react-redux";
import { withRouter } from "react-router"; import { withRouter } from "react-router";
import { withTranslation } from "react-i18next"; import { withTranslation } from "react-i18next";
import { utils as commonUtils, constants, toastr, store } from "asc-web-common"; import { utils as commonUtils, constants, toastr, store } from "asc-web-common";
import { getShareUsers, setShareFiles, setIsLoading } from "../../../store/files/actions"; import { getShareUsers, setShareFiles } from "../../../store/files/actions";
import { getAccessOption, getSelection } from "../../../store/files/selectors"; import { getAccessOption, getSelection } from "../../../store/files/selectors";
import { import {
StyledAsidePanel, StyledAsidePanel,
@ -389,10 +389,7 @@ class SharingPanelComponent extends React.Component {
const accessOptions = getAccessOption(this.props.selectedItems); const accessOptions = getAccessOption(this.props.selectedItems);
this.setState( return { baseShareData, shareDataItems: arrayItems, accessOptions };
{ baseShareData, shareDataItems: arrayItems, accessOptions },
() => this.props.setIsLoading(false)
);
}; };
removeDuplicateShareData = shareDataItems => { removeDuplicateShareData = shareDataItems => {
@ -427,18 +424,18 @@ class SharingPanelComponent extends React.Component {
const folderId = returnValue[0]; const folderId = returnValue[0];
const fileId = returnValue[1]; const fileId = returnValue[1];
let error = null; let error = null;
let shareData = {};
if (folderId.length !== 0 || fileId.length !== 0) { if (folderId.length !== 0 || fileId.length !== 0) {
getShareUsers(folderId, fileId) getShareUsers(folderId, fileId)
.then(res => { .then(res => {
this.getShareDataItems(res); shareData = this.getShareDataItems(res);
}) })
.catch(err => { .catch(err => {
this.props.setIsLoading(false);
error = err; error = err;
toastr.error(err); toastr.error(err);
}) })
.finally(() => !error && this.setState({ showPanel: true })); .finally(() => !error && this.setState({...shareData, ...{ showPanel: true }}));
} }
}; };
@ -461,7 +458,6 @@ class SharingPanelComponent extends React.Component {
onClose = () => this.setState({ showPanel: false }); onClose = () => this.setState({ showPanel: false });
componentDidMount() { componentDidMount() {
this.props.setIsLoading(true);
this.getShareData(); this.getShareData();
document.addEventListener("keyup", this.onKeyPress); document.addEventListener("keyup", this.onKeyPress);
@ -739,4 +735,4 @@ const mapStateToProps = state => {
}; };
}; };
export default connect(mapStateToProps, { setIsLoading })(withRouter(SharingPanel)); export default connect(mapStateToProps)(withRouter(SharingPanel));

View File

@ -29,6 +29,7 @@ const StyledAsidePanel = styled.div`
} }
.header_aside-panel { .header_aside-panel {
transition: unset;
transform: translateX(${(props) => (props.visible ? "0" : "500px")}); transform: translateX(${(props) => (props.visible ? "0" : "500px")});
width: 500px; width: 500px;
overflow-y: hidden; overflow-y: hidden;