From 5dc958c2f21bb8ec08e00ab16b5639700a3c8132 Mon Sep 17 00:00:00 2001 From: Sebastian Gutierrez Date: Tue, 29 Oct 2019 22:17:03 -0500 Subject: [PATCH] Redesign organization chart page --- public/OrgRepoGraph.html | 119 ++++++++++++++++++++---------------- public/js/createOrgInfo.js | 34 ++++++----- public/js/createOrgTable.js | 49 +++++++++++---- 3 files changed, 124 insertions(+), 78 deletions(-) diff --git a/public/OrgRepoGraph.html b/public/OrgRepoGraph.html index 5ffe776..f919545 100644 --- a/public/OrgRepoGraph.html +++ b/public/OrgRepoGraph.html @@ -8,11 +8,17 @@ + + + @@ -21,11 +27,7 @@ - - - - @@ -51,56 +53,71 @@ -
- -
-
-
+
+
+
+
+
+
+ + + +

Organization chart

+
+
+
-
-
-
-
-

-            
-
-
-

Repositories

- - - - - - - - - - - -
NameForksLanguage
- +
+
+
+
+
+
+
+
+
+
+
+

Repositories

+ + + + + + + + +
NameForks
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- -
- - + diff --git a/public/js/createOrgInfo.js b/public/js/createOrgInfo.js index dd49400..82a4903 100644 --- a/public/js/createOrgInfo.js +++ b/public/js/createOrgInfo.js @@ -1,17 +1,23 @@ -function createOrgInfo(orgName, container) { +function createOrgInfo(orgName, container) { queryAPIByOrg("", orgName, (orgData) => { - console.log("called"); - var html = "
"+ - "" + - "
\ -
\ -

"+orgData.name+"

" + - (orgData.description != null ? "

"+orgData.description+"

" : "") + " \ -
\ -
    "+ - (orgData.location !=null ? "
  • Location: "+orgData.location+"
  • " : "") + " \ -
\ -
"; + var html = ` +
+
+
+ ${orgData.name} +
+
+
+

${orgData.name}

+

${orgData.description}

+
    +
  • ${orgData.location}
  • +
+
+
+
+
+ `; $("#" + container).html(html); @@ -19,4 +25,4 @@ function createOrgInfo(orgName, container) { alert("Organization Does Not Exist"); window.location.href = "./GraphGenerator.html"; }); -} \ No newline at end of file +} diff --git a/public/js/createOrgTable.js b/public/js/createOrgTable.js index c9ced3a..ac8f642 100644 --- a/public/js/createOrgTable.js +++ b/public/js/createOrgTable.js @@ -1,10 +1,15 @@ -function generateHtmlRow(repoData) -{ - var html = ""; - html+="" + repoData.name + ""; - html+="" + repoData.forks + ""; - html+="" + repoData.language + ""; - html +=""; +function generateHtmlRow(repoData) { + var html = ` + + + ${repoData.language === 'null' + ? '
' + : ``} + ${repoData.name} + + ${repoData.forks} + + `; return html; } @@ -43,21 +48,39 @@ function createOrgTable(orgName, tableContainer) { var html = ""; + fetchAllRepositories(orgName, 1).then(function() { + for (var i=0; i < repos.length; i++) { + let icon = repos[i].language; + icon === null + ? icon = 'null' + : icon = icon.toLowerCase(); + + icon === 'c++' + ? icon = 'cplusplus' + : null; + + icon === 'c#' + ? icon = 'csharp' + : null; + + + repos[i].language = icon; - fetchAllRepositories(orgName, 1).then(function() - { - for(var i=0; i < repos.length; i++) - { html += generateHtmlRow(repos[i]); } $("#" + tableContainer).html(html); setTimeout(function() { - $('#dataTable').DataTable(); + $('#dataTable').DataTable({ + pageLength: 15, + pagingType: 'simple', + bLengthChange : false, + "bFilter" : false + }); }, 1500); }).catch(function(error) { //console.log("Unable to create table"); }); -} \ No newline at end of file +}