mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 01:41:39 +00:00
delete tree-view tags
This commit is contained in:
@@ -12,9 +12,6 @@ import CreateFile from '../../components/dialog/create-file-dialog';
|
||||
import ImageDialog from '../../components/dialog/image-dialog';
|
||||
import { siteRoot, thumbnailSizeForOriginal } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import EditFileTagDialog from '../dialog/edit-filetag-dialog';
|
||||
import FileTag from '../../models/file-tag';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
|
||||
const propTypes = {
|
||||
currentPath: PropTypes.string.isRequired,
|
||||
@@ -34,7 +31,6 @@ const propTypes = {
|
||||
inResizing: PropTypes.bool.isRequired,
|
||||
currentRepoInfo: PropTypes.object.isRequired,
|
||||
selectedDirentList: PropTypes.array.isRequired,
|
||||
onFileTagChanged: PropTypes.func,
|
||||
};
|
||||
|
||||
class DirColumnNav extends React.Component {
|
||||
@@ -53,18 +49,12 @@ class DirColumnNav extends React.Component {
|
||||
isCopyDialogShow: false,
|
||||
isMoveDialogShow: false,
|
||||
isMutipleOperation: false,
|
||||
isEditFileTagShow: false,
|
||||
fileTagList: [],
|
||||
nodeDirent: '',
|
||||
};
|
||||
this.isNodeMenuShow = true;
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
this.setState({opNode: nextProps.currentNode});
|
||||
if (this.state.nodeDirent.object) {
|
||||
this.getTagFileList(this.state.nodeDirent);
|
||||
}
|
||||
}
|
||||
|
||||
onNodeClick = (node) => {
|
||||
@@ -102,9 +92,6 @@ class DirColumnNav extends React.Component {
|
||||
case 'Copy':
|
||||
this.onCopyToggle();
|
||||
break;
|
||||
case 'Tags':
|
||||
this.onEditFileTagToggle(node);
|
||||
break;
|
||||
case 'Move':
|
||||
this.onMoveToggle();
|
||||
break;
|
||||
@@ -114,51 +101,6 @@ class DirColumnNav extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
onEditFileTagToggle = (node) => {
|
||||
this.setState({
|
||||
isEditFileTagShow: !this.state.isEditFileTagShow,
|
||||
nodeDirent: node,
|
||||
});
|
||||
if (node.object) {
|
||||
this.getTagFileList(node);
|
||||
}
|
||||
}
|
||||
|
||||
onFileTagChanged = () => {
|
||||
let currentPath;
|
||||
|
||||
if (this.props.currentPath.charAt(this.props.currentPath.length - 1) === '/') {
|
||||
currentPath = Utils.joinPath(this.props.currentPath, this.state.nodeDirent.object.name);
|
||||
} else {
|
||||
currentPath = this.props.currentPath;
|
||||
}
|
||||
|
||||
if (this.props.currentPath !== '/') {
|
||||
if (currentPath === this.state.nodeDirent.path) {
|
||||
this.props.onToolbarFileTagChanged();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.currentPath !== this.state.nodeDirent.parentNode.path) {
|
||||
this.getTagFileList(this.state.nodeDirent);
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.onFileTagChanged(this.state.nodeDirent.object, this.state.nodeDirent.path);
|
||||
}
|
||||
|
||||
getTagFileList = (node) => {
|
||||
let {repoID} = this.props;
|
||||
seafileAPI.listFileTags(repoID, node.path).then(res => {
|
||||
let fileTagList = [];
|
||||
res.data.file_tags.forEach(item => {
|
||||
let file_tag = new FileTag(item);
|
||||
fileTagList.push(file_tag);
|
||||
});
|
||||
this.setState({fileTagList: fileTagList});
|
||||
});
|
||||
}
|
||||
|
||||
onAddFileToggle = (type) => {
|
||||
if (type === 'root') {
|
||||
let root = this.props.treeData.root;
|
||||
@@ -396,15 +338,6 @@ class DirColumnNav extends React.Component {
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
{this.state.isEditFileTagShow &&
|
||||
<EditFileTagDialog
|
||||
repoID={this.props.repoID}
|
||||
fileTagList={this.state.fileTagList}
|
||||
filePath={this.state.nodeDirent.path}
|
||||
toggleCancel={this.onEditFileTagToggle}
|
||||
onFileTagChanged={this.onFileTagChanged}
|
||||
/>
|
||||
}
|
||||
{this.state.isNodeImagePopupOpen && (
|
||||
<ModalPortal>
|
||||
<ImageDialog
|
||||
|
@@ -170,8 +170,6 @@ class DirColumnView extends React.Component {
|
||||
onItemMove={this.props.onItemMove}
|
||||
onItemCopy={this.props.onItemCopy}
|
||||
selectedDirentList={this.props.selectedDirentList}
|
||||
onFileTagChanged={this.props.onFileTagChanged}
|
||||
onToolbarFileTagChanged={this.props.onToolbarFileTagChanged}
|
||||
/>
|
||||
<div className="dir-content-resize" onMouseDown={this.onResizeMouseDown}></div>
|
||||
<div className="dir-content-main" style={{userSelect: select, flex: mainFlex}}>
|
||||
|
@@ -222,7 +222,6 @@ class DirentListView extends React.Component {
|
||||
this.setState({isCopyDialogShow: !this.state.isCopyDialogShow});
|
||||
}
|
||||
|
||||
|
||||
onItemsDownload = () => {
|
||||
let { path, repoID, selectedDirentList } = this.props;
|
||||
if (selectedDirentList.length) {
|
||||
|
@@ -50,7 +50,7 @@ class TreeNodeMenu extends React.Component {
|
||||
if (node.object.type === 'dir') {
|
||||
menuList = ['New Folder', 'New File', 'Copy', 'Move', 'Rename', 'Delete'];
|
||||
} else {
|
||||
menuList = ['Rename', 'Delete', 'Copy', 'Move', 'Tags', 'Open in New Tab'];
|
||||
menuList = ['Rename', 'Delete', 'Copy', 'Move', 'Open in New Tab'];
|
||||
}
|
||||
return menuList;
|
||||
}
|
||||
@@ -73,9 +73,6 @@ class TreeNodeMenu extends React.Component {
|
||||
case 'Move':
|
||||
translateResult = gettext('Move');
|
||||
break;
|
||||
case 'Tags':
|
||||
translateResult = gettext('Tags');
|
||||
break;
|
||||
case 'Delete':
|
||||
translateResult = gettext('Delete');
|
||||
break;
|
||||
|
@@ -168,7 +168,7 @@ class TreeView extends React.Component {
|
||||
getMenuList = (node) => {
|
||||
let menuList = [];
|
||||
|
||||
let { NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE, OPEN_VIA_CLIENT, TAGS} = TextTranslation;
|
||||
let { NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE, OPEN_VIA_CLIENT } = TextTranslation;
|
||||
|
||||
if (!node) {
|
||||
return [NEW_FOLDER, NEW_FILE];
|
||||
@@ -177,7 +177,7 @@ class TreeView extends React.Component {
|
||||
if (node.object.type === 'dir') {
|
||||
menuList = [NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE];
|
||||
} else {
|
||||
menuList = [RENAME, DELETE, COPY, MOVE, TAGS, OPEN_VIA_CLIENT];
|
||||
menuList = [RENAME, DELETE, COPY, MOVE, OPEN_VIA_CLIENT];
|
||||
}
|
||||
|
||||
return menuList;
|
||||
|
@@ -254,7 +254,6 @@ class LibContentContainer extends React.Component {
|
||||
onItemsCopy={this.props.onItemsCopy}
|
||||
onItemsDelete={this.props.onItemsDelete}
|
||||
onFileTagChanged={this.props.onFileTagChanged}
|
||||
onToolbarFileTagChanged={this.props.onToolbarFileTagChanged}
|
||||
/>
|
||||
)}
|
||||
</Fragment>
|
||||
|
Reference in New Issue
Block a user