community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1663611 - in /comdev/reporter.apache.org/site: index.html render.js
Date Tue, 03 Mar 2015 10:21:32 GMT
Author: humbedooh
Date: Tue Mar  3 10:21:31 2015
New Revision: 1663611

URL: http://svn.apache.org/r1663611
Log:
Add index page and rendering library

Added:
    comdev/reporter.apache.org/site/index.html
    comdev/reporter.apache.org/site/render.js

Added: comdev/reporter.apache.org/site/index.html
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/index.html?rev=1663611&view=auto
==============================================================================
--- comdev/reporter.apache.org/site/index.html (added)
+++ comdev/reporter.apache.org/site/index.html Tue Mar  3 10:21:31 2015
@@ -0,0 +1,43 @@
+<!doctype html>
+<html class="no-js" lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <link rel="stylesheet" href="css/foundation.css" />
+    <script src="js/vendor/modernizr.js"></script>
+   <script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
+   <script type="text/javascript" src="https://www.google.com/jsapi"></script>
+   <script src="render.js"></script>
+   
+   <title>Apache Project Report Helper</title>
+</head>
+<body>
+
+<div id="contents" class="row-12" style="text-align: left; margin: 0 auto; width: 1000px;
">
+   <p style="text-align: center;">
+      <div id="pct">Requesting project data, please wait...</div>
+      <div id="chart"></div>
+   </p>
+   <noscript>
+      This site relies heavily on JavaScript.
+      Please enable it or get a browser that supports it.
+   </noscript>
+</div>
+<div id="footer">
+   Copyright&copy; 2015, the Apache Software Foundation. Licensed under the Apache License
v/2.0<br/>
+   For inquiries, contact <a href="mailto:dev@community.apache.org">dev@community.apache.org</a>.
+</div>
+<script type="text/javascript">
+   google.load("visualization", "1", {packages:["corechart"]});
+   google.setOnLoadCallback(function() {
+      var project = document.location.search.substr(1);
+      GetAsyncJSON("/getjson.py?" + project, project, renderFrontPage)
+   });
+</script>
+<script src="js/vendor/jquery.js"></script>
+    <script src="js/foundation.min.js"></script>
+    <script>
+      $(document).foundation();
+    </script>
+</body>
+<html>

