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