[llvm-commits] [zorg] r125913 - in /zorg/trunk/llvmlab/llvmlab/ui/templates: dashboard.html layout.html

Daniel Dunbar daniel at zuster.org
Fri Feb 18 08:43:25 PST 2011


Author: ddunbar
Date: Fri Feb 18 10:43:25 2011
New Revision: 125913

URL: http://llvm.org/viewvc/llvm-project?rev=125913&view=rev
Log:
llvmlab: Add dashboard support for linking to "phase popups".
 - General mechanism stolen from buildbot's console.

Modified:
    zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html
    zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html

Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html?rev=125913&r1=125912&r2=125913&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/dashboard.html Fri Feb 18 10:43:25 2011
@@ -1,4 +1,44 @@
 {% extends "layout.html" %}
+
+{% macro phase_popup_link(phase, build) %}
+<a href='#'
+   onclick='show_phase_popup("./phase/{{
+            phase.number - 1 }}/{{
+            build.source_stamp }}", event); return false;'
+   title='Phase {{ phase.number }} {{ phase.name }} - {{ build.source_stamp }}'
+   target="_blank">{{ caller() }}</a>
+{% endmacro %}
+
+{% block javascript %}
+// Handler for phase onclick events.
+function show_phase_popup(url, event) {
+    // Get the popup elements.
+    var popup = document.getElementById("phase_popup");
+    var popup_frame = document.getElementById("phase_popup_frame");
+
+    // Load the phase popup into the hidden frame.
+    popup_frame.src = url;
+}
+
+// Handler for page load events inside the hidden iframe we use to load phase
+// popups.
+function popup_frame_loaded(event) {
+    var popup = document.getElementById("phase_popup");
+    var popup_frame = document.getElementById("phase_popup_frame");
+
+    // Get the frame contents and put it in the popup div.
+    var content = popup_frame.contentWindow.document.body.innerHTML;
+    popup.innerHTML = content;
+    popup.style.display = "block";
+}
+
+// On load, set the iframe's onload handler.
+window.onload = function() {
+    var popup_frame = document.getElementById("phase_popup_frame");
+    popup_frame.onload = function(event) { popup_frame_loaded(event); };
+}
+{% endblock %}
+
 {% block title %}dashboard{% endblock %}
 {% block body %}
 
@@ -40,9 +80,7 @@
 </font>
 
 
-<a name="current_status">
-  <h2>Current Status</h2>
-</a>
+<h2>Current Status</h2>
 
 {# The traffic light... #}
 <table>
@@ -60,14 +98,20 @@
 
     {# First, check if we have no status (no completed builds, or prior phase is
        failing). #}
+    <td align="center">
     {% if not phase_info or not phase_info.completed or is_failing %}
-    <td align="center"><img src="/static/white.png" width="45" height="45"></td>
-    {% elif phase_info.completed.result == 0 %}
-    <td align="center"><img src="/static/green.png" width="45" height="45"></td>
+      <img src="/static/white.png" width="45" height="45">
     {% else %}
-    {% set is_failing = true %}
-    <td align="center"><img src="/static/red.png" width="45" height="45"></td>
+      {% call phase_popup_link(phase, phase_info.completed) %}
+      {% if phase_info.completed.result == 0 %}
+      <img src="/static/green.png" width="45" height="45">
+      {% else %}
+      {% set is_failing = true %}
+      <img src="/static/red.png" width="45" height="45">
+      {% endif %}
+      {% endcall %}
     {% endif %}
+    </td>
 
     {% endfor %}
   </tr>
@@ -92,7 +136,11 @@
   {% set phase_info = summary[phase.phase_builder] %}
 
   {% if phase_info.current %}
-  <td>r{{ phase_info.current[0].source_stamp }}</td>
+  <td>
+    {% call phase_popup_link(phase, phase_info.current[0]) %}
+    r{{ phase_info.current[0].source_stamp }}
+    {% endcall %}
+  </td>
   {% else %}
   <td>(idle)</td>
   {% endif %}
@@ -105,7 +153,11 @@
   {% set phase_info = summary[phase.phase_builder] %}
 
   {% if phase_info.completed %}
-  <td>r{{ phase_info.completed.source_stamp }}</td>
+  <td>
+    {% call phase_popup_link(phase, phase_info.completed) %}
+    r{{ phase_info.completed.source_stamp }}
+    {% endcall %}
+  </td>
   {% else %}
   <td>(unknown)</td>
   {% endif %}
@@ -120,7 +172,11 @@
   {% if phase_info.failing and
         (not phase_info.passing or
          phase_info.failing.number > phase_info.passing.number) %}
-  <td>r{{ phase_info.failing.source_stamp }}</td>
+  <td>
+    {% call phase_popup_link(phase, phase_info.failing) %}
+    r{{ phase_info.failing.source_stamp }}
+    {% endcall %}
+  </td>
   {% else %}
   <td></td>
   {% endif %}
@@ -133,7 +189,11 @@
   {% set phase_info = summary[phase.phase_builder] %}
 
   {% if phase_info.passing %}
-  <td>r{{ phase_info.passing.source_stamp }}</td>
+  <td>
+    {% call phase_popup_link(phase, phase_info.passing) %}
+    r{{ phase_info.passing.source_stamp }}
+    {% endcall %}
+  </td>
   {% else %}
   <td>(unknown)</td>
   {% endif %}
@@ -142,4 +202,10 @@
 </tr>
 </table>
 
+{# The div we use to include phase popups. #}
+<div id="phase_popup" style="display: none;"></div>
+{# The iframe we use to load the phase popup source. This is never actually
+   displayed, just used to load the HTML we insert into the popup div. #}
+<iframe id="phase_popup_frame" style="display: none;"></iframe>
+
 {% endblock %}

Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html?rev=125913&r1=125912&r2=125913&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/layout.html Fri Feb 18 10:43:25 2011
@@ -6,6 +6,9 @@
   <title>{{ self.title() }}</title>
   <link rel="stylesheet" type="text/css"{#
         #} href="{{ url_for('.static', filename='style.css') }}">
+  <script type='text/javascript'>
+  {% block javascript %}{% endblock %}
+  </script>
 </head>
 <body>
   <div class="header">
@@ -28,7 +31,7 @@
     <i>Administered by <a href="mailto:{{
                                         config['ADMIN_EMAIL'] }}">{{
       config['ADMIN_NAME'] }} <{{
-      config['ADMIN_EMAIL'] }}></a>
+      config['ADMIN_EMAIL'] }}></a></i>
   </div>
 </body>
 </html>





More information about the llvm-commits mailing list