2018-11-27 14:47:19 +08:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-04-12 15:54:05 +08:00
|
|
|
import { Button, ButtonGroup } from 'reactstrap';
|
2022-03-11 18:38:57 +08:00
|
|
|
import { gettext, siteRoot, name, fileServerRoot, useGoFileserver } from '../../utils/constants';
|
2019-05-27 11:19:46 +08:00
|
|
|
import { Utils } from '../../utils/utils';
|
2018-11-27 14:47:19 +08:00
|
|
|
import { seafileAPI } from '../../utils/seafile-api';
|
|
|
|
import URLDecorator from '../../utils/url-decorator';
|
|
|
|
import MoveDirentDialog from '../dialog/move-dirent-dialog';
|
|
|
|
import CopyDirentDialog from '../dialog/copy-dirent-dialog';
|
2019-03-18 17:32:49 +08:00
|
|
|
import ShareDialog from '../dialog/share-dialog';
|
|
|
|
import EditFileTagDialog from '../dialog/edit-filetag-dialog';
|
2019-04-12 15:54:05 +08:00
|
|
|
import ZipDownloadDialog from '../dialog/zip-download-dialog';
|
2019-09-04 14:21:57 +08:00
|
|
|
import Rename from '../dialog/rename-dirent';
|
|
|
|
import LibSubFolderPermissionDialog from '../dialog/lib-sub-folder-permission-dialog';
|
2020-02-29 22:47:48 +08:00
|
|
|
import ViewModeToolbar from './view-mode-toolbar';
|
2019-09-04 14:21:57 +08:00
|
|
|
|
2019-03-18 17:32:49 +08:00
|
|
|
import ModalPortal from '../modal-portal';
|
2019-04-22 14:00:16 +08:00
|
|
|
import ItemDropdownMenu from '../dropdown-menu/item-dropdown-menu';
|
2019-07-16 10:01:09 +08:00
|
|
|
import toaster from '../toast';
|
2019-04-21 14:02:12 +08:00
|
|
|
|
|
|
|
import '../../css/dirents-menu.css';
|
2018-11-27 14:47:19 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
path: PropTypes.string.isRequired,
|
2019-04-18 17:32:34 +08:00
|
|
|
userPerm: PropTypes.string.isRequired,
|
2018-11-27 14:47:19 +08:00
|
|
|
repoID: PropTypes.string.isRequired,
|
2019-03-11 11:14:49 +08:00
|
|
|
repoEncrypted: PropTypes.bool.isRequired,
|
2024-02-02 20:52:58 +08:00
|
|
|
repoTags: PropTypes.array.isRequired,
|
2018-11-27 14:47:19 +08:00
|
|
|
selectedDirentList: PropTypes.array.isRequired,
|
|
|
|
onItemsMove: PropTypes.func.isRequired,
|
|
|
|
onItemsCopy: PropTypes.func.isRequired,
|
|
|
|
onItemsDelete: PropTypes.func.isRequired,
|
2019-03-18 17:32:49 +08:00
|
|
|
isRepoOwner: PropTypes.bool.isRequired,
|
2019-03-19 18:20:45 +08:00
|
|
|
enableDirPrivateShare: PropTypes.bool.isRequired,
|
|
|
|
currentRepoInfo: PropTypes.object.isRequired,
|
2019-03-20 11:13:32 +08:00
|
|
|
onFilesTagChanged: PropTypes.func.isRequired,
|
2019-03-19 18:20:45 +08:00
|
|
|
unSelectDirent: PropTypes.func.isRequired,
|
|
|
|
updateDirent: PropTypes.func.isRequired,
|
2020-02-29 22:47:48 +08:00
|
|
|
currentMode: PropTypes.string.isRequired,
|
|
|
|
switchViewMode: PropTypes.func.isRequired,
|
2023-09-13 08:40:50 +08:00
|
|
|
direntList: PropTypes.array.isRequired,
|
|
|
|
onItemRename: PropTypes.func.isRequired,
|
|
|
|
showDirentDetail: PropTypes.func.isRequired,
|
|
|
|
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
2018-11-27 14:47:19 +08:00
|
|
|
};
|
|
|
|
|
2019-08-29 15:28:54 +08:00
|
|
|
class MultipleDirOperationToolbar extends React.Component {
|
2018-11-27 14:47:19 +08:00
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
2019-04-12 15:54:05 +08:00
|
|
|
isZipDialogOpen: false,
|
2018-11-27 14:47:19 +08:00
|
|
|
isMoveDialogShow: false,
|
|
|
|
isCopyDialogShow: false,
|
|
|
|
isMutipleOperation: true,
|
2019-03-18 17:32:49 +08:00
|
|
|
showLibContentViewDialogs: false,
|
|
|
|
showShareDialog: false,
|
|
|
|
showEditFileTagDialog: false,
|
|
|
|
fileTagList: [],
|
|
|
|
multiFileTagList: [],
|
2019-09-04 14:21:57 +08:00
|
|
|
isRenameDialogOpen: false,
|
|
|
|
isPermissionDialogOpen: false
|
2018-11-27 14:47:19 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
onMoveToggle = () => {
|
|
|
|
this.setState({isMoveDialogShow: !this.state.isMoveDialogShow});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2018-11-27 14:47:19 +08:00
|
|
|
|
|
|
|
onCopyToggle = () => {
|
|
|
|
this.setState({isCopyDialogShow: !this.state.isCopyDialogShow});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2018-11-27 14:47:19 +08:00
|
|
|
|
|
|
|
onItemsDelete = () => {
|
|
|
|
this.props.onItemsDelete();
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2018-11-27 14:47:19 +08:00
|
|
|
|
|
|
|
onItemsDownload = () => {
|
|
|
|
let { path, repoID, selectedDirentList } = this.props;
|
|
|
|
if (selectedDirentList.length) {
|
|
|
|
if (selectedDirentList.length === 1 && !selectedDirentList[0].isDir()) {
|
|
|
|
let direntPath = Utils.joinPath(path, selectedDirentList[0].name);
|
|
|
|
let url = URLDecorator.getUrl({type: 'download_file_url', repoID: repoID, filePath: direntPath});
|
|
|
|
location.href= url;
|
|
|
|
return;
|
|
|
|
}
|
2021-01-22 18:31:53 +08:00
|
|
|
if (!useGoFileserver) {
|
|
|
|
this.setState({
|
|
|
|
isZipDialogOpen: true
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
const target = this.props.selectedDirentList.map(dirent => dirent.name);
|
|
|
|
seafileAPI.zipDownload(repoID, path, target).then((res) => {
|
|
|
|
const zipToken = res.data['zip_token'];
|
|
|
|
location.href = `${fileServerRoot}zip/${zipToken}`;
|
|
|
|
}).catch((error) => {
|
|
|
|
let errorMsg = Utils.getErrorMsg(error);
|
|
|
|
this.setState({
|
|
|
|
isLoading: false,
|
|
|
|
errorMsg: errorMsg
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2018-11-27 14:47:19 +08:00
|
|
|
}
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2018-11-27 14:47:19 +08:00
|
|
|
|
2019-04-12 15:54:05 +08:00
|
|
|
closeZipDialog = () => {
|
|
|
|
this.setState({
|
|
|
|
isZipDialogOpen: false
|
2018-11-27 14:47:19 +08:00
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2018-11-27 14:47:19 +08:00
|
|
|
|
2019-09-04 14:21:57 +08:00
|
|
|
checkDuplicatedName = (newName) => {
|
|
|
|
return Utils.checkDuplicatedNameInList(this.props.direntList, newName);
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-04-21 14:02:12 +08:00
|
|
|
|
2019-09-04 14:21:57 +08:00
|
|
|
onItemRename = (newName) => {
|
|
|
|
const dirent = this.props.selectedDirentList[0];
|
|
|
|
this.props.onItemRename(dirent, newName);
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-04-21 14:02:12 +08:00
|
|
|
|
2019-09-04 14:21:57 +08:00
|
|
|
onPermissionItem = () => {
|
|
|
|
this.setState({
|
|
|
|
showLibContentViewDialogs: !this.state.showLibContentViewDialogs,
|
|
|
|
isPermissionDialogOpen: !this.state.isPermissionDialogOpen
|
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-04-21 14:02:12 +08:00
|
|
|
|
2023-06-28 14:48:59 +08:00
|
|
|
onStartRevise = (dirent) => {
|
|
|
|
let repoID = this.props.repoID;
|
|
|
|
let filePath = this.getDirentPath(dirent);
|
|
|
|
seafileAPI.sdocStartRevise(repoID, filePath).then((res) => {
|
|
|
|
let url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(res.data.file_path);
|
|
|
|
window.open(url);
|
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2023-06-28 14:48:59 +08:00
|
|
|
|
2019-09-04 14:21:57 +08:00
|
|
|
getDirentMenuList = (dirent) => {
|
|
|
|
const isRepoOwner = this.props.isRepoOwner;
|
|
|
|
const currentRepoInfo = this.props.currentRepoInfo;
|
|
|
|
const isContextmenu = true;
|
|
|
|
let opList = Utils.getDirentOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu);
|
|
|
|
const list = ['Move', 'Copy', 'Delete', 'Download'];
|
|
|
|
if (dirent.type == 'dir') {
|
|
|
|
opList = opList.filter((item, index) => {
|
|
|
|
return list.indexOf(item.key) == -1 && item != 'Divider';
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
opList = opList.filter((item, index) => {
|
|
|
|
return list.indexOf(item.key) == -1;
|
|
|
|
});
|
2019-04-21 14:02:12 +08:00
|
|
|
}
|
2019-09-04 14:21:57 +08:00
|
|
|
return opList;
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-04-21 14:02:12 +08:00
|
|
|
|
2019-03-18 17:32:49 +08:00
|
|
|
onMenuItemClick = (operation) => {
|
|
|
|
const dirents = this.props.selectedDirentList;
|
|
|
|
const dirent = dirents[0];
|
2019-09-04 14:21:57 +08:00
|
|
|
switch (operation) {
|
2019-03-18 17:32:49 +08:00
|
|
|
case 'Share':
|
|
|
|
this.setState({
|
|
|
|
showLibContentViewDialogs: true,
|
|
|
|
showShareDialog: true,
|
|
|
|
});
|
|
|
|
break;
|
2019-09-04 14:21:57 +08:00
|
|
|
case 'Rename':
|
|
|
|
this.setState({
|
|
|
|
showLibContentViewDialogs: true,
|
|
|
|
isRenameDialogOpen: true
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 'Permission':
|
|
|
|
this.onPermissionItem();
|
|
|
|
break;
|
2019-03-18 17:32:49 +08:00
|
|
|
case 'Tags':
|
2019-03-19 10:38:05 +08:00
|
|
|
this.listFileTags(dirent);
|
2019-03-18 17:32:49 +08:00
|
|
|
break;
|
|
|
|
case 'Lock':
|
|
|
|
this.lockFile(dirent);
|
|
|
|
break;
|
|
|
|
case 'Unlock':
|
|
|
|
this.unlockFile(dirent);
|
|
|
|
break;
|
|
|
|
case 'History':
|
|
|
|
this.onHistory(dirent);
|
|
|
|
break;
|
2020-11-02 13:56:35 +08:00
|
|
|
case 'Access Log':
|
2019-05-28 10:43:17 +08:00
|
|
|
this.onAccessLog(dirent);
|
|
|
|
break;
|
2023-08-10 19:39:58 +08:00
|
|
|
case 'Properties':
|
|
|
|
this.props.showDirentDetail('info');
|
|
|
|
break;
|
2019-03-18 17:32:49 +08:00
|
|
|
case 'Open via Client':
|
|
|
|
this.onOpenViaClient(dirent);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
lockFile = (dirent) => {
|
|
|
|
const filePath = this.getDirentPath(dirent);
|
|
|
|
seafileAPI.lockfile(this.props.repoID, filePath).then((res) => {
|
|
|
|
if (res.data.is_locked) {
|
|
|
|
this.props.updateDirent(dirent, 'is_locked', true);
|
|
|
|
this.props.updateDirent(dirent, 'locked_by_me', true);
|
2019-09-04 14:21:57 +08:00
|
|
|
this.props.updateDirent(dirent, 'lock_owner_name', name);
|
2019-03-18 17:32:49 +08:00
|
|
|
this.props.unSelectDirent();
|
|
|
|
}
|
2019-07-16 10:01:09 +08:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2019-03-18 17:32:49 +08:00
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
unlockFile = (dirent) => {
|
|
|
|
const filePath = this.getDirentPath(dirent);
|
|
|
|
seafileAPI.unlockfile(this.props.repoID, filePath).then((res) => {
|
|
|
|
if (!res.data.is_locked) {
|
|
|
|
this.props.updateDirent(dirent, 'is_locked', false);
|
|
|
|
this.props.updateDirent(dirent, 'locked_by_me', false);
|
2019-09-04 14:21:57 +08:00
|
|
|
this.props.updateDirent(dirent, 'lock_owner_name', '');
|
2019-03-18 17:32:49 +08:00
|
|
|
this.props.unSelectDirent();
|
|
|
|
}
|
2019-07-16 10:01:09 +08:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2019-03-18 17:32:49 +08:00
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
onOpenViaClient = (dirent) => {
|
|
|
|
const filePath = this.getDirentPath(dirent);
|
|
|
|
let url = URLDecorator.getUrl({
|
|
|
|
type: 'open_via_client',
|
|
|
|
repoID: this.props.repoID,
|
|
|
|
filePath: filePath
|
|
|
|
});
|
|
|
|
location.href = url;
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
onHistory = (dirent) => {
|
|
|
|
let filePath = this.getDirentPath(dirent);
|
|
|
|
let url = URLDecorator.getUrl({
|
|
|
|
type: 'file_revisions',
|
|
|
|
repoID: this.props.repoID,
|
|
|
|
filePath: filePath
|
|
|
|
});
|
|
|
|
location.href = url;
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
2019-05-28 10:43:17 +08:00
|
|
|
onAccessLog = (dirent) => {
|
|
|
|
let filePath = this.getDirentPath(dirent);
|
|
|
|
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
|
|
|
|
window.open(path);
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-05-28 10:43:17 +08:00
|
|
|
|
2019-03-18 17:32:49 +08:00
|
|
|
toggleCancel = () => {
|
|
|
|
this.setState({
|
|
|
|
showLibContentViewDialogs: false,
|
|
|
|
showShareDialog: false,
|
|
|
|
showEditFileTagDialog: false,
|
2019-09-04 14:21:57 +08:00
|
|
|
isRenameDialogOpen: false,
|
|
|
|
isPermissionDialogOpen: false,
|
2019-03-18 17:32:49 +08:00
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
listFileTags = (dirent) => {
|
|
|
|
let filePath = this.getDirentPath(dirent);
|
|
|
|
seafileAPI.listFileTags(this.props.repoID, filePath).then(res => {
|
|
|
|
let fileTagList = res.data.file_tags;
|
|
|
|
for (let i = 0, length = fileTagList.length; i < length; i++) {
|
|
|
|
fileTagList[i].id = fileTagList[i].file_tag_id;
|
|
|
|
}
|
|
|
|
this.setState({
|
2019-03-19 10:38:05 +08:00
|
|
|
fileTagList: fileTagList,
|
|
|
|
showLibContentViewDialogs: true,
|
|
|
|
showEditFileTagDialog: true,
|
2019-03-18 17:32:49 +08:00
|
|
|
});
|
2019-07-16 10:01:09 +08:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2019-03-18 17:32:49 +08:00
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
onMenuFileTagChanged = () => {
|
|
|
|
this.listFileTags(this.props.selectedDirentList[0]);
|
|
|
|
let length = this.props.selectedDirentList.length;
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
const dirent = this.props.selectedDirentList[i];
|
|
|
|
const direntPath = this.getDirentPath(dirent);
|
2019-03-20 11:13:32 +08:00
|
|
|
this.props.onFilesTagChanged(dirent, direntPath);
|
2019-03-18 17:32:49 +08:00
|
|
|
}
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
|
|
|
getDirentPath = (dirent) => {
|
2019-03-18 18:09:37 +08:00
|
|
|
if (dirent) return Utils.joinPath(this.props.path, dirent.name);
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-03-18 17:32:49 +08:00
|
|
|
|
2018-11-27 14:47:19 +08:00
|
|
|
render() {
|
2019-04-18 17:32:34 +08:00
|
|
|
|
2024-02-02 20:52:58 +08:00
|
|
|
const { repoID, repoTags, userPerm } = this.props;
|
2019-09-04 14:21:57 +08:00
|
|
|
const dirent = this.props.selectedDirentList[0];
|
2021-09-13 10:37:07 +08:00
|
|
|
const direntPath = this.getDirentPath(dirent);
|
|
|
|
|
|
|
|
const { isCustomPermission, customPermission } = Utils.getUserPermission(userPerm);
|
|
|
|
let canDelete = true;
|
|
|
|
let canDownload = true;
|
|
|
|
let canCopy = true;
|
|
|
|
let canModify = true;
|
|
|
|
if (isCustomPermission) {
|
|
|
|
const { permission } = customPermission;
|
|
|
|
canDelete = permission.delete;
|
|
|
|
canDownload = permission.download;
|
|
|
|
canCopy = permission.copy;
|
|
|
|
canModify = permission.modify;
|
|
|
|
}
|
2020-11-02 13:56:35 +08:00
|
|
|
|
2018-11-27 14:47:19 +08:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2020-02-29 22:47:48 +08:00
|
|
|
<div className="dir-operation">
|
|
|
|
<div className="d-flex">
|
|
|
|
<ButtonGroup className="flex-row group-operations">
|
2021-09-13 10:37:07 +08:00
|
|
|
{(userPerm === 'rw' || userPerm === 'admin' || isCustomPermission) && (
|
2020-06-24 18:35:38 +08:00
|
|
|
<Fragment>
|
2021-09-28 15:22:37 +08:00
|
|
|
{canModify && <Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} aria-label={gettext('Move')} onClick={this.onMoveToggle}></Button>}
|
|
|
|
{canCopy && <Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} aria-label={gettext('Copy')} onClick={this.onCopyToggle}></Button>}
|
|
|
|
{canDelete && <Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} aria-label={gettext('Delete')} onClick={this.onItemsDelete}></Button>}
|
|
|
|
{canDownload && <Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} aria-label={gettext('Download')} onClick={this.onItemsDownload}></Button>}
|
2020-06-24 18:35:38 +08:00
|
|
|
</Fragment>
|
|
|
|
)}
|
2023-08-01 15:27:19 +08:00
|
|
|
{userPerm === 'cloud-edit' && (
|
|
|
|
<Fragment>
|
|
|
|
{canModify && <Button className="secondary group-op-item action-icon sf2-icon-move" title={gettext('Move')} aria-label={gettext('Move')} onClick={this.onMoveToggle}></Button>}
|
|
|
|
{canCopy && <Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} aria-label={gettext('Copy')} onClick={this.onCopyToggle}></Button>}
|
|
|
|
{canDelete && <Button className="secondary group-op-item action-icon sf2-icon-delete" title={gettext('Delete')} aria-label={gettext('Delete')} onClick={this.onItemsDelete}></Button>}
|
|
|
|
</Fragment>
|
|
|
|
)}
|
2020-12-10 14:25:43 +08:00
|
|
|
{userPerm === 'r' && (
|
2021-09-13 10:37:07 +08:00
|
|
|
<Fragment>
|
2021-09-28 15:22:37 +08:00
|
|
|
<Button className="secondary group-op-item action-icon sf2-icon-copy" title={gettext('Copy')} aria-label={gettext('Copy')} onClick={this.onCopyToggle}></Button>
|
|
|
|
<Button className="secondary group-op-item action-icon sf2-icon-download" title={gettext('Download')} aria-label={gettext('Download')} onClick={this.onItemsDownload}></Button>
|
2021-09-13 10:37:07 +08:00
|
|
|
</Fragment>
|
2020-06-24 18:35:38 +08:00
|
|
|
)}
|
2020-02-29 22:47:48 +08:00
|
|
|
{this.props.selectedDirentList.length === 1 &&
|
|
|
|
<ItemDropdownMenu
|
|
|
|
tagName={'button'}
|
|
|
|
item={this.props.selectedDirentList[0]}
|
|
|
|
toggleClass={'fas fa-ellipsis-v dirents-more-menu'}
|
|
|
|
onMenuItemClick={this.onMenuItemClick}
|
|
|
|
getMenuList={this.getDirentMenuList}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
</ButtonGroup>
|
|
|
|
</div>
|
2019-03-18 17:32:49 +08:00
|
|
|
</div>
|
2021-09-13 10:37:07 +08:00
|
|
|
{Utils.isDesktop() && <ViewModeToolbar currentMode={this.props.currentMode} switchViewMode={this.props.switchViewMode} isCustomPermission={isCustomPermission} />}
|
2020-11-02 13:56:35 +08:00
|
|
|
{this.state.isMoveDialogShow &&
|
|
|
|
<MoveDirentDialog
|
2018-11-27 14:47:19 +08:00
|
|
|
path={this.props.path}
|
2018-11-28 12:41:49 +08:00
|
|
|
repoID={this.props.repoID}
|
2019-03-11 11:14:49 +08:00
|
|
|
repoEncrypted={this.props.repoEncrypted}
|
2018-11-27 14:47:19 +08:00
|
|
|
isMutipleOperation={this.state.isMutipleOperation}
|
|
|
|
selectedDirentList={this.props.selectedDirentList}
|
|
|
|
onItemsMove={this.props.onItemsMove}
|
|
|
|
onCancelMove={this.onMoveToggle}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
{this.state.isCopyDialogShow &&
|
|
|
|
<CopyDirentDialog
|
|
|
|
path={this.props.path}
|
2018-11-28 12:41:49 +08:00
|
|
|
repoID={this.props.repoID}
|
2019-03-11 11:14:49 +08:00
|
|
|
repoEncrypted={this.props.repoEncrypted}
|
2018-11-27 14:47:19 +08:00
|
|
|
selectedDirentList={this.props.selectedDirentList}
|
|
|
|
isMutipleOperation={this.state.isMutipleOperation}
|
|
|
|
onItemsCopy={this.props.onItemsCopy}
|
|
|
|
onCancelCopy={this.onCopyToggle}
|
|
|
|
/>
|
|
|
|
}
|
2019-04-12 15:54:05 +08:00
|
|
|
{this.state.isZipDialogOpen &&
|
|
|
|
<ModalPortal>
|
|
|
|
<ZipDownloadDialog
|
|
|
|
repoID={this.props.repoID}
|
|
|
|
path={this.props.path}
|
|
|
|
target={this.props.selectedDirentList.map(dirent => dirent.name)}
|
|
|
|
toggleDialog={this.closeZipDialog}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
2018-11-27 14:47:19 +08:00
|
|
|
}
|
2019-03-18 17:32:49 +08:00
|
|
|
{this.state.showLibContentViewDialogs && (
|
|
|
|
<Fragment>
|
|
|
|
{this.state.showShareDialog &&
|
|
|
|
<ModalPortal>
|
|
|
|
<ShareDialog
|
2019-09-04 14:21:57 +08:00
|
|
|
itemType={dirent.type}
|
|
|
|
itemName={dirent.name}
|
2019-03-18 17:32:49 +08:00
|
|
|
itemPath={direntPath}
|
2019-09-04 14:21:57 +08:00
|
|
|
userPerm={dirent.permission}
|
2019-03-18 17:32:49 +08:00
|
|
|
repoID={repoID}
|
2020-07-21 11:16:33 +08:00
|
|
|
repoEncrypted={this.props.repoEncrypted}
|
2019-03-18 17:32:49 +08:00
|
|
|
enableDirPrivateShare={this.props.enableDirPrivateShare}
|
2019-09-04 14:21:57 +08:00
|
|
|
isGroupOwnedRepo={this.props.isGroupOwnedRepo}
|
2019-03-18 17:32:49 +08:00
|
|
|
toggleDialog={this.toggleCancel}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
}
|
2019-09-04 14:21:57 +08:00
|
|
|
{this.state.isRenameDialogOpen &&
|
|
|
|
<ModalPortal>
|
|
|
|
<Rename
|
|
|
|
dirent={dirent}
|
|
|
|
onRename={this.onItemRename}
|
|
|
|
checkDuplicatedName={this.checkDuplicatedName}
|
|
|
|
toggleCancel={this.toggleCancel}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
}
|
|
|
|
{this.state.isPermissionDialogOpen &&
|
|
|
|
<ModalPortal>
|
|
|
|
<LibSubFolderPermissionDialog
|
|
|
|
toggleDialog={this.toggleCancel}
|
|
|
|
repoID={repoID}
|
|
|
|
folderPath={direntPath}
|
|
|
|
folderName={dirent.name}
|
|
|
|
isDepartmentRepo={this.props.isGroupOwnedRepo}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
}
|
2019-03-18 17:32:49 +08:00
|
|
|
{this.state.showEditFileTagDialog &&
|
|
|
|
<ModalPortal>
|
|
|
|
<EditFileTagDialog
|
|
|
|
repoID={repoID}
|
2024-02-02 20:52:58 +08:00
|
|
|
repoTags={repoTags}
|
2019-03-18 17:32:49 +08:00
|
|
|
filePath={direntPath}
|
|
|
|
fileTagList={this.state.fileTagList}
|
|
|
|
toggleCancel={this.toggleCancel}
|
|
|
|
onFileTagChanged={this.onMenuFileTagChanged}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
}
|
|
|
|
</Fragment>
|
|
|
|
)}
|
2018-11-27 14:47:19 +08:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-29 15:28:54 +08:00
|
|
|
MultipleDirOperationToolbar.propTypes = propTypes;
|
2018-11-27 14:47:19 +08:00
|
|
|
|
2019-08-29 15:28:54 +08:00
|
|
|
export default MultipleDirOperationToolbar;
|