[llvm-commits] [zorg] r130217 - in /zorg/trunk/lnt/lnt: db/perfdbsummary.py server/ui/static/popup.js server/ui/templates/simple_machine.html server/ui/views.py
Daniel Dunbar
daniel at zuster.org
Tue Apr 26 10:48:13 PDT 2011
Author: ddunbar
Date: Tue Apr 26 12:48:13 2011
New Revision: 130217
URL: http://llvm.org/viewvc/llvm-project?rev=130217&view=rev
Log:
LNT/Flask: Port simple schema's machine page.
Added:
zorg/trunk/lnt/lnt/server/ui/static/popup.js
zorg/trunk/lnt/lnt/server/ui/templates/simple_machine.html
Modified:
zorg/trunk/lnt/lnt/db/perfdbsummary.py
zorg/trunk/lnt/lnt/server/ui/views.py
Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=130217&r1=130216&r2=130217&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdbsummary.py (original)
+++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Tue Apr 26 12:48:13 2011
@@ -198,6 +198,10 @@
def get_run_order(self, run_id):
return self.order_by_run.get(run_id)
+ def get_runs_on_machine(self, machine_id):
+ return [k for k,v in self.machine_id_by_run.items()
+ if v == machine_id]
+
def get_run_ordered_index(self, run_id):
try:
return self.runs_in_order.index(run_id)
Added: zorg/trunk/lnt/lnt/server/ui/static/popup.js
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/static/popup.js?rev=130217&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/static/popup.js (added)
+++ zorg/trunk/lnt/lnt/server/ui/static/popup.js Tue Apr 26 12:48:13 2011
@@ -0,0 +1,155 @@
+function ShowPop(id)
+{
+ if (document.getElementById)
+ {
+ document.getElementById(id).style.visibility = " visible";
+ }
+ else if (document.all)
+ {
+ document.all[id].style.visibility = " visible";
+ }
+ else if (document.layers)
+ {
+ document.layers[id].style.visibility = " visible";
+ }
+}
+
+
+
+
+
+
+function HidePop(id)
+{
+ if (document.getElementById)
+ {
+ document.getElementById(id).style.visibility = " hidden";
+ }
+ /*else if (document.all)
+ {
+ document.all[id].style.visibility = " hidden";
+ }
+ else if (document.layers)
+ {
+ document.layers[id].style.visibility = " hidden";
+ }*/
+}
+
+
+
+function TogglePop(id)
+{
+ if (document.getElementById)
+ {
+ if(document.getElementById(id).style.visibility == "visible"){
+ document.getElementById(id).style.visibility = "hidden";
+ }
+ else{
+ document.getElementById(id).style.visibility = "visible";
+ }
+ }
+ else if (document.all)
+ {
+ if(document.all[id].style.visibility == "visible"){
+ document.all[id].style.visibility = "hidden";
+ }
+ else{
+ document.all[id].style.visibility = "visible";
+ }
+ }
+ else if (document.layers)
+ {
+ if(document.layers[id].style.visibility == "visible"){
+ document.layers[id].style.visibility = "hidden";
+ }
+ else{
+ document.layers[id].style.visibility = "visible";
+ }
+ }
+}
+
+
+function toggleLayer(whichLayer)
+{
+ if (document.getElementById)
+ {
+ // this is the way the standards work
+ var style2 = document.getElementById(whichLayer).style;
+ style2.display = style2.display? "":"none";
+ var link = document.getElementById(whichLayer+"_").innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.getElementById(whichLayer+"_").innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.getElementById(whichLayer+"_").innerHTML="(+)"+link.substring(3,link.length);
+ }
+ }//end if
+ else if (document.all)
+ {
+ // this is the way old msie versions work
+ var style2 = document.all[whichLayer].style;
+ style2.display = style2.display? "":"none";
+ var link = document.all[wwhichLayer+"_"].innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.all[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.all[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
+ }
+ }
+ else if (document.layers)
+ {
+ // this is the way nn4 works
+ var style2 = document.layers[whichLayer].style;
+ style2.display = style2.display? "":"none";
+ var link = document.layers[whichLayer+"_"].innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.layers[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.layers[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
+ }
+ }
+}//end function
+
+var checkflag="false";
+function check(field) {
+ if (checkflag == "false") {
+ for (i = 0; i < field.length; i++) {
+ field[i].checked = true;
+ }
+ checkflag = "true";
+ return "Uncheck all";
+ }
+ else {
+ for (i = 0; i < field.length; i++) {
+ if(field[i].type == 'checkbox'){
+ field[i].checked = false;
+ }
+ }
+ checkflag = "false";
+ return "Check all";
+ }
+}
+
+function show_hide_column(tableName, columns) {
+ // Let's be clear hear, I have no idea how to write portable
+ // JavaScript. This works in Safari, yo.
+ var event = window.event;
+ var cb = event.target;
+
+ var style = cb.checked ? "table-cell" : "none";
+
+ var tbl = document.getElementById(tableName);
+ var rows = tbl.getElementsByTagName('tr');
+
+ for (var row = 0; row < rows.length; ++row) {
+ var cells = rows[row].getElementsByTagName('td');
+
+ if (cells.length == 0)
+ cells = rows[row].getElementsByTagName('th');
+
+ for (var i = 0; i < columns.length; ++i)
+ cells[columns[i]].style.display = style;
+ }
+}
Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_machine.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_machine.html?rev=130217&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_machine.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_machine.html Tue Apr 26 12:48:13 2011
@@ -0,0 +1,92 @@
+{% macro render_popup_begin(id, title, hidden, depth) -%}
+<p>
+<a href="javascript://" onclick="toggleLayer('{{id}}')"; id="{{id}}_">({{
+ "-" if hidden else "+" }}) {{title}}</a>
+<div id="{{id}}"
+ style="display: {{'none' if hidden else '' }};"
+ class="hideable_{{depth}}">
+{%- endmacro %}
+{% macro render_popup_end() -%}
+</div>
+{%- endmacro %}
+
+{% set db = request.get_db() %}
+{% set machine = db.getMachine(id) %}
+
+{% extends "layout.html" %}
+{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %}
+{% block head %}
+ <script src="{{ url_for('.static', filename='popup.js') }}"></script>
+{% endblock %}
+{% block title %}Machine: {{machine.name}}:{{machine.number}}{% endblock %}
+{% block body %}
+
+<table width="100%%" border=1>
+ <tr>
+ <td valign="top" width="200">
+ <a href="../..">Homepage</a>
+ <h4>Relatives:</h4>
+ <ul>
+
+{# List all machines with this name. #}
+{% for m in db.machines(name=machine.name) %}
+ <li><a href="{{ db_url_for('simple_machine', tag=tag, id=m.id)}}">{{
+ m.name}}:{{m.number}}</a></li>
+{% endfor %}
+ </ul>
+ </td>
+ <td valign="top">
+ <table border=1>
+ <tr>
+ <td> <b>Nickname</b> </td>
+ <td> {{machine.name}} </td>
+ </tr>
+ <tr>
+ <td> <b>Machine ID</b> </td>
+ <td> {{machine.id}} </td>
+ </tr>
+ </table>
+
+
+{{ render_popup_begin('machine_info', 'Machine Info', true, 1) }}
+ <table border=1>
+{% for key,item in machine.info|dictsort %}
+ <tr>
+ <td> <b>{{key}}</b> </td>
+ <td>{{item.value}}</td>
+ </tr>
+{% endfor %}
+ </table>
+{{ render_popup_end() }}
+
+<p>
+<table class="sortable" border=1>
+<thead>
+ <tr>
+ <th>Run Order</th>
+ <th>Start Time</th>
+ <th>End Time</th>
+ <th> </th>
+ </tr>
+</thead>
+{% for order,runs in associated_runs|sort|reverse %}
+{% for run in runs %}
+ <tr>
+{% if loop.first %}
+ <td rowspan="{{ runs|length }}" align=right>{{order}}</td>
+{% endif %}
+ <td>{{ run.start_time }}</td>
+ <td>{{ run.end_time }}s</td>
+ <td><a href="{{db_url_for('simple_run', tag=tag, id=run.id)}}">
+ View Results</a></td>
+ </tr>
+{% endfor %}
+{% endfor %}
+</table>
+
+
+ </td>
+ </tr>
+</table>
+
+{% endblock %}
Modified: zorg/trunk/lnt/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/views.py?rev=130217&r1=130216&r2=130217&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Apr 26 12:48:13 2011
@@ -133,9 +133,25 @@
active_machines=active_machines,
active_submissions=active_submissions)
- at db_route("/simple/<tag>/machines/<id>")
+ at db_route("/simple/<tag>/machines/<int:id>")
def simple_machine(tag, id):
- raise NotImplementedError
+ db = request.get_db()
+
+ # Get the run summary.
+ run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, tag)
+
+ # Compute the list of associated runs, grouped by order.
+ from lnt.viewer import Util
+ grouped_runs = Util.multidict(
+ (run_summary.get_run_order(run_id), run_id)
+ for run_id in run_summary.get_runs_on_machine(id))
+
+ associated_runs = [(order, [db.getRun(run_id)
+ for run_id in runs])
+ for order,runs in grouped_runs.items()]
+
+ return render_template("simple_machine.html", tag=tag, id=id,
+ associated_runs=associated_runs)
@db_route("/simple/<tag>/<id>")
def simple_run(tag, id):
More information about the llvm-commits
mailing list