community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1864690 [1/2] - in /comdev/reporter.apache.org/trunk/site/wizard: ./ js/ js/source/
Date Thu, 08 Aug 2019 11:09:43 GMT
Author: humbedooh
Date: Thu Aug  8 11:09:43 2019
New Revision: 1864690

URL: http://svn.apache.org/viewvc?rev=1864690&view=rev
Log:
Beta updates for using the new API. Not deployed in prod yet

Added:
    comdev/reporter.apache.org/trunk/site/wizard/beta.html
    comdev/reporter.apache.org/trunk/site/wizard/js/wizard-beta.js
Modified:
    comdev/reporter.apache.org/trunk/site/wizard/js/source/base-http-extensions.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/build.sh
    comdev/reporter.apache.org/trunk/site/wizard/js/source/drafts.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/init.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/primer.js
    comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js

Added: comdev/reporter.apache.org/trunk/site/wizard/beta.html
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/beta.html?rev=1864690&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/beta.html (added)
+++ comdev/reporter.apache.org/trunk/site/wizard/beta.html Thu Aug  8 11:09:43 2019
@@ -0,0 +1,68 @@
+ <!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf8">
+<meta property='twitter:title' content='ASF Board Report Wizard'>
+<meta property='twitter:description' content='Guiding tool for creating board reports
for ASF projects'>
+<meta property='twitter:image' content='https://reporter.apache.org/guide/logo.png'>
+
+<meta property='og:site_name' content='ASF Board Report Wizard'>
+<meta property='og:title' content='ASF Board Report Wizard'>
+<meta property='og:type' content='website'>
+<meta property='og:image' content='https://reporter.apache.org/wizard/logo.png'>
+
+<title>ASF Board Report Wizard</title>
+<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/selawik" type="text/css"/>

+<link rel="stylesheet" href="css/wizard.css?unified-1.1"/>
+<link rel="stylesheet" href="highlighter/highlighter.css?unified-1.1"/>
+<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
+</head>
+<body onload="init_wizard(false);">
+ <div id="wizard_spinner" style="margin-top: 80px; height: 300px !important;">
+  <h4 style="text-align: center;" id="loader_text">Loading base data..</h4>
+  <div class="loader"></div>
+ </div>
+ 
+   <h2 id="pname" style="text-align: center; display: none;">Board Report Wizard</h2>
+   <div id="wrapper" style="display: none;" class="unified">
+    <div id="unified-steps"></div><div id="unified-editor"><div id="unified-reflow"></div><textarea
id="unified-report"></textarea></div><div id="unified-helper"></div>
+   </div>
+   
+   <!-- Modal for notices -->
+  <div class="modal fade" id="alert" role="dialog">
+    <div class="modal-dialog">
+    
+      <!-- Modal content-->
+      <div class="modal-content">
+        <div class="modal-header">
+          <h4 class="modal-title" id="modal-title">Notification</h4>
+        </div>
+        <div class="modal-body">
+          <p id="alert_text" style="font-size: 0.85rem;"></p>
+        </div>
+        <div class="modal-footer">
+          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
+        </div>
+      </div>
+      
+    </div>
+  </div>
+   
+   <footer style="text-align: center; font-size: 0.8rem; clear: both;">
+    Powered by the <a href='./'>ASF Board Report Wizard</a>. Copyright&copy;
2019 <a href='https://community.apache.org'>Apache Community Development</a>.<br/>
+    Queries or other feedback should go to our mailing list: dev@community.apache.org
+   </footer>
+   
+   
+   
+
+<script src="https://kit.fontawesome.com/a250232153.js"></script>
+<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
+<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
+<script src="highlighter/highlighter.js" type="text/javascript"></script>
+<script src="js/wizard-beta.js?unified-1.2" type="text/javascript"></script>
+</body>
+</html>
+

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/base-http-extensions.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/base-http-extensions.js?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/base-http-extensions.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/base-http-extensions.js Thu Aug
 8 11:09:43 2019
