Add commit history view in sidebar

This commit is contained in:
Nick O'Leary
2017-10-09 23:37:19 +01:00
parent eae390acf5
commit 19c84eb694
7 changed files with 346 additions and 69 deletions

View File

@@ -203,6 +203,31 @@ module.exports = {
})
});
app.get("/:id/commits", function(req, res) {
var projectName = req.params.id;
var options = {};
runtime.storage.projects.getCommits(projectName,options).then(function(data) {
res.json(data);
})
.catch(function(err) {
console.log(err.stack);
res.status(400).json({error:"unexpected_error", message:err.toString()});
})
});
app.get("/:id/commits/:sha", function(req, res) {
var projectName = req.params.id;
var sha = req.params.sha;
runtime.storage.projects.getCommit(projectName,sha).then(function(data) {
res.json({commit:data});
})
.catch(function(err) {
console.log(err.stack);
res.status(400).json({error:"unexpected_error", message:err.toString()});
})
});
app.get(new RegExp("/([^\/]+)\/files\/(.*)"), function(req,res) {
// Get project file
});