[llvm-commits] [LNT] r166687 - in /lnt/trunk/lnt/server: db/testsuitedb.py ui/templates/v4_global_status.html ui/views.py

Michael Gottesman mgottesman at apple.com
Thu Oct 25 08:59:41 PDT 2012


Author: mgottesman
Date: Thu Oct 25 10:59:41 2012
New Revision: 166687

URL: http://llvm.org/viewvc/llvm-project?rev=166687&view=rev
Log:
[global_status] Removed .get_css_name() from class Machine.

Modified:
    lnt/trunk/lnt/server/db/testsuitedb.py
    lnt/trunk/lnt/server/ui/templates/v4_global_status.html
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=166687&r1=166686&r2=166687&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Thu Oct 25 10:59:41 2012
@@ -65,7 +65,6 @@
             fields = self.machine_fields
             id = Column("ID", Integer, primary_key=True)
             name = Column("Name", String(256), index=True)
-            _css_name = None
 
             # The parameters blob is used to store any additional information
             # reported by the run but not promoted into the machine record. Such
@@ -99,13 +98,6 @@
             def parameters(self, data):
                 self.parameters_data = json.dumps(sorted(data.items()))
             
-            def get_css_name(self):
-                """ Lazy method which returns a safe css name to
-                    represent this machine."""
-                if self._css_name is None:
-                    self._css_name = self.name.replace('.','-')
-                return self._css_name            
-            
             def get_baseline_run(self, revision=None):
                 """
                 Find the closest order to the requested baseline

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=166687&r1=166686&r2=166687&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_global_status.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_global_status.html Thu Oct 25 10:59:41 2012
@@ -28,10 +28,10 @@
           {# Generate css classes to show/hide groups and machines #}
           
           {% for m in machines %}
-             table.hide-{{ m.get_css_name() }} td.{{ m.get_css_name() }},
-             table.hide-{{ m.get_css_name() }} th.{{ m.get_css_name() }},
-             table.hidenot-{{ m.get_css_name() }} td.not-{{ m.get_css_name() }},
-             table.hidenot-{{ m.get_css_name() }} th.not-{{ m.get_css_name() }} {
+             table.hide-{{ m.css_name }} td.{{ m.css_name }},
+             table.hide-{{ m.css_name }} th.{{ m.css_name }},
+             table.hidenot-{{ m.css_name }} td.not-{{ m.css_name }},
+             table.hidenot-{{ m.css_name }} th.not-{{ m.css_name }} {
                  display: none;
              }
           {% endfor %}
@@ -85,7 +85,7 @@
     <div id="toggle-machine-control-panel">
       <ul>
         {% for m in machines %}
-        <li><input machine="{{ m.name }}" id="checkbox-{{ m.get_css_name() }}" checked="checked" type="checkbox" onclick="v4_global_status.toggle_column_visibility('{{ m.get_css_name() }}');">{{ m.name }}</input></li>
+        <li><input machine="{{ m.name }}" id="checkbox-{{ m.css_name }}" checked="checked" type="checkbox" onclick="v4_global_status.toggle_column_visibility('{{ m.css_name }}');">{{ m.name }}</input></li>
         {% endfor %}
         <li><button onclick="v4_global_status.update_table();">Set Visibility</button><button onclick="v4_global_status.reset_table();">Reset</button></li>
       </ul>
@@ -98,7 +98,7 @@
     <th class="label-header">Test</th>
     <th id="worst-time-header" class="data-header worst-time">Worst Time</th>
     {% for m in machines %}
-    <th class="data-header {{ m.get_css_name() }}">{{ m.name }}</th>
+    <th class="data-header {{ m.css_name }}">{{ m.name }}</th>
     {% endfor %}
   </tr>
   {% for row in tests %}
@@ -109,7 +109,7 @@
     {{ row[1]|aspctcell("data-cell worst-time")|safe }}
     {% for cr, run_id in row[2:] %}
       {% set machine = machines[loop.index0] %}
-      {{ cr.pct_delta|aspctcell("normal-data-cell data-cell " + machine.get_css_name(),
+      {{ cr.pct_delta|aspctcell("normal-data-cell data-cell " + machine.css_name,
                                 attributes={ 'test_id': row[0][0],
                                              'machine_id': machine.id })
          |safe }}

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=166687&r1=166686&r2=166687&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Thu Oct 25 10:59:41 2012
@@ -722,6 +722,16 @@
     # Get a sorted list of recent machines.
     recent_machines = sorted(recent_runs_by_machine.keys(),
                              key=lambda m: m.name)
+    
+    # We use periods in our machine names. css does not like this
+    # since it uses periods to demark classes. Thus we convert periods
+    # in the names of our machines to dashes for use in css. It is
+    # also convenient for our computations in the jinja page to have
+    # access to 
+    def get_machine_keys(m):
+        m.css_name = m.name.replace('.','-')
+        return m    
+    recent_machines = map(get_machine_keys, recent_machines)
 
     # For each machine, build a table of the machine, the baseline run, and the
     # most recent run. We also computed a list of all the runs we are reporting
@@ -771,8 +781,8 @@
         test_table.append(row)
 
     # Order the table by worst regression.
-    test_table.sort(key = lambda row: row[1], reverse=True)
-
+    test_table.sort(key = lambda row: row[1], reverse=True)    
+    
     return render_template("v4_global_status.html",
                            ts=ts,
                            tests=test_table,





More information about the llvm-commits mailing list