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(
|
return $app->json(array(
|
||||||
'repo' => $repo,
|
'repo' => $repo,
|
||||||
'branch' => $branch,
|
'branch' => $branch,
|
||||||
'nextPage' => $pager['last'] !== $pager['current'] ? $pager['next'] : null,
|
'nextPage' => $nextPageUrl,
|
||||||
'start' => $commits[0]->getHash(),
|
'start' => $commits[0]->getHash(),
|
||||||
'commits' => $jsonFormattedCommits
|
'commits' => $jsonFormattedCommits
|
||||||
), 200);
|
), 200);
|
||||||
|
|
||||||
})->assert('repo', $app['util.routing']->getRepositoryRegex())
|
})->assert('repo', $app['util.routing']->getRepositoryRegex())
|
||||||
->assert('branch', $app['util.routing']->getBranchRegex())
|
->assert('branch', $app['util.routing']->getBranchRegex())
|
||||||
->value('branch', null)
|
->value('branch', null)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="meta">Network Graph of {{ repo }} / {{ branch }}</div>
|
<div class="meta">Network Graph of {{ repo }} / {{ branch }}</div>
|
||||||
</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">#}
|
{#<div class="network-graph" data-source="/dummynetwork.json">#}
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -23,41 +23,48 @@ $( function() {
|
|||||||
|
|
||||||
// the table element into which we will render our graph
|
// the table element into which we will render our graph
|
||||||
commitsTable = $('table.network-graph').first(),
|
commitsTable = $('table.network-graph').first(),
|
||||||
commitsDirectory = {},
|
|
||||||
url = commitsTable.data('source');
|
url = commitsTable.data('source');
|
||||||
|
|
||||||
$.ajax({
|
function fetchCommitData( url ) {
|
||||||
dataType: "json",
|
|
||||||
url: url,
|
$.ajax({
|
||||||
success: handleNetworkDataLoaded,
|
dataType: "json",
|
||||||
error: handleNetworkDataError
|
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 ) {
|
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
|
// no commits or empty commits array? Well, we can't draw a graph of that
|
||||||
if( !data.commits || data.commits.length < 1 ) {
|
if( !data.commits || data.commits.length < 1 ) {
|
||||||
handleNoAvailableData();
|
handleNoAvailableData();
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
registerCommitsInDictionary( data.commits );
|
|
||||||
prepareCommits( data.commits );
|
prepareCommits( data.commits );
|
||||||
renderCommits( data.commits );
|
renderCommits( data.commits );
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerCommitsInDictionary( commits ) {
|
|
||||||
$.each(commits, function( index, commit ) {
|
|
||||||
commitsDirectory[ commit.hash ] = commit;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleNetworkDataError( err ){
|
function handleNetworkDataError( err ){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNoAvailableData() {
|
function handleNoAvailableData() {
|
||||||
graphContainer.html('It seems as though there are no commits in this repository / branch...');
|
console.log('No Data available');
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentsBeingWaitedFor = {},
|
var parentsBeingWaitedFor = {},
|
||||||
@@ -70,8 +77,6 @@ $( function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function findFreeLane() {
|
function findFreeLane() {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user