Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List: organization owners #36

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
url: "/users-activity"
- title: "Git Versions"
url: "/users-git-versions"
- title: "Organization Owners"
url: "/org-owners"
- title: "Pull Requests"
url: "/pr-usage"
subnavigation:
Expand Down
22 changes: 15 additions & 7 deletions docs/assets/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,20 +362,28 @@ function createTable(table)
.enter()
.append("td")
.each(function(d, i) {
var cell = d3.select(this);
const cell = d3.select(this);
switch (data.columns[i].toLowerCase()) {
case "user":
case "organization":
case "repository":
case "resource":
case "fork":
cell = cell
.append("a")
.attr("target", "_blank")
.attr("href", gheUrl() + "/" + d);
break;
case "owners": {
const entries = d.split(",");
console.log(entries);
for (let i = 0; i < entries.length; i++) {
if (i > 0)
cell.innerHTML += ", ";
cell = cell
.append("a")
.attr("target", "_blank")
.attr("href", gheUrl() + "/" + entries[i]);
break;
}
}
}
cell.text(function(d) { return d; })
cell.text(function(d) { return d; });
});
});
}
Expand Down
10 changes: 10 additions & 0 deletions docs/demo-data/org-owners.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
organization owners
Alpha user39, user72, user81, user20
Bravo user50, user39
Charlie user80
Delta user78, user59, user86
Echo user70
Foxtrot user24, user87
Golf user36, user90, user27, user40, user67
Hotel user67, user90
India user65
21 changes: 21 additions & 0 deletions docs/org-owners.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: default
title: Organization Owners
permalink: /org-owners
---
<h3>
Organization Owners
</h3>

<div class="row">
<div class="col-main">
<div class="chart-container">
<table class="table" data-url="{{ site.dataURL }}/org-owners.tsv"></table>
</div>
</div>
<div class="col-aside">
<div class="info-box">
<p>Owners for each GitHub organization.</p>
</div>
</div>
</div>
15 changes: 15 additions & 0 deletions updater/reports/ReportOrgOwners.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from .Report import *

# Lists all orgs and their owners without site admins or suspended users
class ReportOrgOwners(Report):
def name(self):
return "org-owners"

# The data is overwritten every day, so skip reading the old data
def readData(self):
pass

def updateData(self):
self.header, self.data = self.parseData(
self.executeScript(self.scriptPath("org-owners.sh"))
)
12 changes: 12 additions & 0 deletions updater/scripts/org-owners.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#
# Get the owners for each org. Exclude site admins and suspended users.
#
echo -e "organization\towners"

github-env bin/runner -e production "'
User.where(:type => \"Organization\").each do |o|
owners = o.admins.where(:disabled => false, :gh_role => nil).join(\",\")
puts \"#{o.login}\\t#{owners}\\n\"
end
'"
2 changes: 2 additions & 0 deletions updater/update-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from reports.ReportGitRequests import *
from reports.ReportGitVersions import *
from reports.ReportOrgCollaboration import *
from reports.ReportOrgOwners import *
from reports.ReportPRByOrg import *
from reports.ReportPRByRepo import *
from reports.ReportPRHistory import *
Expand Down Expand Up @@ -75,6 +76,7 @@ def main():
ReportGitRequests(configuration, dataDirectory, metaStats).update()
ReportGitVersions(configuration, dataDirectory, metaStats).update()
ReportOrgCollaboration(configuration, dataDirectory, metaStats).update()
ReportOrgOwners(configuration, dataDirectory, metaStats).update()
ReportPRByOrg(configuration, dataDirectory, metaStats).update()
ReportPRByRepo(configuration, dataDirectory, metaStats).update()
ReportPRHistory(configuration, dataDirectory, metaStats).update()
Expand Down