mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
fetching other commit pages works now, use window.fcd() while testing
This commit is contained in:
@@ -40,13 +40,21 @@ class NetworkController implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$nextPageUrl = null;
|
||||
if ( $pager['last'] !== $pager['current'] ) {
|
||||
$nextPageUrl = $app['url_generator']->generate('networkData', array( 'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'page' => $pager['next']));
|
||||
}
|
||||
|
||||
return $app->json(array(
|
||||
'repo' => $repo,
|
||||
'branch' => $branch,
|
||||
'nextPage' => $pager['last'] !== $pager['current'] ? $pager['next'] : null,
|
||||
'nextPage' => $nextPageUrl,
|
||||
'start' => $commits[0]->getHash(),
|
||||
'commits' => $jsonFormattedCommits
|
||||
), 200);
|
||||
|
||||
})->assert('repo', $app['util.routing']->getRepositoryRegex())
|
||||
->assert('branch', $app['util.routing']->getBranchRegex())
|
||||
->value('branch', null)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="meta">Network Graph of {{ repo }} / {{ branch }}</div>
|
||||
</div>
|
||||
|
||||
<table class="table-striped network-graph" data-source="{{ path('networkData', {repo: repo, branch: branch, page: 0}) }}">
|
||||
<table class="table-striped network-graph" data-source="{{ path('networkData', {repo: repo, branch: branch}) }}">
|
||||
{#<div class="network-graph" data-source="/dummynetwork.json">#}
|
||||
|
||||
</table>
|
||||
|
||||
@@ -23,33 +23,40 @@ $( function() {
|
||||
|
||||
// the table element into which we will render our graph
|
||||
commitsTable = $('table.network-graph').first(),
|
||||
commitsDirectory = {},
|
||||
url = commitsTable.data('source');
|
||||
|
||||
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;
|
||||
});
|
||||
prepareCommits( data.commits );
|
||||
renderCommits( data.commits );
|
||||
}
|
||||
|
||||
function handleNetworkDataError( err ){
|
||||
@@ -57,7 +64,7 @@ $( function() {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user