mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 18:03:48 +00:00
improve file history (#3564)
This commit is contained in:
@@ -65,12 +65,39 @@ class FileHistory extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initNewRecords(result) {
|
initNewRecords(result) {
|
||||||
this.setState({
|
if (result.total_count < 5) {
|
||||||
historyList: result.data,
|
if (result.data.length) {
|
||||||
currentPage: result.page,
|
let commitID = result.data[result.data.length-1].commit_id;
|
||||||
hasMore: result.total_count > (PER_PAGE * this.state.currentPage),
|
seafileAPI.listOldFileHistoryRecords(historyRepoID, filePath, commitID).then((res) => {
|
||||||
isLoading: false,
|
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,
|
||||||
|
hasMore: result.total_count > (PER_PAGE * this.state.currentPage),
|
||||||
|
isLoading: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initOldRecords(result) {
|
initOldRecords(result) {
|
||||||
|
Reference in New Issue
Block a user