fetching other commit pages works now, use window.fcd() while testing

This commit is contained in:
Lukas Domnick
2013-03-26 21:44:42 +01:00
parent 5a0d3200da
commit b1cb35f364
3 changed files with 33 additions and 20 deletions

View File

@@ -23,41 +23,48 @@ $( function() {
// the table element into which we will render our graph
commitsTable = $('table.network-graph').first(),
commitsDirectory = {},
url = commitsTable.data('source');
$.ajax({
dataType: "json",
url: url,
success: handleNetworkDataLoaded,
error: handleNetworkDataError
});
function fetchCommitData( url ) {
$.ajax({
dataType: "json",
url: url,
success: handleNetworkDataLoaded,
error: handleNetworkDataError
});
}
// load initial data
fetchCommitData( url );
//only for debug purposes!!
var nextPage;
window.fcd = function () {
fetchCommitData(nextPage);
};
function handleNetworkDataLoaded( data ) {
console.log('Retreived Commit Data', data);
nextPage = data.nextPage;
// no commits or empty commits array? Well, we can't draw a graph of that
if( !data.commits || data.commits.length < 1 ) {
handleNoAvailableData();
return;
};
}
registerCommitsInDictionary( data.commits );
prepareCommits( data.commits );
renderCommits( data.commits );
}
function registerCommitsInDictionary( commits ) {
$.each(commits, function( index, commit ) {
commitsDirectory[ commit.hash ] = commit;
});
}
function handleNetworkDataError( err ){
console.log(err);
}
function handleNoAvailableData() {
graphContainer.html('It seems as though there are no commits in this repository / branch...');
console.log('No Data available');
}
var parentsBeingWaitedFor = {},
@@ -70,8 +77,6 @@ $( function() {
});
}
function findFreeLane() {
var i = 0;