Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 <script> | 1 <script> | 
| 2 var botRoot = "http://build.chromium.org/buildbot/waterfall"; | 2 var botRoot = "http://build.chromium.org/buildbot/waterfall"; | 
| 3 var botUrl = botRoot + "/horizontal_one_box_per_builder"; | 3 //var botRoot = "http://hae14.jail:8016"; | 
| 
 
Aaron Boodman
2009/05/15 00:15:17
Can you remove this internal URL?
 
 | |
| 4 var statusURL = "http://chromium-status.appspot.com/current"; | |
| 5 //var waterfallURL = botRoot + "/console_json?name=erikkay@chromium.org&json=1"; | |
| 6 var waterfallURL = botRoot + "/console_json?json=1"; | |
| 7 var botList; | |
| 8 var checkinResults; | |
| 4 | 9 | 
| 5 function updateStatus(status) { | 10 function updateStatus(text) { | 
| 11 var results = (new RegExp('"Notice".*>(.*)<', 'g')).exec(text); | |
| 12 if (!results || results.index < 0) { | |
| 13 console.log("Error: couldn't find status div"); | |
| 14 console.log(text); | |
| 15 return; | |
| 16 } | |
| 17 var status = results[1]; | |
| 6 var div = document.getElementById("status"); | 18 var div = document.getElementById("status"); | 
| 7 div.title = status; | 19 div.title = status; | 
| 8 var open = /open/i; | 20 var open = /open/i; | 
| 9 if (open.exec(status)) { | 21 if (open.exec(status)) { | 
| 10 div.innerHTML = "tree:  open "; | 22 div.innerHTML = "tree:  open "; | 
| 11 div.className = "open"; | 23 div.className = "open"; | 
| 12 } else { | 24 } else { | 
| 13 div.innerHTML = "tree: closed"; | 25 div.innerHTML = "tree: closed"; | 
| 14 div.className = "closed"; | 26 div.className = "closed"; | 
| 15 } | 27 } | 
| 16 } | 28 } | 
| 17 | 29 | 
| 30 function updateBots(text) { | |
| 31 var results = (new RegExp('(.*)<\/body>', 'g')).exec(text); | |
| 32 if (!results || results.index < 0) { | |
| 33 console.log("Error: couldn't find bot JSON"); | |
| 34 console.log(text); | |
| 35 return; | |
| 36 } | |
| 37 var data; | |
| 38 if (JSON) { | |
| 39 try { | |
| 40 data = JSON.parse(results[1]); | |
| 41 } catch (e) { | |
| 42 console.dir(e); | |
| 43 console.log(text); | |
| 44 return; | |
| 45 } | |
| 46 } else { | |
| 47 eval("var data = " + results[1]); | |
| 48 } | |
| 49 if (!data) { | |
| 50 console.log("Error: JSON parse fail"); | |
| 51 console.log(results[1]); | |
| 52 return; | |
| 53 } | |
| 54 botList = data[0]; | |
| 55 checkinResults = data[1]; | |
| 56 console.dir(botList); | |
| 57 displayBots(); | |
| 58 } | |
| 59 | |
| 60 function showBot(botIndex) { | |
| 61 var bot = botList[botIndex]; | |
| 62 var url = botRoot + "/waterfall?builder=" + bot.name; | |
| 63 //var url = botRoot + "/builders/" + bot.name; | |
| 64 //var url = botRoot + "/" + bot.url; | |
| 65 window.open(url); | |
| 66 window.event.stopPropagation(); | |
| 67 } | |
| 68 | |
| 69 function displayBots() { | |
| 70 if (!botList) { | |
| 71 console.log("botList is null"); | |
| 72 return; | |
| 73 } | |
| 74 var bots = document.getElementById("bots"); | |
| 75 var html = ""; | |
| 76 if (bots.className == "visible") { | |
| 77 botList.forEach(function(bot, i) { | |
| 78 html += "<div class='bot " + bot.color + | |
| 79 "' onclick='showBot(" + i + ")' " + | |
| 80 "title='" + bot.title + "'></div>"; | |
| 81 }); | |
| 82 } | |
| 83 bots.innerHTML = html; | |
| 84 } | |
| 85 | |
| 18 function requestStatus() { | 86 function requestStatus() { | 
| 87 requestURL(statusURL, updateStatus); | |
| 88 requestURL(waterfallURL, updateBots); | |
| 89 setTimeout(requestStatus, 30000); | |
| 90 } | |
| 91 | |
| 92 function requestURL(url, callback) { | |
| 19 var xhr = new XMLHttpRequest(); | 93 var xhr = new XMLHttpRequest(); | 
| 20 try { | 94 try { | 
| 21 xhr.onreadystatechange = function(state) { | 95 xhr.onreadystatechange = function(state) { | 
| 22 if (xhr.readyState == 4) { | 96 if (xhr.readyState == 4) { | 
| 23 var text = xhr.responseText; | 97 var text = xhr.responseText; | 
| 24 var re = /"Notice"[^>]*>([^<\n]+)</g; | 98 callback(text); | 
| 25 var results = re.exec(text); | |
| 26 if (results && results.index >= 0) { | |
| 27 updateStatus(results[1]); | |
| 28 } else { | |
| 29 console.log("Error: couldn't find node"); | |
| 30 } | |
| 31 } | 99 } | 
| 32 } | 100 } | 
| 33 | 101 | 
| 34 xhr.onerror = function(error) { | 102 xhr.onerror = function(error) { | 
| 35 console.log("xhr error: " + error); | 103 console.log("xhr error: " + error); | 
| 36 } | 104 } | 
| 37 | 105 | 
| 38 xhr.open("GET", "http://chromium-status.appspot.com/current"); | 106 xhr.open("GET", url); | 
| 39 xhr.send({}); | 107 xhr.send({}); | 
| 40 } catch(e) { | 108 } catch(e) { | 
| 41 console.log("exception: " + e); | 109 console.log("exception: " + e); | 
| 42 } | 110 } | 
| 43 setTimeout(requestStatus, 30000); | |
| 44 } | 111 } | 
| 45 | 112 | 
| 46 var hoverTimerId = null; | 113 var hoverTimerId = null; | 
| 47 var hideTimerId = null; | 114 var hideTimerId = null; | 
| 48 | 115 | 
| 49 window.addEventListener("mouseover", function(e) { | 116 window.addEventListener("mouseover", function(e) { | 
| 50 if (hideTimerId) { | 117 if (hideTimerId) { | 
| 51 hideTimerId = window.clearTimeout(hideTimerId); | 118 hideTimerId = window.clearTimeout(hideTimerId); | 
| 52 } | 119 } | 
| 53 | 120 | 
| 54 if (bots.className != "visible" && !hoverTimerId) { | 121 if (bots.className != "visible" && !hoverTimerId) { | 
| 55 hoverTimerId = window.setTimeout(function() { | 122 hoverTimerId = window.setTimeout(function() { | 
| 56 hoverTimerId = null; | 123 hoverTimerId = null; | 
| 57 var bots = document.getElementById("bots"); | 124 var bots = document.getElementById("bots"); | 
| 58 bots.className = "visible"; | 125 bots.className = "visible"; | 
| 59 // TODO(erikkay): this generates "Unsafe JavaScript attempt to access | 126 displayBots(); | 
| 60 // frame with URL". | |
| 61 bots.src = botUrl + "?xxx=" + (new Date()).getTime(); | |
| 62 }, 1000); | 127 }, 1000); | 
| 63 } | 128 } | 
| 64 }, false); | 129 }, false); | 
| 65 | 130 | 
| 66 window.addEventListener("mouseout", function(e) { | 131 window.addEventListener("mouseout", function(e) { | 
| 67 if (hoverTimerId) { | 132 if (hoverTimerId) { | 
| 68 hoverTimerId = window.clearTimeout(hoverTimerId); | 133 hoverTimerId = window.clearTimeout(hoverTimerId); | 
| 69 } | 134 } | 
| 70 | 135 | 
| 71 if (bots.className != "" && !hideTimerId) { | 136 if (bots.className != "" && !hideTimerId) { | 
| 72 hideTimerId = window.setTimeout(function() { | 137 hideTimerId = window.setTimeout(function() { | 
| 73 hideTimerId = null; | 138 hideTimerId = null; | 
| 74 var bots = document.getElementById("bots"); | 139 var bots = document.getElementById("bots"); | 
| 75 bots.className = ""; | 140 bots.className = ""; | 
| 141 //displayBots(); | |
| 76 }, 1000); | 142 }, 1000); | 
| 77 } | 143 } | 
| 78 }, false); | 144 }, false); | 
| 79 | 145 | 
| 80 window.addEventListener("click", function() { | 146 window.addEventListener("click", function() { | 
| 81 window.open(botRoot); | 147 window.open(botRoot); | 
| 82 }, false); | 148 }, false); | 
| 83 | 149 | 
| 84 requestStatus(); | 150 requestStatus(); | 
| 85 </script> | 151 </script> | 
| 86 | 152 | 
| 87 <style> | 153 <style> | 
| 88 #status { | 154 #status { | 
| 89 font-weight:bold; | 155 font-weight:bold; | 
| 90 } | 156 } | 
| 91 | 157 | 
| 158 #change { | |
| 159 font-weight:bold; | |
| 160 } | |
| 161 | |
| 92 .open { | 162 .open { | 
| 93 color: green; | 163 color: green; | 
| 94 } | 164 } | 
| 95 | 165 | 
| 96 .closed { | 166 .closed { | 
| 97 color: red; | 167 color: red; | 
| 98 } | 168 } | 
| 99 | 169 | 
| 100 #bots { | 170 #bots { | 
| 101 border: none; | 171 border: none; | 
| 102 height: 15px; | 172 height: 100%; | 
| 103 width: 0; | 173 width: 0; | 
| 104 -webkit-transition: width .2s linear; | 174 -webkit-transition: width .2s linear; | 
| 105 background-color: transparent; | 175 background-color: transparent; | 
| 106 display:-webkit-box; | 176 display:-webkit-box; | 
| 107 margin-left:-5px; | 177 -webkit-box-align:center; /* center content vertically */ | 
| 178 overflow: hidden; | |
| 179 padding-left: 2px; | |
| 108 } | 180 } | 
| 109 | 181 | 
| 110 #bots.visible { | 182 #bots.visible { | 
| 111 width: 435px; /* hardcoded width sucks */ | 183 width: 612px; /* hardcoded width sucks */ | 
| 112 } | 184 } | 
| 113 | 185 | 
| 114 #frame-wrapper { | 186 .bot { | 
| 115 /* This is used to get us to vertically center the iframe in the vertical | 187 margin-right: 1px; | 
| 116 space. */ | 188 line-height: 100%; | 
| 117 -webkit-box-align:center; | 189 cursor: pointer; | 
| 118 /* Also, scooch the frame in a bit, under the button, because the content of | 190 -webkit-border-radius: 2px; | 
| 119 the frame has some extra built-in left padding. */ | |
| 120 display:-webkit-box; | 191 display:-webkit-box; | 
| 192 width: 10px; | |
| 193 height: 15px; | |
| 194 } | |
| 195 | |
| 196 .running { | |
| 197 background-color: rgb(255, 252, 108); | |
| 198 border: 1px solid rgb(197, 197, 109); | |
| 199 } | |
| 200 | |
| 201 .notstarted { | |
| 202 /* background-color: white; */ | |
| 203 border: 1px solid rgb(170, 170, 170); | |
| 204 } | |
| 205 | |
| 206 .failure { | |
| 207 background-color: rgb(233, 128, 128); | |
| 208 border: 1px solid rgb(167, 114, 114); | |
| 209 } | |
| 210 | |
| 211 .warnings { | |
| 212 background-color: rgb(255, 195, 67); | |
| 213 border: 1px solid rgb(194, 157, 70); | |
| 214 } | |
| 215 | |
| 216 .success { | |
| 217 background-color: rgb(143, 223, 95); | |
| 218 border: 1px solid rgb(79, 133, 48); | |
| 219 } | |
| 220 | |
| 221 .exception { | |
| 222 background-color: rgb(224, 176, 255); | |
| 223 border: 1px solid rgb(172, 160, 179); | |
| 121 } | 224 } | 
| 122 | 225 | 
| 123 </style> | 226 </style> | 
| 124 | 227 | 
| 125 <div class="toolstrip-button"> | 228 <div class="toolstrip-button"> | 
| 126 <span id="status" class="open">tree: open?</span> | 229 <span id="status" class="open">tree: open?</span> | 
| 127 <div id="frame-wrapper"> | |
| 128 <iframe scrolling="no" id="bots"></iframe> | |
| 129 </div> | 230 </div> | 
| 231 <div id="bots"> | |
| 130 </div> | 232 </div> | 
| 233 <div class="toolstrip-button"> | |
| 234 <span id="console" class="unknown">change: (none)</span> | |
| 
 
Aaron Boodman
2009/05/15 00:15:17
Can we just remove this bit for now if it doesn't
 
 | |
| 235 </div> | |
| OLD | NEW |