1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 09:51:26 +00:00

improve file history (#3564)

This commit is contained in:
王健辉
2019-05-28 18:21:47 +08:00
committed by Daniel Pan
parent e92bc848b2
commit 559cd94b7d

View File

@@ -65,6 +65,32 @@ class FileHistory extends React.Component {
}
initNewRecords(result) {
if (result.total_count < 5) {
if (result.data.length) {
let commitID = result.data[result.data.length-1].commit_id;
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => {
if (!res.data) {
this.setState({isLoading: false});
throw Error('There is an error in server.');
}
this.setState({
historyList: result.data.concat(res.data.data.slice(1, res.data.data.length)),
isLoading: false,
});
});
} else {
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath).then((res) => {
if (!res.data) {
this.setState({isLoading: false});
throw Error('There is an error in server.');
}
this.setState({
historyList: res.data.data,
isLoading: false,
});
});
}
} else {
this.setState({
historyList: result.data,
currentPage: result.page,
@@ -72,6 +98,7 @@ class FileHistory extends React.Component {
isLoading: false,
});
}
}
initOldRecords(result) {
if (result.data.length) {