Skip to content

Commit 8d1b70b

Browse files
committed
Fixed how the repository list was being generated for the organizations.
1 parent 5c00be0 commit 8d1b70b

3 files changed

Lines changed: 41 additions & 60 deletions

File tree

public/js/createOrgRepoGraph.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -43,47 +43,6 @@ function alreadyInGraph(userID)
4343
}
4444

4545

46-
47-
/**
48-
* Adds the followers/following of a person
49-
* to the graph
50-
*
51-
* @param username
52-
* @param apiPath
53-
* @returns {Promise<any>}
54-
*/
55-
function addRepos(orgName, apiPath, page)
56-
{
57-
console.log(orgName + " page=" + page);
58-
updateProgress();
59-
return new Promise(function(resolve, reject) {
60-
queryAPIByOrg(apiPath + "?page=" + page, orgName, function(data) {
61-
console.log(data);
62-
console.log(data.length);
63-
var prom = [];
64-
for(var i = 0; i < data.length; i++) {
65-
if(!alreadyInGraph(data[i].id)) {
66-
prom.push(addRepoToGraph(data[i]));
67-
}
68-
}
69-
Promise.all(prom).then( () => {
70-
if(data.length === 30) {
71-
addRepos(orgName, apiPath, page+ 1).then(function() {
72-
resolve();
73-
})
74-
}
75-
else {
76-
resolve();
77-
}
78-
})
79-
},
80-
function(error) {
81-
reject(error);
82-
})
83-
});
84-
}
85-
86-
8746
/**
8847
* Greedy function which checks to see if a edge is in the graphs
8948
*

public/js/createOrgTable.js

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,52 @@ function generateHtmlRow(repoData)
99
}
1010

1111

12-
function createOrgTable(orgName, tableContainer)
12+
var repos = [];
13+
14+
function fetchAllRepositories(orgName, page)
1315
{
14-
var html = "";
16+
return new Promise(function(resolve, reject)
17+
{
18+
queryAPIByOrg(API_REPOSITORIES + "?page=" + page, orgName,
19+
function(data)
20+
{
21+
repos.push(...data);
1522

16-
queryAPIByOrg(API_REPOSITORIES, orgName,
17-
function(data)
18-
{
19-
for(var i=0; i < data.length; i++)
23+
if (data.length === 30)
24+
{
25+
fetchAllRepositories(orgName, page + 1).then(function ()
26+
{
27+
resolve();
28+
})
29+
}
30+
else {
31+
resolve();
32+
}
33+
},
34+
function(error)
2035
{
21-
html += generateHtmlRow(data[i]);
22-
}
36+
//console.log("Unable to load table data");
37+
});
38+
});
39+
}
40+
41+
42+
function createOrgTable(orgName, tableContainer)
43+
{
44+
var html = "";
2345

24-
$("#" + tableContainer).html(html);
25-
$('#dataTable').DataTable();
2646

27-
},
28-
function(error)
47+
fetchAllRepositories(orgName, 1).then(function()
48+
{
49+
for(var i=0; i < repos.length; i++)
2950
{
30-
console.log("Unable to load table data");
31-
});
51+
html += generateHtmlRow(repos[i]);
52+
}
3253

54+
$("#" + tableContainer).html(html);
55+
$('#dataTable').DataTable();
56+
}).catch(function(error)
57+
{
58+
//console.log("Unable to create table");
59+
});
3360
}

public/js/friendsGraph.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,11 @@ function addPersonToGraph(profileData)
6666
*/
6767
function addFriends(username, apiPath, page)
6868
{
69-
console.log(username + " page=" + page);
7069
updateProgress();
7170
return new Promise(function(resolve, reject)
7271
{
7372
queryAPIByUser(apiPath + "?page=" + page, username, function(data)
7473
{
75-
console.log(data);
76-
console.log(data.length);
7774
for(var i = 0; i < data.length; i++)
7875
{
7976
if(!alreadyInGraph(data[i].id))
@@ -111,7 +108,6 @@ function addFriends(username, apiPath, page)
111108
*/
112109
function edgeInGraph(id1, id2)
113110
{
114-
console.log("edge check");
115111
for(var i = 0;i < edges.length; i++)
116112
{
117113
if(edges[i].from === id1 && edges[i].to === id2)
@@ -305,7 +301,6 @@ function createFriendsGraph(username, containerName, graphsTitle)
305301
{
306302
createConnections().then(function()
307303
{
308-
console.log("cleared div");
309304
$("#" + progressID).html("");
310305

311306
var container = document.getElementById(containerName);

0 commit comments

Comments
 (0)