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 2019/07/31 12:27:53 UTC

svn commit: r1864049 - in /comdev/reporter.apache.org/trunk/site/wizard/js: source/primer.js wizard.js

Author: humbedooh
Date: Wed Jul 31 12:27:53 2019
New Revision: 1864049

URL: http://svn.apache.org/viewvc?rev=1864049&view=rev
Log:
fix report compilation, bork if sections haven't been filled out

Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js?rev=1864049&r1=1864048&r2=1864049&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js Wed Jul 31 12:27:53 2019
@@ -39,9 +39,20 @@ function build_steps(s, start) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
-    if (!start && text && text.value.length > 0 && current_step < 4) {
+    if (!start && text && text.value.length > 0 && current_step < 5) {
         report[current_step] = text.value;
     }
+    
+    // Check that ALL fields are filled before preview
+    if (s == 5) {
+        for (var i = 1; i < 5; i++) {
+            let step = step_json[i];
+            if (report[i] == null || report[i].length == 0) {
+                alert("Please fill out the \"%s\" section before you preview the report!".format(step.description));
+                return
+            }
+        }
+    }
     text.innerText = '';
     current_step = s;
     
@@ -104,7 +115,7 @@ function build_steps(s, start) {
 
 function compile_report() {
     let rep = "## Board Report for %s ##\n".format(pdata.pdata[project].name);
-    for (var i = 0; i < 4; i++) {
+    for (var i = 1; i < 5; i++) {
         let step = step_json[i];
         rep += "\n## %s:\n".format(step.description);
         if (report[i] !== null) {

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js?rev=1864049&r1=1864048&r2=1864049&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/wizard.js Wed Jul 31 12:27:53 2019
@@ -1146,9 +1146,20 @@ function build_steps(s, start) {
     s = s || 0;
     
     let text = document.getElementById('step_text');
-    if (!start && text && text.value.length > 0 && current_step < 4) {
+    if (!start && text && text.value.length > 0 && current_step < 5) {
         report[current_step] = text.value;
     }
+    
+    // Check that ALL fields are filled before preview
+    if (s == 5) {
+        for (var i = 1; i < 5; i++) {
+            let step = step_json[i];
+            if (report[i] == null || report[i].length == 0) {
+                alert("Please fill out the \"%s\" section before you preview the report!".format(step.description));
+                return
+            }
+        }
+    }
     text.innerText = '';
     current_step = s;
     
@@ -1211,7 +1222,7 @@ function build_steps(s, start) {
 
 function compile_report() {
     let rep = "## Board Report for %s ##\n".format(pdata.pdata[project].name);
-    for (var i = 0; i < 4; i++) {
+    for (var i = 1; i < 5; i++) {
         let step = step_json[i];
         rep += "\n## %s:\n".format(step.description);
         if (report[i] !== null) {