Added: comdev/reporter.apache.org/site/render.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/render.js?rev=1663611&view=auto
==============================================================================
--- comdev/reporter.apache.org/site/render.js (added)
+++ comdev/reporter.apache.org/site/render.js Tue Mar  3 10:21:31 2015
@@ -0,0 +1,483 @@
+var jsdata = {}
+var map = {
+    'trafficserver': 'TS',
+    'couchdb': 'COUCHDB',
+    'comdev': 'COMDEV'
+}
+
+var templates = {}
+
+// Function for async fetching of a single JSON file with JS callback
+function GetAsyncJSON(theUrl, xstate, callback) {
+    var xmlHttp = null;
+    if (window.XMLHttpRequest) {
+	xmlHttp = new XMLHttpRequest();
+    } else {
+	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+    }
+    xmlHttp.open("GET", theUrl, true);
+    xmlHttp.send(null);
+    xmlHttp.onprogress = function(state) {
+	var s = parseInt(xmlHttp.getResponseHeader('Content-Length'))
+	if (document.getElementById('pct')) {
+	    document.getElementById('pct').innerHTML = "<p style='text-align: center;'><b><i>Loading:
" + parseInt((100 * (xmlHttp.responseText.length/s))) + "% done</i></b></p>";
+	    if (parseInt((100 * (xmlHttp.responseText.length/s))) == 100) {
+		document.getElementById('pct').innerHTML = "";
+	    }
+	}
+    }
+    xmlHttp.onreadystatechange = function(state) {
+	
+	if (xmlHttp.readyState == 4 && xmlHttp.status == 200 || xmlHttp.status == 404) {
+	    if (callback) {
+		if (xmlHttp.status == 404) {
+		    callback({}, xstate);
+		} else {
+		    callback(JSON.parse(xmlHttp.responseText), xstate);
+		}
+	    }
+	}
+    }
+}
+
+function viewPMC(xpmc) {
+    for (i in jsdata.pmcs) {
+	var pmc = jsdata.pmcs[i]
+	var charts = document.getElementById(pmc)
+	if (xpmc == pmc) {
+	    charts.style.display = "block"
+	} else {
+	    charts.style.display = "none"
+	}
+    }
+}
+
+function getWednesdays(mo, y) {
+    var d = new Date();
+    if (mo) {
+	d.setMonth(mo);
+    }
+    if (y) {
+	d.setFullYear(y, d.getMonth(), d.getDay())
+    }
+    var month = d.getMonth(),
+	wednesdays = [];
+    
+    d.setDate(1);
+
+    // Get the first Monday in the month
+    while (d.getDay() !== 3) {
+        d.setDate(d.getDate() + 1);
+    }
+
+    // Get all the other Mondays in the month
+    while (d.getMonth() === month) {
+        wednesdays.push(new Date(d.getTime()));
+        d.setDate(d.getDate() + 7);
+    }
+
+    return wednesdays;
+}
+
+function setReportDate(json, x) {
+    var pmc = x[0]
+    var reportdate = x[1]
+	var fullname = (x[2] ? x[2] : "Unknown").replace(/Apache /, "")
+    var m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
'October', 'November', 'December']
+    var today = new Date()
+
+    var dates = []
+	if (!json[pmc]) {
+		pmc = fullname
+	}
+    for (i in json[pmc]) {
+		tm = 0;
+		sm = json[pmc][i]
+		for (x in m) {
+			if (m[x] == sm) {
+			tm = x;
+			}
+		}
+		dates.push(getWednesdays(tm)[2])
+		}
+		var ny = today.getFullYear() + 1;
+		for (i in json[pmc]) {
+			tm = 0;
+			sm = json[pmc][i]
+			for (x in m) {
+				if (m[x] == sm) {
+				tm = x;
+				}
+			}
+			dates.push(getWednesdays(tm)[2], ny)
+		}
+		var nextdate = dates[0];
+		while (nextdate < today) {
+		nextdate = dates.shift();
+    }
+    reportdate.innerHTML += "<b>Next report date: " + (nextdate ? nextdate.toDateString()
: "Unknown(?)") + "</b>"
+}
+ 
+function buildPanel(pmc, title) {
+    var parent = document.getElementById(pmc);
+    
+    var toc = document.getElementById('toc_' + pmc);
+    if (!toc) {
+	toc = document.createElement('cl')
+	toc.setAttribute("class", "sub-nav")
+	toc.setAttribute("id", "toc_" + pmc)
+	if (parent.firstChild.nextSibling) {
+	    parent.insertBefore(toc, parent.firstChild.nextSibling);
+	} else {
+	    parent.appendChild(toc)
+	}
+    }
+    var linkname = title.toLowerCase().replace(/[^a-z0-9]+/, "")
+    var li = document.createElement('dd');
+    li.setAttribute("role", "menu-item")
+    li.innerHTML = "<a href='#" + linkname + "_" + pmc + "'>" + title + "</a>"
+    toc.appendChild(li)
+    
+    var div = document.createElement('div');
+    div.setAttribute("id", linkname + "_" + pmc);
+    parent.appendChild(div)
+    
+    var titlebox = document.createElement('div');
+    titlebox.innerHTML = "<h3 style='background: #666; color: #EEE; border: 1px solid
#66A; margin-top: 30px;'>" + title + " &nbsp; &nbsp; <small> <b>&uarr;</b>
<a href='#" + pmc + "'>Back to top</a></small></h3>"
+    div.appendChild(titlebox);
+    return div;
+}
+
+function addLine(pmc, line) {
+    templates[pmc] += (line ? line : "") + "\n"
+}
+
+function renderFrontPage(json) {
+    jsdata = json
+    var container = document.getElementById('contents')
+    container.innerHTML = "<h1>Apache Project Report Helper</h1>Click on a project
name to view statistics:"
+    var top = document.createElement('div');
+    container.appendChild(top)
+    
+    
+    var panellist = document.createElement('ul');
+    panellist.style.background = "#CCCCFF"
+    panellist.style.textAlign = "center"
+    panellist.style.margin = "0 auto"
+    panellist.setAttribute("class", "tabs")
+    panellist.setAttribute("id", "tab");
+    panellist.setAttribute("data-tab", "")
+    panellist.setAttribute("role", "tablist")
+    container.appendChild(panellist)
+    
+    var pcontainer = document.createElement('div');
+    pcontainer.setAttribute("class", "tabs-content");
+    pcontainer.setAttribute("id", "pcontainer")
+    pcontainer.style = "text-align: left !important; margin: 0 auto; width: 1000px; border-radius:
5px; border: 2px solid #666; height: 500px; overflow: scroll !important; overflow-y: scroll
!important; "
+    container.appendChild(pcontainer)
+    
+    var sproject = document.location.search.substr(1);
+    for (i in json.pmcs) {
+	
+	var pmc = json.pmcs[i]
+	templates[pmc] = "Report from the " + (json.pdata[pmc].name ? json.pdata[pmc].name : pmc)
+ " project [" + (json.pdata[pmc].chair ? json.pdata[pmc].chair : "Put your name here") +
"]\n\n"
+	
+	addLine(pmc, "Description:")
+	if (json.pdata[pmc].shortdesc) {
+	    addLine(pmc, json.pdata[pmc].shortdesc)
+	} else {
+	    addLine(pmc, "Description goes here")
+	}
+	addLine(pmc)
+	
+	addLine(pmc, "Activity:")
+	addLine(pmc, " - TODO - the PMC must provide this information")
+	addLine(pmc)
+
+	addLine(pmc, "Issues:")
+	addLine(pmc, " -TODO - list any issues that require board attention, \n  or say \"there
are no issues requiring board attention at this time\"")
+	addLine(pmc)
+    
+	var obj = document.createElement('section');
+	obj.setAttribute("role", "tabpanel")
+	obj.setAttribute("class", "content")
+	obj.style = "padding: 10px; text-align: left !important; "
+	obj.setAttribute("aria-hidden", "true")
+	obj.setAttribute('id', pmc)
+	var title = document.createElement('h2')
+	title.innerHTML =json.pdata[pmc].name ? json.pdata[pmc].name : pmc
+	obj.appendChild(title)
+	
+	pcontainer.appendChild(obj)
+	
+	
+	
+	// Report date
+	
+	var mo = new Date().getMonth();
+	var reportdate = buildPanel(pmc, "Report date")
+	if (json.pdata[pmc].chair) {
+	    reportdate.innerHTML += "<b>Project Chair: </b>" + json.pdata[pmc].chair
+ "<br/>"
+	}
+	GetAsyncJSON("reportingcycles.json?" + Math.random(), [pmc, reportdate, json.pdata[pmc].name],
setReportDate)
+	
+	
+	// PMC + Committer changes
+	
+	var mo = new Date().getMonth() - 3;
+	var after = new Date();
+	after.setMonth(mo);
+	
+	var changes = buildPanel(pmc, "PMC/Committership changes");
+	
+	var c = 0;
+	for (i in json.changes[pmc].committer) c++;
+	for (i in json.changes[pmc].pmc) c++;
+	var nc = 0;
+	var np = 0;
+	var ncn = null;
+	var npn = null;
+	addLine(pmc, "PMC/Committership changes:")
+	addLine(pmc)
+	if (c == 0) {
+	    changes.innerHTML += "No new changes to the PMC or committer base detected since March
1st, 2015"
+	    addLine(pmc, "No new changes to the PMC or committership since last report.")
+	    addLine(pmc)
+	}
+	else {
+	    changes.innerHTML += "<h5>Changes within the last 3 months:</h5>"
+	    var l = 0;
+	    for (i in json.changes[pmc].pmc) {
+		var entry = json.changes[pmc].pmc[i];
+		if (entry[1] > np) {
+		    np = entry[1]
+		    npn = entry[0];
+		}
+		if (entry[1] > after.getTime()/1000) {
+		    l++;
+		    changes.innerHTML += "&rarr; " + entry[0] + " was added to the PMC on " + new Date(entry[1]*1000).toDateString()
+ "<br/>";
+		    addLine(pmc, " - " + entry[0] + " was added to the PMC on " + new Date(entry[1]*1000).toDateString())
+		}
+	    }
+	    if (l == 0) {
+		changes.innerHTML += "&rarr; No new PMC members in the last 3 months.<br/>";
+	    }
+	    for (i in json.changes[pmc].committer) {
+		var entry = json.changes[pmc].committer[i];
+		if (entry[1] > nc) {
+		    nc = entry[1]
+		    ncn = entry[0];
+		}
+		if (entry[1] > after.getTime()/1000) {
+		    l++;
+		    changes.innerHTML += "&rarr; " + entry[0] + " was added as a committer on " + new
Date(entry[1]*1000).toDateString() + "<br/>";
+		    addLine(pmc, " - " + entry[0] + " was added as a committer on " + new Date(entry[1]*1000).toDateString())
+		}
+	    }
+	    if (l == 0) {
+		changes.innerHTML += "&rarr; No new committers in the last 3 months.<br/>";
+	    }
+	    if (npn) {
+		if (np < after.getTime()/1000) {
+		    addLine(pmc, " - Last PMC addition was " + npn + " at " + new Date(np*1000).toDateString())
+		}
+		changes.innerHTML += "&rarr; " + "<b>Latest PMC addition: </b>" + new Date(np*1000).toDateString()
+ " (" + npn +  ")<br/>"
+	    }
+	    if (ncn) {
+		if (nc < after.getTime()/1000) {
+		    addLine(pmc, " - Last committer addition was " + ncn + " at " + new Date(nc*1000).toDateString())
+		}
+		changes.innerHTML += "&rarr; " + "<b>Latest committer addition: </b>" +
new Date(nc*1000).toDateString() + " (" + ncn +  ")<br/>"
+	    }
+	    addLine(pmc)
+	}
+	
+	// Release data
+	
+	var releases = buildPanel(pmc, "Releases")
+	addLine(pmc, "Releases:")
+	addLine(pmc)
+	var nr = 0;
+	var lr = null;
+	var lrn = 0;
+	var tr = 0
+	for (version in json.releases[pmc]) {
+	    tr++;
+	    var date = parseInt(json.releases[pmc][version])
+	    if (date > lrn) {
+		lrn = date
+		lr = version
+	    }
+	    if (date >= after.getTime()/1000) {
+		releases.innerHTML += "&rarr; " + "<b>" + version + " was released on </b>"
+ new Date(date*1000).toDateString() + "<br/>"
+		addLine(pmc, " - " + version + " was released on " + new Date(date*1000).toDateString())
+		nr++;
+	    }
+	}
+	
+	if (nr == 0) {
+	    if (lr) {
+		releases.innerHTML += "&rarr; " + "<b>Latest release was " + version + ", released
on </b>" + new Date(lrn*1000).toDateString() + "<br/>"
+		addLine(pmc, " - Last release was " + version + " on " + new Date(lrn*1000).toDateString())
+	    } else {
+		releases.innerHTML += "No release data could be found.<br/>"
+		addLine(pmc, "No release data could be found [FIX!]")
+	    }
+	}
+	releases.innerHTML += "<i>(A total of " + (tr-nr) + " older release(s) were found
for " + pmc + " in our db)</i><br/>"
+	releases.innerHTML += "<br/><a href='addrelease.html?" + pmc + "'>Add a release</a><br/>"
+	addLine(pmc)
+	
+	var mlbox = buildPanel(pmc, "Mailing lists");
+	
+	var ul = document.createElement('ul')
+	ul.style.textAlign = "left;"
+	mlbox.appendChild(ul)
+	var prev = ""
+	var f = 0
+	addLine(pmc, "Mailing list activity:")
+	addLine(pmc)
+	for (ml in json.mail[pmc]) {
+	    f++;
+	    if (ml != prev && ml.search("infra") < 0) {
+		prev = ml
+		var x = renderChart(json.mail[pmc], ml, obj)
+		var total = x[0]
+		var diff = x[1]
+		var div = x[2]
+		var d = ml.split(".org-");
+		var mlname = d[1] + "@" + d[0] + ".org"
+		var lookup = d[0].split(/\./)[0] + "-" + d[1]
+		add = ""
+		if (json.delivery[pmc][lookup]) {
+			add = ":\n    " + json.delivery[pmc][lookup][0] + " emails sent to list (" + json.delivery[pmc][lookup][1]
+ " in previous quarter)";
+		}
+		var text = "Currently: " + total + " subscribers <font color='green'>(up " + diff
+ " in the last 3 months)</font>"
+		if (diff < 0) {
+		    text = "Currently: " + total + " subscribers <font color='red'>(down " + diff
+ " in the last 3 months)</font>"
+		    if (d[1] != "private" && d[1] != "security" && d[1] != "commits") {
+			addLine(pmc, " - " + mlname + ": " + total + " subscribers (down " + diff + " in the last
3 months)" + add)
+		    }
+		} else {
+		    if (d[1] != "private" && d[1] != "security" && d[1] != "commits") {
+			addLine(pmc, " - " + mlname + ": " + total + " subscribers (up " + diff + " in the last
3 months)" + add)
+		    }
+		}
+		
+		if (json.delivery[pmc][lookup]) {
+			text += " (" + json.delivery[pmc][lookup][0] + " emails sent in the past 3 months, " +
json.delivery[pmc][lookup][1] + " in the previous cycle)"
+		}
+		
+		var p = document.createElement('li');
+		p.innerHTML = "<h5>" + mlname + ":</h5>" + text
+		p.appendChild(div)
+		ul.appendChild(p)
+	    }
+	}
+	addLine(pmc)
+	
+	// Add btn for nav
+	if (f > 0) {
+	    var btn = document.createElement('li');
+	    btn.setAttribute("id", "btn_" + pmc)
+	    btn.setAttribute("class", "tab-title")
+	    btn.setAttribute("onclick", "$('#pcontainer').animate({scrollTop: -99999}, 500)");
+	    btn.innerHTML = "<a href='#" + pmc + "'>" + pmc + "</a>"
+	    panellist.appendChild(btn)
+	    if (sproject && sproject == pmc) {
+		$('#btn_'+pmc).click();
+		$('#' + pmc).addClass("active");
+	    }
+	    
+	}
+	
+	
+	
+	
+	if (json.jira[pmc][0] > 0 || json.jira[pmc][1] > 0) {
+	    renderJIRA(pmc, map[pmc])
+	}
+	
+	
+	// Reporting example
+	var template = buildPanel(pmc, "Report template");
+	template.innerHTML += "<pre>" + templates[pmc] + "</pre>"
+    }
+    if (json.pmcs.length == 0) {
+	container.innerHTML = "You are not a member of any top level project PMC, sorry!"
+    }
+    
+    $(document).foundation();
+    $(document).foundation('tab', 'reflow');
+}
+
+
+function renderJIRA(pmc, project) {
+    var obj = buildPanel(pmc, "JIRA Statistics")
+ 
+    addLine(pmc, "JIRA activity:")
+    addLine(pmc)
+    addLine(pmc, " - " + jsdata.jira[pmc][0] + " JIRA tickets created in the last 3 months");
+    addLine(pmc, " - " + jsdata.jira[pmc][1] + " JIRA tickets closed/resolved in the last
3 months");
+    addLine(pmc)
+    obj.innerHTML += jsdata.jira[pmc][0] + " JIRA tickets created in the last 3 months<br/>";
+    obj.innerHTML += jsdata.jira[pmc][1] + " JIRA tickets closed/resolved in the last 3 months<br/>";
+    
+}
+
+
+function renderChart(json, name, container) {
+    
+    var chartDiv = document.createElement('div')
+    chartDiv.setAttribute("id", name + "_chart")
+    var dates = []
+    for (date in json[name]) {
+	dates.push(date)
+    }
+    var d = name.split(".org-");
+    var mlname = d[1] + "@" + d[0] + ".org"
+    dates.sort();
+    var cu = 0;
+    narr = []
+    hitFirst = false
+    dates.pop();
+    
+    var dp = new Date();
+    dp.setMonth(dp.getMonth() - 3);
+
+    difference = 0
+    for (i in dates) {
+	var date = dates[i];
+	var dateString = new Date(parseInt(date)*1000);
+	if (dateString > dp) {
+	    difference += json[name][date]
+	}
+	cu = cu + json[name][date];
+	if (cu > 0) {
+	    hitFirst = true
+	}
+	if (cu > 0 || hitFirst) {
+	    narr.push([dateString, cu])
+	}
+	
+    }
+    
+    var data = new google.visualization.DataTable();
+        data.addColumn('date', 'Date');
+        data.addColumn('number', "List members");
+        data.addRows(narr);
+
+    
+    var options = {
+      title: 'Mailing list subscribers for ' + mlname,
+      height: 240,
+      width: 800,
+      backgroundColor: 'transparent'
+    };
+
+    var chart = new google.visualization.LineChart(chartDiv);
+    
+    chart.draw(data, options);
+    return [cu, difference, chartDiv];
+
+}



Mime
View raw message