Website for visualizing a persons github network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. /**
  2. * Add's all the members of the organization into the graphs
  3. * node objects
  4. *
  5. * @param orgname
  6. * @param page
  7. * @returns {Promise<any>}
  8. */
  9. function addOrgUsers(orgname, page)
  10. {
  11. return new Promise(function(resolve, reject)
  12. {
  13. queryAPIByOrg(API_ORG_MEMBERS + "?page=" + page, orgname, function(data)
  14. {
  15. for(var i = 0;i < data.length; i++)
  16. {
  17. addPersonToGraph(data[i]);
  18. }
  19. if(data.length === 30)
  20. {
  21. addOrgUsers(orgname, page + 1).then(function()
  22. {
  23. resolve();
  24. });
  25. }
  26. else
  27. {
  28. total = 2*(data.length + (page * 30));
  29. resolve();
  30. }
  31. }, function(error)
  32. {
  33. console.log(error);
  34. resolve();
  35. })
  36. })
  37. }
  38. /**
  39. * Creates a graph
  40. * @param username
  41. * @param containerName
  42. * @param graphsTitle
  43. */
  44. function createOrgRepoGraph(orgname, containerName, graphsTitle)
  45. {
  46. progressID = graphsTitle;
  47. nodes = [];
  48. edges = [];
  49. addOrgUsers(orgname, 1).then(function()
  50. {
  51. createConnections().then( () => {
  52. var container = document.getElementById(containerName);
  53. var data = {
  54. nodes: nodes,
  55. edges: edges
  56. };
  57. var network = new vis.Network(container, data, options);
  58. network.on("click", function (params) {
  59. params.event = "[original event]";
  60. if(Number(this.getNodeAt(params.pointer.DOM)) !== NaN) {
  61. bringUpProfileView(Number(this.getNodeAt(params.pointer.DOM)));
  62. }
  63. });
  64. $("#graphLoading").html("");
  65. });
  66. }).catch(function(error) {
  67. alert("Invalid Organization");
  68. });
  69. }