mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 03:41:12 +00:00
Feature - add more operation button on sidebar (#6372)
This commit is contained in:
@@ -11,6 +11,7 @@ import CreateFile from '../../components/dialog/create-file-dialog';
|
||||
import ImageDialog from '../../components/dialog/image-dialog';
|
||||
import { gettext, siteRoot, thumbnailSizeForOriginal } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import TextTranslation from '../../utils/text-translation';
|
||||
import TreeSection from '../../components/tree-section';
|
||||
import DirViews from './dir-views';
|
||||
import DirOthers from './dir-others';
|
||||
@@ -56,10 +57,27 @@ class DirColumnNav extends React.Component {
|
||||
isCopyDialogShow: false,
|
||||
isMoveDialogShow: false,
|
||||
isMutipleOperation: false,
|
||||
operationList: [],
|
||||
};
|
||||
this.isNodeMenuShow = true;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.initMenuList();
|
||||
}
|
||||
|
||||
initMenuList = () => {
|
||||
const menuList = this.getMenuList();
|
||||
this.setState({ operationList: menuList });
|
||||
};
|
||||
|
||||
getMenuList = () => {
|
||||
let menuList = [];
|
||||
menuList.push(TextTranslation.NEW_FOLDER);
|
||||
menuList.push(TextTranslation.NEW_FILE);
|
||||
return menuList;
|
||||
};
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
this.setState({ opNode: nextProps.currentNode });
|
||||
}
|
||||
@@ -73,6 +91,10 @@ class DirColumnNav extends React.Component {
|
||||
this.props.onNodeClick(node);
|
||||
};
|
||||
|
||||
onMoreOperationClick = (operation) => {
|
||||
this.onMenuItemClick(operation);
|
||||
};
|
||||
|
||||
onMenuItemClick = (operation, node) => {
|
||||
this.setState({ opNode: node });
|
||||
switch (operation) {
|
||||
@@ -249,41 +271,60 @@ class DirColumnNav extends React.Component {
|
||||
};
|
||||
|
||||
renderContent = () => {
|
||||
if (this.props.isTreeDataLoading) return (<Loading/>);
|
||||
const {
|
||||
isTreeDataLoading,
|
||||
userPerm,
|
||||
treeData,
|
||||
currentPath,
|
||||
onNodeExpanded,
|
||||
onNodeCollapse,
|
||||
onItemMove,
|
||||
onItemsMove,
|
||||
currentRepoInfo,
|
||||
selectedDirentList,
|
||||
repoID,
|
||||
getMenuContainerSize,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<TreeSection title={gettext('Files')}>
|
||||
{isTreeDataLoading ? (
|
||||
<Loading />
|
||||
) : (
|
||||
<>
|
||||
<TreeSection title={gettext('Files')} moreKey={{ name: 'files' }} moreOperations={this.state.operationList} moreOperationClick={this.onMoreOperationClick}>
|
||||
<TreeView
|
||||
userPerm={this.props.userPerm}
|
||||
userPerm={userPerm}
|
||||
isNodeMenuShow={this.isNodeMenuShow}
|
||||
treeData={this.props.treeData}
|
||||
currentPath={this.props.currentPath}
|
||||
treeData={treeData}
|
||||
currentPath={currentPath}
|
||||
onNodeClick={this.onNodeClick}
|
||||
onNodeExpanded={this.props.onNodeExpanded}
|
||||
onNodeCollapse={this.props.onNodeCollapse}
|
||||
onNodeExpanded={onNodeExpanded}
|
||||
onNodeCollapse={onNodeCollapse}
|
||||
onMenuItemClick={this.onMenuItemClick}
|
||||
onFreezedItem={this.onFreezedItem}
|
||||
onUnFreezedItem={this.onUnFreezedItem}
|
||||
onItemMove={this.props.onItemMove}
|
||||
currentRepoInfo={this.props.currentRepoInfo}
|
||||
selectedDirentList={this.props.selectedDirentList}
|
||||
onItemsMove={this.props.onItemsMove}
|
||||
repoID={this.props.repoID}
|
||||
getMenuContainerSize={this.props.getMenuContainerSize}
|
||||
onItemMove={onItemMove}
|
||||
currentRepoInfo={currentRepoInfo}
|
||||
selectedDirentList={selectedDirentList}
|
||||
onItemsMove={onItemsMove}
|
||||
repoID={repoID}
|
||||
getMenuContainerSize={getMenuContainerSize}
|
||||
/>
|
||||
</TreeSection>
|
||||
<DirViews
|
||||
repoID={this.props.repoID}
|
||||
currentPath={this.props.currentPath}
|
||||
userPerm={this.props.userPerm}
|
||||
repoID={repoID}
|
||||
currentPath={currentPath}
|
||||
userPerm={userPerm}
|
||||
onNodeClick={this.onNodeClick}
|
||||
/>
|
||||
<DirOthers
|
||||
repoID={this.props.repoID}
|
||||
userPerm={this.props.userPerm}
|
||||
currentRepoInfo={this.props.currentRepoInfo}
|
||||
repoID={repoID}
|
||||
userPerm={userPerm}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
@@ -182,7 +182,7 @@ class TreeView extends React.Component {
|
||||
}
|
||||
|
||||
// move dirents to current path
|
||||
if (dragStartNodeData[0].nodeParentPath && dragStartNodeData[0].nodeParentPath === dropNodeData.path ) {
|
||||
if (dragStartNodeData[0].nodeParentPath && dragStartNodeData[0].nodeParentPath === dropNodeData.path) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user