[LNT] r263938 - [profile] Several javascript fixes

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 04:48:28 PDT 2016


Author: jamesm
Date: Mon Mar 21 06:48:27 2016
New Revision: 263938

URL: http://llvm.org/viewvc/llvm-project?rev=263938&view=rev
Log:
[profile] Several javascript fixes

  - Fix race condition between run source data returning and runTypeahead being initialized.
  - Remove history editing functionality because g_runids has been removed. A better solution is needed here.
  - Add an error handler to ajax call getFunctions. It needs to be more clever, but at least now we get feedback.

Modified:
    lnt/trunk/lnt/server/ui/static/lnt_profile.js
    lnt/trunk/lnt/server/ui/templates/reporting/runs.html
    lnt/trunk/lnt/server/ui/templates/v4_run.html

Modified: lnt/trunk/lnt/server/ui/static/lnt_profile.js
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/lnt_profile.js?rev=263938&r1=263937&r2=263938&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/static/lnt_profile.js (original)
+++ lnt/trunk/lnt/server/ui/static/lnt_profile.js Mon Mar 21 06:48:27 2016
@@ -348,11 +348,14 @@ FunctionTypeahead.prototype = {
 
                 if (this_.options.sourceRunUpdated)
                     this_.options.sourceRunUpdated(data);
+            },
+            error: function(xhr, textStatus, errorThrown) {
+                pf_flash_error('accessing URL ' + g_urls.getFunctions +
+                               '; ' + errorThrown);
             }
         });
     },
     _source: function () {
-        console.log(this.$element.data('functionTypeahead').data);
         return this.$element.data('functionTypeahead').data;
     },
     _renderItem: function (fn, query) {
@@ -507,14 +510,14 @@ function pf_init(run1, run2, testid, url
                 $('#stats')
                     .statsBar({testid: testid})
                     .go(ids);
-                $('#profile2').profile({runid: r1,
+                $('#profile2').profile({runid: r2,
                                         testid: testid,
                                         uniqueid: 'r'});
 
             }
         });
     
-    $('#run1_box')
+    var r1 = $('#run1_box')
         .runTypeahead({
             searchURL: g_urls.search,
             updated: function(name, id) {
@@ -528,8 +531,7 @@ function pf_init(run1, run2, testid, url
                 $('#fn1_box').val('').prop('disabled', true);
                 $('#profile1').profile().reset();
             }
-        })
-        .update(pf_make_stub(run1.machine, run1.order), run1.id);
+        });
 
     var r2 = $('#run2_box')
         .runTypeahead({
@@ -546,6 +548,8 @@ function pf_init(run1, run2, testid, url
                 $('#profile2').profile().reset();
             }
         });
+
+    r1.update(pf_make_stub(run1.machine, run1.order), run1.id);
     if (!$.isEmptyObject(run2))
         r2.update(pf_make_stub(run2.machine, run2.order), run2.id);
 
@@ -666,18 +670,19 @@ function pf_get_counter() {
 // pf_update_history - Push a new history entry, as we've just navigated
 // to what could be a new bookmarkable page.
 function pf_update_history() {
-    var url;
-    if (g_runids[1]) {
-        url = g_urls.comparison_template
-            .replace('<testid>', g_testid)
-            .replace('<run1id>', g_runids[0])
-            .replace('<run2id>', g_runids[1]);
-    } else {
-        url = g_urls.singlerun_template
-            .replace('<testid>', g_testid)
-            .replace('<run1id>', g_runids[0]);
-    }
-    history.pushState({}, document.title, url);
+    // FIXME: g_runids is no longer available.
+    // var url;
+    // if (g_runids[1]) {
+    //     url = g_urls.comparison_template
+    //         .replace('<testid>', g_testid)
+    //         .replace('<run1id>', g_runids[0])
+    //         .replace('<run2id>', g_runids[1]);
+    // } else {
+    //     url = g_urls.singlerun_template
+    //         .replace('<testid>', g_testid)
+    //         .replace('<run1id>', g_runids[0]);
+    // }
+    // history.pushState({}, document.title, url);
 }
 
 //////////////////////////////////////////////////////////////////////

Modified: lnt/trunk/lnt/server/ui/templates/reporting/runs.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/reporting/runs.html?rev=263938&r1=263937&r2=263938&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/runs.html (original)
+++ lnt/trunk/lnt/server/ui/templates/reporting/runs.html Mon Mar 21 06:48:27 2016
@@ -48,7 +48,7 @@
              {% else %}
              {% set compare_to_id = None %}
              {% endif %}
-             {{ utils.render_profile_link(cr.profile, cr.prev_profile, run.id, compare_to_id, test_id) }}
+             {{ utils.render_profile_link(cr.cur_profile, cr.prev_profile, run.id, compare_to_id, test_id) }}
            </td>
            {{ cr.pct_delta|aspctcell(style=styles['td'],reverse=cr.bigger_is_better)|safe }}
            <td style="{{ styles['td'] }}">{{ "%.4f" | format(cr.previous) }}</td>

Modified: lnt/trunk/lnt/server/ui/templates/v4_run.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_run.html?rev=263938&r1=263937&r2=263938&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_run.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_run.html Mon Mar 21 06:48:27 2016
@@ -350,7 +350,7 @@ $('.profile-prev-only').tooltip();
                 <a href="{{graph_base}}&plot.{{test_id}}={{ machine.id}}.{{test_id}}.{{field.index}}">
                   {{ test_name }}
                 </a>
-                {{ utils.render_profile_link(cr.profile, cr.prev_profile, run.id, compare_to.id, test_id) }}
+                {{ utils.render_profile_link(cr.cur_profile, cr.prev_profile, run.id, compare_to.id, test_id) }}
               </td>
               {{ get_cell_value(cr) }}
             </tr>




More information about the llvm-commits mailing list