Changes

Jump to: navigation, search

User:Dominic/tinderbox 03a

11,055 bytes removed, 17:16, 14 December 2007
no edit summary
? tinderbox_3a.diffIndex: defaultStyle.css===================================================================RCS file: defaultStyle.cssdiff -N defaultStyle.css--- /dev/null 1 Jan 1970 00:00:00 -0000+++ defaultStyle.css 14 Dec 2007 20:54:30 -0000@@ -0,0 +1,17 @@+body {+ font-family: Verdana, Sans-Serif;+ text-align: center;+}++#tindertable tr th {+ background-color: #AAA;+}++#tindertable tr td {+ vertical-align: top;++}+/* needed because regular background-color overwrites tinderbox colors! */+.bgcolor {+ background-color: #EEE;+}Index: index.html===================================================================RCS file: /cvsroot/mozilla/webtools/tinderbox/index.html,vretrieving revision 1.2diff -u -8 -p -r1.2 index.html--- index.html 31 Jan 2002 04:22:39 -0000 1.2+++ index.html 14 Dec 2007 20:54:30 -0000@@ -1,12 +1,16 @@-<TITLE>tinderbox</TITLE>-<META HTTP-EQUIV="Refresh" CONTENT="0; URL=showbuilds.cgi">-<BODY BGCOLOR="#FFFFFF" TEXT="#000000"- LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">-<CENTER>-<TABLE BORDER=0 WIDTH="100%" HEIGHT="100%"><TR><TD ALIGN=CENTER VALIGN=CENTER>-<FONT SIZE="+2">-You're probably looking for -<A HREF="showbuilds.cgi">showbuilds.cgi</A>.-</FONT>-</TD></TR></TABLE>-</CENTER>+<html>+ <script src="panelLoad.js"></script>+ <link rel="stylesheet" type="text/css" href="defaultStyle.css" />+ <h1>Tinderbox</h1>+ <p>This page refreshes every 5 minutes</p>+ <p><a href="showbuilds.cgi">For showbuilds.cgi click here</a></p>+ <body onload="init();">++ <div id="quicklinks">+ </div>+ + <div id="tindertable">+ </div>+ </body>+</html>+Index: panelLoad.js===================================================================RCS file: panelLoad.jsdiff -N panelLoad.js--- /dev/null 1 Jan 1970 00:00:00 -0000+++ panelLoad.js 14 Dec 2007 20:54:30 -0000@@ -0,0 +1,73 @@+ /*extern ActiveXObject, XMLHttpRequest, document, window */+ var last_modified = new Date(0);+ + function init() {+ loadAllTreeData();+ }++ function loadAllTreeData() {+ var url = 'showbuilds.cgi?tree_list_json=1';+ var req;+ + + if (window.XMLHttpRequest) {+ req = new XMLHttpRequest();+ } else if (window.ActiveXObject) {+ req = new ActiveXObject("Microsoft.XMLHTTP");+ }+ + req.open('GET', url, true);+ req.setRequestHeader('If-Modified-Since', last_modified);+ req.onreadystatechange = function() {+ var jsonDat;+ if (req.readyState != 4) {+ return;+ }+ if (req.status == 200) {+ last_modified = req.getResponseHeader('Last-Modified');+ try {+ jsonDat = eval("(" + req.responseText.substring(0, req.responseText.length-2) + ")");+ + // alert(req.responseText);+ + var quicklinks = "";+ var tindertable = "<table border='0'><tr><th>Desc.</th><th colspan='3'>Common Trees (Excluding l10n trees)</th></tr>";+ + for(var tree in jsonDat) {+ //alert("tree : " + tree);+ quicklinks += "<a href='#" + tree + "'>" + tree + "</a> - ";+ tindertable += "<tr><td class='bgcolor'><a name='" + tree + "'>" + tree + "</a></td>";+ for(var build in jsonDat[tree]) {+ //alert("build : " + build);+ for(var bldr in jsonDat[tree][build]) {+ tindertable += "<td class='bgcolor'>" + bldr + "<br/>";+ //alert("bldr : " + bldr);+ for(var property in jsonDat[tree][build][bldr]) {+ tindertable += "&nbsp;&nbsp;&nbsp; " +property + " : " + jsonDat[tree][build][bldr][property] + "<br/>";+ }+ tindertable += "</td>";+ }+ tindertable += "</th>";+ }+ }+ tindertable += "</table>";+ + document.getElementById("quicklinks").innerHTML = quicklinks;+ document.getElementById("tindertable").innerHTML = tindertable;++ + } catch(e) {+ alert("could not parse JSON data:" + e);+ }+ } else if (req.status == 304) {+ return;+ } else {+ div.innerHTML = "Error code " + req.status + " loading " + url;+ }+ }++ req.send(null);+ return;+ }++ setInterval('init()', 300000); // 5 minute refresh cycleIndex: showbuilds.cgi===================================================================RCS file: /cvsroot/mozilla/webtools/tinderbox/showbuilds.cgi,vretrieving revision 1.197diff -u -8 -p -r1.197 showbuilds.cgi--- showbuilds.cgi 12 Jul 2007 23:06:23 -0000 1.197+++ showbuilds.cgi 14 Dec 2007 20:54:30 -0000@@ -16,27 +16,33 @@ # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): use strict;-use lib "@TINDERBOX_DIR@";+use lib "/var/www/tinderbox"; require 'tbglobals.pl'; require 'imagelog.pl'; require 'showbuilds.pl'; umask 002; # Process the form arguments my %form = &split_cgi_args(); -&show_tree_selector(\%form), exit if $form{tree} eq '';+if ($form{tree_list_json}) {+ &show_tree_list_json(\%form); + exit;+} elsif ($form{tree} eq '') {+ &show_tree_selector(\%form);+ exit;+}; my $mode_count=0; foreach my $mode ('quickparse', 'express', 'rdf', 'flash', 'static', 'panel', 'hdml', 'vxml', 'wml', 'json') { $mode_count++ if defined($form{$mode}); } if ($mode_count > 1) {Index: showbuilds.pl===================================================================RCS file: /cvsroot/mozilla/webtools/tinderbox/showbuilds.pl,vretrieving revision 1.31diff -u -8 -p -r1.31 showbuilds.pl--- showbuilds.pl 13 Sep 2007 23:20:47 -0000 1.31+++ showbuilds.pl 14 Dec 2007 20:54:31 -0000@@ -15,17 +15,16 @@ # The Initial Developer of the Original Code is Netscape Communications # Corporation. Portions created by Netscape are # Copyright (C) 1998 Netscape Communications Corporation. All # Rights Reserved. # # Contributor(s): use strict;-use Data::Dumper; require 'header.pl'; my %colormap = ( null => 'a5a5a5', success => '11DD11', busted => 'EE0000', building => 'EEFF00', testfailed => 'FFAA00'@@ -125,26 +124,17 @@ sub do_tinderbox($) { ## sub do_json($) { my ($form_ref) = (@_); my $tinderbox_data = tb_load_data($form_ref); if (!$form_ref->{static}) { print "Content-type: text/javascript\n"; print "Content-Access-Control: allow <*>\n\n"; }- print "tinderbox_data";- $Data::Dumper::Indent = 0;- my $line = Dumper($tinderbox_data);- $line =~ s/=>/:/g;- $line =~ s/\$VAR1//g;- $line =~ s/undef/'undef'/g;- $line =~ s/\n//g;- $line =~ s/\r//g;- $line =~ s/: ,/: '',/g;- print "$line\n";+ dump_json($tinderbox_data); } sub print_page_head($$) { my ($form_ref, $td) = (@_); my $tree = $form_ref->{tree}; print "Content-type: text/html\n\n<HTML>\n" unless $form_ref->{static}; use POSIX qw(strftime);Index: tbglobals.pl===================================================================RCS file: /cvsroot/mozilla/webtools/tinderbox/tbglobals.pl,vretrieving revision 1.63diff -u -8 -p -r1.63 tbglobals.pl--- tbglobals.pl 29 Aug 2007 08:06:18 -0000 1.63+++ tbglobals.pl 14 Dec 2007 20:54:31 -0000@@ -21,16 +21,17 @@ use strict; # Reading the log backwards saves time when we only want the tail. use Backwards; use Digest::MD5 qw(md5_hex); use Tie::IxHash; use FileHandle; use Fcntl qw(:DEFAULT :flock);+use Data::Dumper; require 'header.pl'; # # Global variabls and functions for tinderbox # #@@ -49,17 +50,17 @@ $::CI_LINES_ADDED=9; $::CI_LINES_REMOVED=10; $::CI_LOG=11; # # Global variables # # Variables set from Makefile-$::default_cvsroot = "@CVSROOT@";+$::default_cvsroot = "/cvsroot"; $::data_dir='data'; @::global_tree_list = (); undef @::global_tree_list; %::global_treedata = undef; # Always set nowdate to the current time.@@ -170,16 +171,74 @@ sub show_tree_selector { print " <TABLE><TR><TD><UL>\n"; foreach (@list) { print "<LI><a href=admintree.cgi?tree=$_>$_</a>\n"; } print "</UL></TD></TR></TABLE></TD></TR></TABLE>"; } +##+# Return list of trees as JSON+##++sub show_tree_list_json($) {+ print "Content-type: text/javascript\n";+ print "Content-Access-Control: allow <*>\n\n";++ my @requestedtreelist = &make_tree_list();++ my %all_tree_data = ();+ foreach my $tt (@requestedtreelist) {+ next unless grep {$tt eq $_} @requestedtreelist;+ tb_load_treedata($tt);+ my %tree_data = ();+ if (&is_tree_state_available($tt)) {+ my $tree_state = &is_tree_open($tt) ? 'open' : 'closed';+ my $bonsai_tree = $::global_treedata->{$tt}->{bonsai_tree};+ $tree_data{'tree_state'} = $tree_state;+ $tree_data{'bonsai_tree'} = $bonsai_tree;+ }++ my (%quickdata);+ #tb_loadquickparseinfo($tt, $::nowdate, \%quickdata);+ open(QP, "< $tt/quickparse.txt");+ my @quickparse = <QP>;+ close(QP);+ foreach my $line (@quickparse) {+ my ($type, $tree, $name, $status, $starttime, $binaryurl) =+ split('\|', $line);+ next unless ($type eq 'Build');+ $all_tree_data{$tt}->{'builders'}->{$name} = {+ status => $status,+ starttime => $starttime,+ binaryurl => $binaryurl,+ };+ }+ }+ print "tinderbox_data = ";+ dump_json(\%all_tree_data);+ +# print Dumper(%all_tree_data);+}++sub dump_json {+ my ($data) = @_;+ $Data::Dumper::Indent = 0;+ my $line = Dumper($data);+ $line =~ s/=>/:/g;+ $line =~ s/\$VAR1//g;+ $line =~ s/^ = //g;+ $line =~ s/undef/'undef'/g;+ $line =~ s/\n//g;+ $line =~ s/\r//g;+ $line =~ s/: ,/: '',/g;+ print "$line\n";+}+ sub lock_datafile { my ($file) = @_; my $lock_fh = new FileHandle ">>$file" or die "Couldn't open semaphore file, $file: $!"; # Get an exclusive lock with a non-blocking request unless (flock($lock_fh, LOCK_EX|LOCK_NB)) {
1
edit

Navigation menu