1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 14:49:09 +00:00

feat: list revisions

This commit is contained in:
er-pai-r
2023-07-07 16:07:14 +08:00
parent 74f18d8b79
commit cee0349f3c
13 changed files with 312 additions and 11 deletions

View File

@@ -273,6 +273,9 @@ class DirentListItem extends React.Component {
case 'Start revise':
this.onStartRevise();
break;
case 'List revisions':
this.openRevisionsPage();
break;
case 'Comment':
this.props.onDirentClick(this.props.dirent);
this.props.showDirentDetail('comments');
@@ -385,17 +388,25 @@ class DirentListItem extends React.Component {
}
onStartRevise = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
const repoID = this.props.repoID;
const filePath = this.getDirentPath(this.props.dirent);
seafileAPI.sdocStartRevise(repoID, filePath).then((res) => {
let url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(res.data.file_path);
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(res.data.file_path);
window.open(url);
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
const errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage);
});
}
openRevisionsPage = () => {
const repoID = this.props.repoID;
const filePath = this.getDirentPath(this.props.dirent);
const url = Utils.generateRevisionsURL(siteRoot, repoID, filePath);
if (!url) return;
window.open(url);
}
onHistory = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);