@@ -85,7 +85,7 @@ async function GET(url, callback, state,
             let meta = {method: method, credentials: 'include', referrerPolicy: 'unsafe-url',
headers: {'x-original-referral': document.referrer}};
             if (body) {
                 meta.body = body;
-                meta.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
+                meta.headers['Content-Type'] = 'application/json; charset=UTF-8';
             }
             console.log("putting %s in escrow...".format(url));
             async_escrow[pkey] = new Date(); // Log start of request in escrow dict

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/build.sh
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/build.sh?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/build.sh (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/build.sh Thu Aug  8 11:09:43 2019
@@ -16,9 +16,9 @@ echo '/*
  limitations under the License.
 */
 // THIS IS AN AUTOMATICALLY COMBINED FILE. PLEASE EDIT source/*.js!!
-' > ../wizard.js
+' > ../wizard-beta.js
 for f in `ls *.js`; do
-    printf "\n\n/******************************************\n Fetched from source/${f}\n******************************************/\n\n"
>> ../wizard.js
-    perl -0pe 's/\/\*.*?\*\/[\r\n]*//sm' ${f} >> ../wizard.js
+    printf "\n\n/******************************************\n Fetched from source/${f}\n******************************************/\n\n"
>> ../wizard-beta.js
+    perl -0pe 's/\/\*.*?\*\/[\r\n]*//sm' ${f} >> ../wizard-beta.js
 done
 echo "Done!"

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/drafts.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/drafts.js?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/drafts.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/drafts.js Thu Aug  8 11:09:43 2019
@@ -9,11 +9,10 @@ function save_draft() {
         'project': project,
         'action': 'save',
         'type': 'unified',
-        'report': JSON.stringify(draft_stepper.editor.report),
-        'report_compiled': draft_stepper.editor.report
+        'report': draft_stepper.editor.report
     }
     
-    let formdata = $.param(js);
+    let formdata = JSON.stringify(js);
     
     // Enable spinner, hide main wrapper
     document.getElementById('loader_text').innerText = "Saving draft...";
@@ -21,7 +20,7 @@ function save_draft() {
     document.getElementById('wrapper').style.display = 'none';
     document.getElementById("pname").style.display = 'none';
     
-    POST('drafts.py', draft_saved, {}, formdata);
+    POST('/api/drafts/save', draft_saved, {}, formdata);
 }
 
 function draft_saved(state, json) {
@@ -47,7 +46,7 @@ function draft_saved(state, json) {
 
 
 function load_draft(filename) {
-    GET('drafts.py?action=fetch&project=%s&filename=%s&type=%s'.format(project,
filename, editor_type), read_draft, {});
+    GET('/api/drafts/fetch?%s'.format(filename), read_draft, {});
 }
 
 function read_draft(state, json) {
@@ -66,7 +65,7 @@ function read_draft(state, json) {
 
 function list_drafts(pdata, editor) {
   if (!saved_drafts) {
-    GET('drafts.py?action=index&project=%s&type=%s'.format(project, editor_type),
show_draft_list, {stepper:editor.stepper});
+    GET('/api/drafts/index?%s'.format(project), show_draft_list, {stepper:editor.stepper});
     return "";
   }
   else {
@@ -79,7 +78,7 @@ function show_draft_list(state, json) {
   draft_stepper = state.stepper||draft_stepper; // hackish for now!
   if (!draft_stepper) return;
   let txt = "";
-  let filenames = Object.keys(saved_drafts);
+  let filenames = Object.keys(saved_drafts||{});
   if (filenames.length > 0) {
     txt += "<h6>Found the following saved drafts for %s:</h6>".format(project);
     txt += "<small style='font-size: 0.75rem;'><ul style='margin: 0px; padding:
10px;'>"
@@ -109,7 +108,7 @@ function delete_draft(filename) {
   if (!window.confirm("Are you sure you wish to delete %s?".format(filename))) {
     return;
   }
-  GET('drafts.py?action=delete&project=%s&filename=%s'.format(project, filename),
deleted_draft, {filename: filename});
+  GET('/api/drafts/delete?%s'.format(filename), deleted_draft, {filename: filename});
 }
 
 function deleted_draft(state, json) {
@@ -142,7 +141,15 @@ function publish_report() {
         'report': draft_stepper.editor.report
     };
     
-    let formdata = $.param(js);
+    if (meta_data && meta_data.filed) {
+      if (!window.confirm("The report already exists in %s. Do you wish to force an update?".format(agendafile)))
{
+        return;
+      }
+      js.digest = meta_data.report.digest;
+      js.attach = meta_data.report.attach;
+    }
+    
+    let formdata = JSON.stringify(js);
     
     // Enable spinner, hide main wrapper
     document.getElementById('loader_text').innerText = "Publishing report, hang on...";
@@ -150,7 +157,7 @@ function publish_report() {
     document.getElementById('wrapper').style.display = 'none';
     document.getElementById("pname").style.display = 'none';
     
-    POST('whimsy.py', report_published, {}, formdata);
+    POST('/api/whimsy/publish', report_published, {}, formdata);
 }
 
 function report_published(state, json) {
@@ -165,4 +172,19 @@ function report_published(state, json) {
   } else {
     modal("Something went wrong, and we couldn't publish your report.<br/>Please check
with the Whimsy tool to see if there is already a report posted!");
   }
+  
+  // Force whimsy reload of report meta data
+  GET("/api/whimsy/agenda/refresh?%s".format(project), prime_meta, {noreset: true});
+    
+}
+
+function load_from_agenda() {
+  if (meta_data && meta_data.report) {
+    if (draft_stepper.editor.unsaved && !window.confirm("You have unsaved changes
to your current draft. Do you wish to override these with the report in the agenda file??"))
return;
+    draft_stepper.editor.object.value = meta_data.report.report;
+    draft_stepper.editor.report = meta_data.report.report;
+    window.setTimeout(() => { draft_stepper.editor.highlight() }, 250);
+    draft_stepper.build(0, false, false);
+    draft_stepper.editor.check_changes(true);
+  }
 }
\ No newline at end of file

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/generators.js Thu Aug  8 11:09:43
2019
@@ -122,13 +122,24 @@ function generate_meta(data) {
     let txt = "<b>Founded: </b>%s (%s)<br/>".format(founded.format('YYYY-MM-DD'),
age);
     txt += "<b>Chair: </b> %s<br/>".format(data.pdata[project].chair);
     txt += getReportDate(cycles, project);
+    txt += "<br/>"
+    if (meta_data.found) {
+      txt += "<b>Report expected this month:</b> YES<br/>";
+      txt += "<b>Filed to agenda: </b>";
+      if (meta_data.filed) {
+        txt += "<span style='color: #080;'>Yes</span> <a class='btn btn-primary
btn-sm' href='javascript:void(load_from_agenda());'>Load from agenda</a>.";
+      } else {
+        txt += "<span style='color: #800;'>Not yet</span>";
+      }
+      txt += "<br/>"
+    }
     
     // Previous comments of note?
-    let cdates = Object.keys(comments.comments);
+    let cdates = Object.keys(meta_data.comments||{});
     cdates.sort();
-    if (comments && cdates.length > 0) {
+    if (meta_data && cdates.length > 0) {
       let date = cdates[cdates.length-1];
-      let comment = comments.comments[date];
+      let comment = meta_data.comments[date];
       
       // split and rejoin comments
       let ntxt = "";
@@ -149,7 +160,7 @@ function generate_meta(data) {
 
 function pre_splash(state, json) {
     cycles = json;
-    GET("/quickjson", splash, {});
+    GET("/api/overview", splash, {});
 }
 
 function splash(state, json, all) {

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/init.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/init.js?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/init.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/init.js Thu Aug  8 11:09:43 2019
@@ -44,7 +44,7 @@ function init_wizard(so) {
         console.log("Initializing escrow checks");
         window.setInterval(escrow_check, 250);
         
-        GET("/quickjson?%s".format(project), prime_wizard, {});
+        GET("/api/overview?%s".format(project), prime_wizard, {});
     }
 }
 document.body.addEventListener('keydown', () => { if (event.keyCode == 27) $("#alert").modal('hide');
});

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=1864690&r1=1864689&r2=1864690&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 Thu Aug  8 11:09:43 2019
@@ -1,7 +1,7 @@
 // some glopbal vars for now - we'll get them localized soon enough.
 let pdata = {};
 let cycles = {};
-let comments = {};
+let meta_data = {};
 
 function modal(txt, title = 'Notification') {
     document.getElementById('alert_text').innerHTML = txt;
@@ -27,12 +27,13 @@ function prime_wizard(state, json) {
     if (statsonly) {
         GET("/reportingcycles.json", prime_cycles, {});
     } else {
-        GET("comments.py?project=%s".format(project), prime_comments, {})
+        GET("/api/whimsy/agenda?%s".format(project), prime_meta, {})
     }
 }
 
-function prime_comments(state, json) {
-    comments = json;
+function prime_meta(state, json) {
+    meta_data = json;
+    if (state && state.noreset) return;
     GET("/reportingcycles.json", prime_cycles, {})
 }
 

Modified: comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js?rev=1864690&r1=1864689&r2=1864690&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js (original)
+++ comdev/reporter.apache.org/trunk/site/wizard/js/source/unified.js Thu Aug  8 11:09:43
2019
@@ -264,10 +264,14 @@ function UnifiedEditor_compile() {
       text += "Your report could possibly use some more work, and that's okay! You can always
save your current report as a draft and return later to work more on it. Drafts are saved
for up to two months.";
     }
     else {
-        text += "That's it, your board report compiled a-okay and is potentially ready for
submission! If you'd like more time to work on it, you can save it as a draft, and return
later to make some final edits. Or you can publish it to the agenda via Whimsy.";
+        text += "That's it, your board report compiled a-okay and is potentially ready for
submission! If you'd lih to ke more time to work on it, you can save it as a draft, and return
later to make some final edits. Or you can publish it to the agenda via Whimsy.";
     }
     text += "<br/><button class='btn btn-warning' onclick='save_draft();'>Save
as draft</button>"
-    if (this.compiles) text += " &nbsp; &nbsp; <button onclick='publish_report();'
class='btn btn-success'>Publish via Whimsy</button>"
+    if (!meta_data.found) {
+        text += " &nbsp; &nbsp; <button class='btn btn-secondary' disabled title='Your
project is not listed in the current agenda!'>Publish via Whimsy</button>";
+        text += "<br/><span style='color: maroon;'>Your project is not expected
to report this month. You may save drafts but you cannot publish yet.</span>";
+    }
+    else if (this.compiles) text += " &nbsp; &nbsp; <button onclick='publish_report();'
class='btn btn-success'>Publish via Whimsy</button>"
     else text += " &nbsp; &nbsp; <button class='btn btn-secondary' disabled title='Please
fix the above issues before you can publish'>Publish via Whimsy</button>"
     return text;
 }
@@ -282,6 +286,7 @@ function UnifiedEditor_check_changes(for
         this.stepper.helper.inject(saver);
     }
     if (this.report != this.report_saved) {
+        this.unsaved = true;
         if (saver) {
             saver.innerText = "Current changes not saved yet - ";
             let btn = new HTML('button', { onclick: 'save_draft();', class: 'btn btn-warning
btn-sm'}, 'Save draft');
@@ -293,6 +298,7 @@ function UnifiedEditor_check_changes(for
                 
         }
     } else if (saver) {
+        this.unsaved = false;
         saver.style.display = 'none';
         window.onbeforeunload = null;
     }



Mime
View raw message