Revision: 85c5a7c1f2fd
Author:   Jussi Malinen
Date:     Tue Jun  7 03:47:40 2011
Log:      update report test details asynchronously
http://code.google.com/p/robotframework/source/detail?r=85c5a7c1f2fd

Modified:
 /src/robot/webcontent/report.html

=======================================
--- /src/robot/webcontent/report.html   Mon Jun  6 22:38:09 2011
+++ /src/robot/webcontent/report.html   Tue Jun  7 03:47:40 2011
@@ -375,14 +375,14 @@
 }

 function renderTotalSelector(linkTarget) {
-    $('#test_details_container').empty();
+    emptyDetails();
     var args = {linkTarget: linkTarget, totals_tab_status: 'tab_selected'};
$.tmpl(window.templates.detailsHeader, args).appendTo('#test_details_container'); $.tmpl(window.templates.totalDetailsSelector).appendTo('#test_details_container');
 }

 function renderTagsSelector(linkTarget) {
-    $('#test_details_container').empty();
+    emptyDetails();
     var args = {linkTarget: linkTarget, tags_tab_status: 'tab_selected'};
     var tagstats = {tags: window.testdata.statistics().tag};
$.tmpl(window.templates.detailsHeader, args).appendTo('#test_details_container');
@@ -390,12 +390,18 @@
 }

 function renderSuiteSelector(linkTarget) {
-    $('#test_details_container').empty();
+    emptyDetails();
     var args = {linkTarget: linkTarget, suites_tab_status: 'tab_selected'};
     var suitestats = {suites: window.testdata.statistics().suite};
$.tmpl(window.templates.detailsHeader, args).appendTo('#test_details_container'); $.tmpl(window.templates.suiteDetailsSelector, suitestats).appendTo('#test_details_container');
 }
+
+
+function emptyDetails(){
+    window.tasks = [];
+    $('#test_details_container').empty();
+}

 function totalDetailSelected(type) {
     if (type == "") return;
@@ -448,7 +454,8 @@

 function drawTestDetailsTable(tests) {
$.tmpl(window.templates.testDetailsTable).appendTo('#test_details_container'); - $.tmpl(window.templates.testDetailsRow, tests).appendTo('#tests_detail_table');
+    window.tasks = tests;
+    iterateDetails();
 }

 function ensureTotalDetailsAreVisible(type) {
@@ -550,6 +557,23 @@
         bodyclass = "non_critical_fail";
     $("body").addClass(bodyclass);
 }
+
+function iterateDetails(){
+    if (window.tasks.length == 0) {
+        return;
+    }
+    var elements = pop_upto(window.tasks, 50);
+ $.tmpl(window.templates.testDetailsRow, elements).appendTo('#tests_detail_table');
+    if(window.tasks.length > 0)
+        setTimeout("iterateDetails()", 0);
+}
+
+function pop_upto(list, upto) {
+    result = [];
+    while (list.length > 0 && result.length < upto)
+        result.push(list.shift());
+    return result;
+}

 function initTemplates() {
     return {
@@ -559,14 +583,15 @@
         tagStatRow: $('#tag_statistics_row').template(),
         suiteStatRow: $('#suite_statistics_row').template(),
         noTagsRow: $('#no_tags_row').template(),
-        testDetailsRow: $('#report_test_details_row').template(),
         detailsHeader: $('#details_header').template(),
         totalDetailsSelector: $('#total_details_selector').template(),
         tagDetailsSelector: $('#tag_details_selector').template(),
         suiteDetailsSelector: $('#suite_details_selector').template(),
         tagOrTotalDetails: $('#tag_or_total_details').template(),
         suiteDetails: $('#suite_details').template(),
-        testDetailsTable: $('#test_details_table').template()
+        testDetailsTable: $('#test_details_table').template(),
+        testDetailsRow: $('#report_test_details_row').template()
+
     };
 };
 </script>
@@ -671,18 +696,6 @@
   </tr>
 </script>

-<script type="text/html" id="report_test_details_row">
-  <tr class="test_row">
- <td class="col_name"><a href="log.html#test_${fullname}" id="test_${fullname}" title="${fullname}"><span class="parent_name">${parentName}</span>${name}</a></td>
-    <td class="col_doc">{{html documentation}}</td>
-    <td class="col_tags">${tags.join(', ')}</td>
-    <td class="col_crit">{{if isCritical}}yes{{else}}no{{/if}}</td>
-    <td class="col_status ${status}">${status.toUpperCase()}</td>
-    <td class="col_msg">${getFailureMessage()}</td>
- <td class="col_times">${times.startTime(true)}<br />${times.elapsedTime(true)}</td>
-  </tr>
-</script>
-
 <script type="text/html" id="details_header">
   <h2 id="${linkTarget}">Test Details</h2>
   <ul id="detail_tabs">
@@ -810,5 +823,17 @@
   </table>
 </script>

+<script type="text/html" id="report_test_details_row">
+  <tr class="test_row">
+ <td class="col_name"><a href="log.html#test_${fullname}" id="test_${fullname}" title="${fullname}"><span class="parent_name">${parentName}</span>${name}</a></td>
+    <td class="col_doc">{{html documentation}}</td>
+    <td class="col_tags">${tags.join(', ')}</td>
+    <td class="col_crit">{{if isCritical}}yes{{else}}no{{/if}}</td>
+    <td class="col_status ${status}">${status.toUpperCase()}</td>
+    <td class="col_msg">${getFailureMessage()}</td>
+ <td class="col_times">${times.startTime(true)}<br />${times.elapsedTime(true)}</td>
+  </tr>
+</script>
+
 </body>
 </html>

Reply via email to