diff --git a/frontend/src/components/cur-dir-path/dir-tool.js b/frontend/src/components/cur-dir-path/dir-tool.js index a0e693830a..1ff7a91856 100644 --- a/frontend/src/components/cur-dir-path/dir-tool.js +++ b/frontend/src/components/cur-dir-path/dir-tool.js @@ -6,12 +6,10 @@ import ModalPortal from '../modal-portal'; import { Modal } from 'reactstrap'; import ListTagDialog from '../dialog/list-tag-dialog'; import CreateTagDialog from '../dialog/create-tag-dialog'; -import UpdateTagDialog from '../dialog/update-tag-dialog'; import ListTaggedFilesDialog from '../dialog/list-taggedfiles-dialog'; const propTypes = { repoID: PropTypes.string.isRequired, - repoName: PropTypes.string.isRequired, userPerm: PropTypes.string, currentPath: PropTypes.string.isRequired, updateUsedRepoTags: PropTypes.func.isRequired, @@ -26,7 +24,6 @@ class DirTool extends React.Component { isRepoTagDialogShow: false, currentTag: null, isListRepoTagShow: false, - isUpdateRepoTagShow: false, isCreateRepoTagShow: false, isListTaggedFileShow: false, }; @@ -37,7 +34,6 @@ class DirTool extends React.Component { this.setState({ isRepoTagDialogShow: true, isListRepoTagShow: true, - isUpdateRepoTagShow: false, isCreateRepoTagShow: false, isListTaggedFileShow: false }); @@ -47,7 +43,6 @@ class DirTool extends React.Component { this.setState({ isRepoTagDialogShow: false, isListRepoTagShow: false, - isUpdateRepoTagShow: false, isCreateRepoTagShow: false, isListTaggedFileShow: false }); @@ -60,14 +55,6 @@ class DirTool extends React.Component { }); } - onUpdateRepoTagToggle = (currentTag) => { - this.setState({ - currentTag: currentTag, - isListRepoTagShow: !this.state.isListRepoTagShow, - isUpdateRepoTagShow: !this.state.isUpdateRepoTagShow, - }); - } - onListTaggedFileToggle = (currentTag) => { this.setState({ currentTag: currentTag, @@ -82,7 +69,7 @@ class DirTool extends React.Component { } render() { - let { repoID, repoName, userPerm, currentPath } = this.props; + let { repoID, userPerm, currentPath } = this.props; let isFile = this.isMarkdownFile(currentPath); let name = Utils.getFileName(currentPath); let trashUrl = siteRoot + 'repo/' + repoID + '/trash/'; @@ -122,16 +109,6 @@ class DirTool extends React.Component { toggleCancel={this.onCreateRepoTagToggle} /> )} - {this.state.isUpdateRepoTagShow && ( - - )} {this.state.isListTaggedFileShow && ( { - this.setState({ - newName: e.target.value, - }); - } - - selectNewcolor = (e) => { - this.setState({ - newColor: e.target.value, - }); - } - - updateTag = () => { - let tag_id = this.props.currentTag.id; - let name = this.state.newName; - let color = this.state.newColor; - let repoID = this.props.repoID; - seafileAPI.updateRepoTag(repoID, tag_id, name, color).then(() => { - this.props.toggleCancel(); - this.props.updateUsedRepoTags(); - }).catch((error) => { - let errMessage = Utils.getErrorMsg(error); - toaster.danger(errMessage); - }); - } - - handleKeyPress = (e) => { - if (e.key === 'Enter') { - this.updateTag(); - } - } - - deleteTagClick = (item) => { - this.setState({ - deleteRepoTag: !this.state.deleteRepoTag, - }); - } - - onDeleteTag = () => { - let tag = this.props.currentTag; - let repoID = this.props.repoID; - seafileAPI.deleteRepoTag(repoID, tag.id).then((res) => { - this.props.toggleCancel(); - if (res.data.success === 'true') { - this.props.onDeleteRepoTag(tag.id); - } - }).catch((error) => { - let errMessage = Utils.getErrorMsg(error); - toaster.danger(errMessage); - }); - } - - render() { - let colorList = this.state.colorList; - if (colorList.indexOf(this.props.currentTag.color)===-1) { - colorList.push(this.props.currentTag.color); - } - return ( - - - - {gettext('Edit Tag')} - - - - - {gettext('Name')} - {this.newInput = input;}} value={this.state.newName} onChange={this.inputNewName}/> - - - {gettext('Select a color')} - - {colorList.map((item, index)=>{ - return ( - - - {item===this.props.currentTag.color ? - : - } - - - - ); - })} - - - - - - {gettext('Delete')} - {gettext('Save')} - - - ); - } -} - -UpdateTagDialog.propTypes = propTypes; - -export default UpdateTagDialog;