Web: Files: moved accessOptions to sharing panel

This commit is contained in:
Nikita Gopienko 2020-05-07 16:00:14 +03:00
parent f547df107e
commit 83fc9dbd89
3 changed files with 15 additions and 18 deletions

View File

@ -26,7 +26,7 @@ import {
setAction,
setTreeFolders
} from '../../../../../store/files/actions';
import { isFileSelected, getFileIcon, getFolderIcon, getFolderType, loopTreeFolders, getAccessOption } from '../../../../../store/files/selectors';
import { isFileSelected, getFileIcon, getFolderIcon, getFolderType, loopTreeFolders } from '../../../../../store/files/selectors';
import store from "../../../../../store/store";
import { SharingPanel } from "../../../../panels";
//import { getFilterByLocation } from "../../../../../helpers/converters";
@ -522,8 +522,7 @@ class SectionBodyContent extends React.PureComponent {
fileAction,
onLoading,
isLoading,
currentFolderCount,
accessOptions
currentFolderCount
} = this.props;
const { editingId, showSharingPanel, currentItem } = this.state;
@ -605,7 +604,6 @@ class SectionBodyContent extends React.PureComponent {
selectedItems={currentItem}
onClose={this.onClickShare}
visible={showSharingPanel}
accessOptions={accessOptions}
/>
)}
</>
@ -642,7 +640,6 @@ const mapStateToProps = state => {
myDocumentsId: treeFolders[myFolderIndex].id,
currentFolderCount,
selectedFolderId: id,
accessOptions: getAccessOption(selection),
shareDataItems
};
};

View File

@ -15,11 +15,7 @@ import { fetchFiles, setAction } from "../../../../../store/files/actions";
import { default as filesStore } from "../../../../../store/store";
import { EmptyTrashDialog, DeleteDialog } from "../../../../dialogs";
import { SharingPanel } from "../../../../panels";
import {
isCanBeDeleted,
getAccessOption,
checkFolderType
} from "../../../../../store/files/selectors";
import { isCanBeDeleted, checkFolderType } from "../../../../../store/files/selectors";
const { isAdmin } = store.auth.selectors;
const { FilterType, FileAction } = constants;
@ -260,13 +256,13 @@ class SectionHeaderContent extends React.Component {
onCheck,
title,
currentFolderId,
accessOptions,
onLoading
} = this.props;
const {
showDeleteDialog,
showSharingPanel,
showEmptyTrashDialog
showEmptyTrashDialog,
showDownloadDialog
} = this.state;
const isItemsSelected = selection.length;
const isOnlyFolderSelected = selection.every(
@ -437,7 +433,6 @@ class SectionHeaderContent extends React.Component {
selectedItems={selection}
onClose={this.onOpenSharingPanel}
visible={showSharingPanel}
accessOptions={accessOptions}
/>
)}
</StyledContainer>
@ -467,7 +462,6 @@ const mapStateToProps = state => {
title,
filter,
deleteDialogVisible: isCanBeDeleted(selectedFolder, user),
accessOptions: getAccessOption(selection),
currentFolderId: id
};
};

View File

@ -25,6 +25,7 @@ import {
setSharedFiles,
getShareUsers
} from "../../../store/files/actions";
import { getAccessOption } from '../../../store/files/selectors';
import {
StyledSharingPanel,
StyledContent,
@ -62,6 +63,7 @@ class SharingPanelComponent extends React.Component {
shareLink: "",
isLoadedShareData: false,
showPanel: false,
accessOptions: []
};
this.ref = React.createRef();
@ -379,8 +381,11 @@ class SharingPanelComponent extends React.Component {
arrayItems = this.removeDuplicateShareData(arrayItems);
const baseShareData = JSON.parse(JSON.stringify(arrayItems));
const accessOptions = !this.props.selectedItems.length ? getAccessOption([this.props.selectedItems]) : getAccessOption(this.props.selectedItems);
this.setState(
{ baseShareData, shareDataItems: arrayItems, showPanel: true },
{ baseShareData, shareDataItems: arrayItems, showPanel: true, accessOptions },
this.props.onLoading(false)
);
};
@ -427,7 +432,7 @@ class SharingPanelComponent extends React.Component {
if (folderId.length !== 0 || fileId.length !== 0) {
getShareUsers(folderId, fileId).then((res) => {
this.getShareDataItems(res, folderId, fileId);
this.getShareDataItems(res);
});
}
};
@ -460,7 +465,7 @@ class SharingPanelComponent extends React.Component {
render() {
//console.log("Sharing panel render");
const { t, accessOptions, isMyId, selectedItems } = this.props;
const { t, isMyId, selectedItems } = this.props;
const {
showActionPanel,
isNotifyUsers,
@ -471,7 +476,8 @@ class SharingPanelComponent extends React.Component {
showEmbeddingPanel,
accessRight,
shareLink,
showPanel
showPanel,
accessOptions
} = this.state;
const visible = showPanel;