community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1665071 - in /comdev/reporter.apache.org/site: getjson.py render.js
Date Sun, 08 Mar 2015 20:01:59 GMT
Author: humbedooh
Date: Sun Mar  8 20:01:58 2015
New Revision: 1665071

URL: http://svn.apache.org/r1665071
Log:
Allow for members to do a drop-in addition of a project in their view instead of having to
reload everything.

Modified:
    comdev/reporter.apache.org/site/getjson.py
    comdev/reporter.apache.org/site/render.js

Modified: comdev/reporter.apache.org/site/getjson.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/getjson.py?rev=1665071&r1=1665070&r2=1665071&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/getjson.py (original)
+++ comdev/reporter.apache.org/site/getjson.py Sun Mar  8 20:01:58 2015
@@ -1,6 +1,10 @@
 #!/usr/bin/env python
 import os, sys, re, json, subprocess, urllib, time
-import base64, urllib2
+import base64, urllib2, cgi
+
+form = cgi.FieldStorage();
+oproject = form['only'].value if ('only' in form and len(form['only'].value) > 0) else
None
+
 
 jmap = {
     'trafficserver': ['TS'],
@@ -186,6 +190,8 @@ if m:
     include = os.environ['QUERY_STRING'] if 'QUERY_STRING' in os.environ else None
     if include and isMember(uid) and not include in groups and len(include) > 1:
         groups.append(include)
+    if oproject and len(oproject) > 0 and isMember(uid):
+        groups = [oproject]
     mlstats = {}
     with open("/var/www/reporter.apache.org/data/mailinglists.json", "r") as f:
         ml = json.loads(f.read())

Modified: comdev/reporter.apache.org/site/render.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/render.js?rev=1665071&r1=1665070&r2=1665071&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/render.js (original)
+++ comdev/reporter.apache.org/site/render.js Sun Mar  8 20:01:58 2015
@@ -571,12 +571,15 @@ function renderFrontPage(json) {
 		btn.setAttribute("id", "btn_all")
 		btn.setAttribute("class", "tab-title")
 		json.all.sort()
-		json.all.unshift("-----------------------")
-		json.all.unshift("Members-only Quick-nav:")
+		if (json.all.indexOf("-----------------------") == -1) {
+			json.all.unshift("-----------------------")
+			json.all.unshift("Members-only Quick-nav:")
+		}
+		
 		var sel = makeSelect("project", json.all, [])
 		sel.setAttribute("style", "height: 32px !important; padding: 0px !important; margin: 0px
!important; margin-left: 32px !important;")
 		sel.style = "break-before: never; break-after: never; float: left"
-		sel.setAttribute("onchange", "location.href = '/?' + this.value;")
+		sel.setAttribute("onchange", "GetAsyncJSON('/getjson.py?only='+ this.value, this.value,
mergeData);")
 		btn.appendChild(sel)
 		panellist.appendChild(btn)
 
@@ -586,6 +589,25 @@ function renderFrontPage(json) {
 
 }
 
+function mergeData(json, pmc) {
+	if (nproject && nproject.length > 0) {
+		for (i in jsdata.pmcs) {
+			if (jsdata.pmcs[i] == nproject) {
+				jsdata.pmcs.splice(i,1);
+				break
+			}
+		}
+	}
+	var todo = new Array('count', 'mail', 'delivery', 'jira', 'changes', 'pdata', 'releases',
'keys')
+	for (i in todo) {
+		var key = todo[i]
+		jsdata[key][pmc] = json[key][pmc];
+	}
+	jsdata.pmcs.push(pmc)
+	nproject = pmc
+	renderFrontPage(jsdata)
+}
+
 
 function renderJIRA(pmc) {
 	var obj = buildPanel(pmc, "JIRA Statistics")



Mime
View raw message