[llvm-commits] [LNT] r161847 - in /lnt/trunk/lnt/server/ui: static/v4_global_status.js templates/v4_global_status.html views.py

Michael Gottesman mgottesman at apple.com
Mon Aug 13 21:21:28 PDT 2012


Author: mgottesman
Date: Mon Aug 13 23:21:28 2012
New Revision: 161847

URL: http://llvm.org/viewvc/llvm-project?rev=161847&view=rev
Log:
[LNT] v4_global_status: Added right click context menu for looking up graphs.

Modified:
    lnt/trunk/lnt/server/ui/static/v4_global_status.js
    lnt/trunk/lnt/server/ui/templates/v4_global_status.html
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/ui/static/v4_global_status.js
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/v4_global_status.js?rev=161847&r1=161846&r2=161847&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/static/v4_global_status.js (original)
+++ lnt/trunk/lnt/server/ui/static/v4_global_status.js Mon Aug 13 23:21:28 2012
@@ -50,10 +50,50 @@
         sortrevind.id = "sorttable_sortrevind";
         sortrevind.innerHTML = ' ▾';
         initial_sort_header.appendChild(sortrevind);
+
+        $('.data-cell').contextMenu('contextmenu-datacell', {
+           bindings: {
+               'contextMenu-runpage' : function(elt) {
+                   var new_base = elt.getAttribute('run_id') + '/graph?test.';
+                   
+                   field = getQueryParameterByName('field');
+                   if (field == "")
+                       field = 2; // compile time.
+                   
+                   new_base += elt.getAttribute('test_id') + '=' + field.toString();
+                   window.location = url_replace_basename(window.location.toString(),
+                                                          new_base);
+               }
+           }
+       });
     });
     
     /* Helper Functions */
     
+    function url_replace_basename(url, new_basename) {
+        // Remove query string.
+        var last_question_index = url.lastIndexOf('?');
+        if (last_question_index != -1) 
+            url = url.substring(0, last_question_index);
+        if (url.charAt(url.length-1) == '/') {
+            url = url.substring(0, url.length-1);
+        }
+        
+        var without_base = url.substring(0, url.lastIndexOf('/') + 1);
+        return without_base + new_basename;
+    }
+    
+    function getQueryParameterByName(name) {
+        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
+        var regexS = "[\\?&]" + name + "=([^&#]*)";
+        var regex = new RegExp(regexS);
+        var results = regex.exec(window.location.search);
+        if(results == null)
+            return "";
+        else
+            return decodeURIComponent(results[1].replace(/\+/g, " "));
+    }    
+    
     /* Exported Functions */
     
 })(v4_global_status);

Modified: lnt/trunk/lnt/server/ui/templates/v4_global_status.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_global_status.html?rev=161847&r1=161846&r2=161847&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_global_status.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_global_status.html Mon Aug 13 23:21:28 2012
@@ -54,6 +54,16 @@
 {% endblock %}
 
 {% block body %}
+{# 
+   This div is hidden on load and is there after controlled by the jquery
+   context menu script.
+#}
+<div class="contextMenu" id="contextmenu-datacell">
+  <ul>
+    <li id="contextMenu-runpage">View Graph</li>
+  </ul>
+</div>
+
 <div id="emperor-control">
   <div id="right-king-control" class="control-panel">
     <h3>Current Settings</h3>
@@ -134,13 +144,16 @@
     {% endfor %}
   </tr>
   {% for row in tests %}
+  {% set outer_index = loop.index0 %}
   <tr>
     <td class="row-head">
-      {{ row[0] }}
+      {{ row[0][1] }}
     </td>
     {{ row[1]|aspctcell("data-cell worst-time")|safe }}
-    {% for cr in row[2:] %}
-      {{ cr.pct_delta|aspctcell("data-cell " + machines[loop.index0].get_css_name() + " " + machine_groups_map[machines[loop.index0]])|safe }}
+    {% for cr, run_id in row[2:] %}
+      {{ cr.pct_delta|aspctcell("data-cell " + machines[loop.index0].get_css_name() + " " + machine_groups_map[machines[loop.index0]],
+                                attributes={'test_id': row[0][0], 'run_id': run_id})
+         |safe }}
     {% endfor %}
   </tr>
   {% endfor %}

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161847&r1=161846&r2=161847&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Mon Aug 13 23:21:28 2012
@@ -707,6 +707,8 @@
         # Add in inverse groups.
         groups.extend("not-" + x for x in grouping_set.difference(groups))
         
+        # Join together all groups so we can just add it to a base css
+        # class string.
         machine_groups_map[machine] = ' '.join(groups)
 
     # Get the set all tests reported in the recent runs.
@@ -723,17 +725,17 @@
     test_table = []
     for i,(test_id,test_name) in enumerate(reported_tests):
         # Create the row, starting with the test name and worst entry.
-        row = [test_name, None]
+        row = [(test_id, test_name), None]
 
         # Compute comparison results for each machine.
-        row.extend(runinfo.get_run_comparison_result(run, baseline, test_id,
-                                                     field)
+        row.extend((runinfo.get_run_comparison_result(run, baseline, test_id,
+                                                     field), run.id)
                    for baseline,run in machine_run_info)
 
         # Compute the worst cell value.
         row[1] = max(cr.pct_delta
-                     for cr in row[2:])
-
+                     for cr,_ in row[2:])
+        
         test_table.append(row)
 
     # Order the table by worst regression.





More information about the llvm-commits mailing list