mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 03:11:07 +00:00
[related files] removed all the related functions
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, ButtonGroup } from 'reactstrap';
|
||||
import { gettext, siteRoot, canGenerateShareLink, isPro, fileAuditEnabled, name, fileServerRoot, useGoFileserver } from '../../utils/constants';
|
||||
import { gettext, siteRoot, name, fileServerRoot, useGoFileserver } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import URLDecorator from '../../utils/url-decorator';
|
||||
import TextTranslation from '../../utils/text-translation';
|
||||
import MoveDirentDialog from '../dialog/move-dirent-dialog';
|
||||
import CopyDirentDialog from '../dialog/copy-dirent-dialog';
|
||||
import ShareDialog from '../dialog/share-dialog';
|
||||
import RelatedFileDialogs from '../dialog/related-file-dialogs';
|
||||
import EditFileTagDialog from '../dialog/edit-filetag-dialog';
|
||||
import ZipDownloadDialog from '../dialog/zip-download-dialog';
|
||||
import Rename from '../dialog/rename-dirent';
|
||||
@@ -55,8 +53,6 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
showEditFileTagDialog: false,
|
||||
fileTagList: [],
|
||||
multiFileTagList: [],
|
||||
showRelatedFileDialog: false,
|
||||
viewMode: 'list_related_file',
|
||||
isRenameDialogOpen: false,
|
||||
isPermissionDialogOpen: false
|
||||
};
|
||||
@@ -178,9 +174,6 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
case 'Comment':
|
||||
this.onCommentItem();
|
||||
break;
|
||||
case 'Related Files':
|
||||
this.openRelatedFilesDialog(dirent);
|
||||
break;
|
||||
case 'History':
|
||||
this.onHistory(dirent);
|
||||
break;
|
||||
@@ -251,37 +244,11 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
window.open(path);
|
||||
}
|
||||
|
||||
openRelatedFilesDialog = (dirent) => {
|
||||
let filePath = this.getDirentPath(dirent);
|
||||
seafileAPI.listRelatedFiles(this.props.repoID, filePath).then(res => {
|
||||
let relatedFiles = res.data.related_files;
|
||||
if (relatedFiles.length > 0) {
|
||||
this.setState({
|
||||
relatedFiles: relatedFiles,
|
||||
showLibContentViewDialogs: true,
|
||||
showRelatedFileDialog: true,
|
||||
viewMode: 'list_related_file',
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
relatedFiles: relatedFiles,
|
||||
showLibContentViewDialogs: true,
|
||||
showRelatedFileDialog: true,
|
||||
viewMode: 'add_related_file',
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}
|
||||
|
||||
toggleCancel = () => {
|
||||
this.setState({
|
||||
showLibContentViewDialogs: false,
|
||||
showShareDialog: false,
|
||||
showEditFileTagDialog: false,
|
||||
showRelatedFileDialog: false,
|
||||
isRenameDialogOpen: false,
|
||||
isPermissionDialogOpen: false,
|
||||
});
|
||||
@@ -315,22 +282,6 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
listRelatedFiles = (dirent) => {
|
||||
let filePath = this.getDirentPath(dirent);
|
||||
seafileAPI.listRelatedFiles(this.props.repoID, filePath).then(res => {
|
||||
this.setState({
|
||||
relatedFiles: res.data.related_files
|
||||
});
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}
|
||||
|
||||
onRelatedFileChange = () => {
|
||||
this.listRelatedFiles(this.props.selectedDirentList[0]);
|
||||
}
|
||||
|
||||
getDirentPath = (dirent) => {
|
||||
if (dirent) return Utils.joinPath(this.props.path, dirent.name);
|
||||
}
|
||||
@@ -467,19 +418,6 @@ class MultipleDirOperationToolbar extends React.Component {
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
{this.state.showRelatedFileDialog &&
|
||||
<ModalPortal>
|
||||
<RelatedFileDialogs
|
||||
repoID={repoID}
|
||||
filePath={direntPath}
|
||||
relatedFiles={this.state.relatedFiles}
|
||||
toggleCancel={this.toggleCancel}
|
||||
onRelatedFileChange={this.onRelatedFileChange}
|
||||
dirent={this.props.selectedDirentList[0]}
|
||||
viewMode={this.state.viewMode}
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
</Fragment>
|
||||
)}
|
||||
</Fragment>
|
||||
|
@@ -8,7 +8,6 @@ import toaster from '../toast';
|
||||
import ModalPotal from '../modal-portal';
|
||||
import ShareDialog from '../dialog/share-dialog';
|
||||
import EditFileTagDialog from '../dialog/edit-filetag-dialog';
|
||||
import RelatedFileDialogs from '../dialog/related-file-dialogs';
|
||||
|
||||
const propTypes = {
|
||||
path: PropTypes.string.isRequired,
|
||||
@@ -21,9 +20,7 @@ const propTypes = {
|
||||
isDraft: PropTypes.bool.isRequired,
|
||||
hasDraft: PropTypes.bool.isRequired,
|
||||
fileTags: PropTypes.array.isRequired,
|
||||
relatedFiles: PropTypes.array.isRequired,
|
||||
onFileTagChanged: PropTypes.func.isRequired,
|
||||
onRelatedFileChange: PropTypes.func.isRequired,
|
||||
showShareBtn: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
@@ -36,8 +33,6 @@ class ViewFileToolbar extends React.Component {
|
||||
isMoreMenuShow: false,
|
||||
isShareDialogShow: false,
|
||||
isEditTagDialogShow: false,
|
||||
isRelatedFileDialogShow: false,
|
||||
showRelatedFileDialog: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,20 +70,6 @@ class ViewFileToolbar extends React.Component {
|
||||
this.setState({isEditTagDialogShow: !this.state.isEditTagDialogShow});
|
||||
}
|
||||
|
||||
onListRelatedFileToggle = () => {
|
||||
this.setState({
|
||||
isRelatedFileDialogShow: true,
|
||||
showRelatedFileDialog: true,
|
||||
});
|
||||
}
|
||||
|
||||
toggleCancel = () => {
|
||||
this.setState({
|
||||
isRelatedFileDialogShow: false,
|
||||
showRelatedFileDialog: false,
|
||||
});
|
||||
}
|
||||
|
||||
onHistoryClick = () => {
|
||||
let historyUrl = siteRoot + 'repo/file_revisions/' + this.props.repoID + '/?p=' + Utils.encodePath(this.props.path);
|
||||
location.href = historyUrl;
|
||||
@@ -122,7 +103,6 @@ class ViewFileToolbar extends React.Component {
|
||||
<DropdownItem onClick={this.onShareToggle}>{gettext('Share')}</DropdownItem>
|
||||
}
|
||||
<DropdownItem onClick={this.onEditFileTagToggle}>{gettext('Tags')}</DropdownItem>
|
||||
<DropdownItem onClick={this.onListRelatedFileToggle}>{gettext('Related Files')}</DropdownItem>
|
||||
<DropdownItem onClick={this.onHistoryClick}>{gettext('History')}</DropdownItem>
|
||||
</DropdownMenu>
|
||||
</Dropdown>
|
||||
@@ -154,19 +134,6 @@ class ViewFileToolbar extends React.Component {
|
||||
/>
|
||||
</ModalPotal>
|
||||
)}
|
||||
{this.state.showRelatedFileDialog &&
|
||||
<ModalPotal>
|
||||
<RelatedFileDialogs
|
||||
repoID={this.props.repoID}
|
||||
filePath={this.props.path}
|
||||
relatedFiles={this.props.relatedFiles}
|
||||
toggleCancel={this.toggleCancel}
|
||||
onRelatedFileChange={this.props.onRelatedFileChange}
|
||||
dirent={dirent}
|
||||
viewMode="list_related_file"
|
||||
/>
|
||||
</ModalPotal>
|
||||
}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user