You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2017/06/18 07:58:28 UTC

svn commit: r1799056 - in /comdev/reporter.apache.org/trunk/site/js: coffee/main.coffee tabs.js

Author: humbedooh
Date: Sun Jun 18 07:58:28 2017
New Revision: 1799056

URL: http://svn.apache.org/viewvc?rev=1799056&view=rev
Log:
- fix date calculator
- return after using cache (don't re-render)

Modified:
    comdev/reporter.apache.org/trunk/site/js/coffee/main.coffee
    comdev/reporter.apache.org/trunk/site/js/tabs.js

Modified: comdev/reporter.apache.org/trunk/site/js/coffee/main.coffee
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/js/coffee/main.coffee?rev=1799056&r1=1799055&r2=1799056&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/js/coffee/main.coffee (original)
+++ comdev/reporter.apache.org/trunk/site/js/coffee/main.coffee Sun Jun 18 07:58:28 2017
@@ -22,7 +22,7 @@ makeSelect = (name, arr) ->
 
 getWednesdays = (mo, y) ->
     d = new Date();
-    if mo
+    if not isNaN(mo)
         d.setMonth(mo);
     if y
         d.setFullYear(y, d.getMonth(), d.getDate())
@@ -223,8 +223,7 @@ epochSecsYYYYMMDD = (t) =>
 renderFrontPage = (tpmc) ->
     thisHour = toInt(new Date().getTime() / (3600*1000)) # this changes once per hour
     container = document.getElementById('contents')
-    top = document.createElement('div');
-    container.appendChild(top)
+    
     json = jsdata
     sproject = tpmc;
     hcolors = ["#000070", "#007000", "#407000", "#70500", "#700000", "#A00000"]
@@ -232,9 +231,12 @@ renderFrontPage = (tpmc) ->
     container.innerHTML = ""
     for pmc, i in json.pmcs
         if pmc == tpmc or not tpmc
+            top = document.createElement('div');
+            container.appendChild(top)
             # If we already rendered this, just re-add it
             if rendered[pmc]
                 container.appendChild(rendered[pmc])
+                return
             # Stuff has broken, check that we have dates!
             if (not pmc in json.pmcdates)
                 continue

Modified: comdev/reporter.apache.org/trunk/site/js/tabs.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/js/tabs.js?rev=1799056&r1=1799055&r2=1799056&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/js/tabs.js (original)
+++ comdev/reporter.apache.org/trunk/site/js/tabs.js Sun Jun 18 07:58:28 2017
@@ -137,7 +137,7 @@ makeSelect = function(name, arr) {
 getWednesdays = function(mo, y) {
   var d, month, wednesdays;
   d = new Date();
-  if (mo) {
+  if (!isNaN(mo)) {
     d.setMonth(mo);
   }
   if (y) {
@@ -349,23 +349,23 @@ epochSecsYYYYMMDD = (function(_this) {
 })(this);
 
 renderFrontPage = function(tpmc) {
-  var a, add, after, c, changes, container, cu, d, date, dialog, diff, div, entry, err, f, first, hcolors, health, hvalues, i, j, json, k, l, len1, len2, lookup, lr, lrn, ml, mlbox, mlname, mo, nc, ncn, ncom, np, npmc, npn, nr, obj, p, pmc, prev, rdialog, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, releases, reportdate, results, skip, sproject, template, text, thisHour, title, top, total, tr, ul, version, x, xml, y;
+  var a, add, after, c, changes, container, cu, d, date, dialog, diff, div, entry, err, f, first, hcolors, health, hvalues, i, j, json, k, l, len1, len2, lookup, lr, lrn, ml, mlbox, mlname, mo, nc, ncn, ncom, np, npmc, npn, nr, obj, p, pmc, prev, rdialog, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, releases, reportdate, skip, sproject, template, text, thisHour, title, top, total, tr, ul, version, x, xml, y;
   thisHour = toInt(new Date().getTime() / (3600 * 1000));
   container = document.getElementById('contents');
-  top = document.createElement('div');
-  container.appendChild(top);
   json = jsdata;
   sproject = tpmc;
   hcolors = ["#000070", "#007000", "#407000", "#70500", "#700000", "#A00000"];
   hvalues = ["Super Healthy", "Healthy", "Mostly Okay", "Unhealthy", "Action required!", "URGENT ACTION REQUIRED!"];
   container.innerHTML = "";
   ref = json.pmcs;
-  results = [];
   for (i = j = 0, len1 = ref.length; j < len1; i = ++j) {
     pmc = ref[i];
     if (pmc === tpmc || !tpmc) {
+      top = document.createElement('div');
+      container.appendChild(top);
       if (rendered[pmc]) {
         container.appendChild(rendered[pmc]);
+        return;
       }
       if ((ref1 = !pmc, indexOf.call(json.pmcdates, ref1) >= 0)) {
         continue;
@@ -691,12 +691,9 @@ renderFrontPage = function(tpmc) {
       rdialog.setAttribute("title", "Add a release for " + pmc);
       rdialog.setAttribute("style", "display: none;");
       rdialog.innerHTML = "<form><b>Version:</b><input type='text' name='version' placeholder='1.2.3'><br>" + "<b>Date:</b> <input name='date' type='text' placeholder='YYYY-MM-DD'/><br>" + "<input type='button' value='Add release' onclick='addRelease(\"" + pmc + "\", this.form[\"version\"].value, this.form[\"date\"].value);'></form>";
-      results.push(container.appendChild(rdialog));
-    } else {
-      results.push(void 0);
+      container.appendChild(rdialog);
     }
   }
-  return results;
 };
 
 renderJIRA = function(pmc) {