community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1664861 - in /comdev/reporter.apache.org/site: jiraversions.py render.js
Date Sat, 07 Mar 2015 15:04:36 GMT
Author: humbedooh
Date: Sat Mar  7 15:04:36 2015
New Revision: 1664861

URL: http://svn.apache.org/r1664861
Log:
- re-render the report when JIRA release versions are added, instead of requiring user to
refresh
- allow members to add release data for arbitrary projects

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

Modified: comdev/reporter.apache.org/site/jiraversions.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/jiraversions.py?rev=1664861&r1=1664860&r2=1664861&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/jiraversions.py (original)
+++ comdev/reporter.apache.org/site/jiraversions.py Sat Mar  7 15:04:36 2015
@@ -29,13 +29,24 @@ def getReleaseData(project):
         return {}
 
 
+def isMember(uid):
+    members = []
+    ldapdata = subprocess.check_output(['ldapsearch', '-x', '-LLL', '-b', 'cn=member,ou=groups,dc=apache,dc=org'])
+    for match in re.finditer(r"memberUid: ([-a-z0-9_.]+)", ldapdata):
+        group = match.group(1)
+        members.append(group)
+    if uid in members:
+        return True
+    return False
+
+
 jirapass = ""
 with open("/var/www/reporter.apache.org/data/jirapass.txt", "r") as f:
     jirapass = f.read().strip()
     f.close()
 
 groups = getPMCs(user)
-if project in groups  and jiraname:
+if (isMember(user) or project in groups)  and jiraname:
        jiraname = jiraname.upper()
        base64string = base64.encodestring('%s:%s' % ('githubbot', jirapass))[:-1]
        rdata = getReleaseData(project)
@@ -55,7 +66,8 @@ if project in groups  and jiraname:
               f.write(json.dumps(rdata))
               f.close()
               
-       print("Content-Type: application/json\r\n\r\n{\"status\": \"Fetched\"}\r\n")
+       print("Content-Type: application/json\r\n\r\n")
+       print(json.dumps({'status': 'Fetched', 'versions': rdata}))
     
 else:
        print("Content-Type: application/json\r\n\r\n{\"status\": \"Data missing\"}\r\n")

Modified: comdev/reporter.apache.org/site/render.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/site/render.js?rev=1664861&r1=1664860&r2=1664861&view=diff
==============================================================================
--- comdev/reporter.apache.org/site/render.js (original)
+++ comdev/reporter.apache.org/site/render.js Sat Mar  7 15:04:36 2015
@@ -6,6 +6,7 @@ var map = {
 }
 
 var templates = {}
+var nproject = null;
 
 // Function for async fetching of a single JSON file with JS callback
 function GetAsyncJSON(theUrl, xstate, callback) {
@@ -520,7 +521,7 @@ function renderFrontPage(json) {
         }
     });
 	
-	var project = document.location.search.substr(1);
+	var project = nproject ? nproject : document.location.search.substr(1);
 	
     if (project && project.length > 0) {
       $("#tabcontents #tab_" + project).fadeIn();
@@ -660,8 +661,15 @@ function renderChart(json, name, contain
 
 function renderReleaseChart(releases, name, container) {
     
-    var chartDiv = document.createElement('div')
-    chartDiv.setAttribute("id", name + "_releasechart")
+	
+    var chartDiv;
+	if (document.getElementById(name + "_releasechart")) {
+		chartDiv = document.getElementById(name + "_releasechart")
+	} else {
+		chartDiv = document.createElement('div')
+		chartDiv.setAttribute("id", name + "_releasechart")
+	}
+    
     var narr = []
 	var maxLen = 1;
 	for (version in releases) {
@@ -713,7 +721,20 @@ function renderReleaseChart(releases, na
 
 function fetchJIRA(pmc, project, prepend ) {
 	if (project && project.length > 1) {
-		GetAsyncJSON("/jiraversions.py?project=" + pmc + "&jiraname=" + project + "&prepend="
+ prepend, null, function() { alert("Information has been fetched, please reload this page!");
})
+		GetAsyncJSON("/jiraversions.py?project=" + pmc + "&jiraname=" + project + "&prepend="
+ prepend, null,
+		 function(json) {
+			if (json && json.versions) {
+				for (version in json.versions) {
+					jsdata.releases[pmc][version] = json.versions[version]
+				}
+				$('#dialog_' + pmc).dialog("close")
+				var nproject = pmc
+				renderFrontPage(jsdata)
+				
+			} else {
+				alert("Couldn't find any release data :(")
+			}
+		})
 	}
 	
 }
\ No newline at end of file



Mime
View raw message