summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/extensions/buildbot/buildbot.html
blob: ee21e7d7af2bdbe14e51ddeda8bfeedd338aa987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<script>

var botRoot = "http://build.chromium.org/buildbot/waterfall";

var botUrl = botRoot + "/horizontal_one_box_per_builder";

function updateStatus(status) {
  var div = document.getElementById("status");
  div.title = status;
  var open = /open/i;
  if (open.exec(status)) {
    div.innerHTML = "tree: &nbsp;open&nbsp;";
    div.className = "open";
  } else {
    div.innerHTML = "tree: closed";
    div.className = "closed";
  }
}

function requestStatus() {
  var bots = document.getElementById("bots");
  if (bots) {
    // TODO(erikkay): this generates "Unsafe JavaScript attempt to access frame
    // with URL"
    bots.src = botUrl + "?xxx=" + (new Date()).getTime();
  }
  var xhr = new XMLHttpRequest();
  try {
    xhr.onreadystatechange = function(state) {
      if (xhr.readyState == 4) {
        var text = xhr.responseText;
        var re = /"Notice"[^>]*>([^<\n]+)</g;
        var results = re.exec(text);
        if (results && results.index >= 0) {
          updateStatus(results[1]);
        } else {
          console.log("Error: couldn't find node");
        }
      }
    }
    
    xhr.onerror = function(error) {
      console.log("xhr error: " + error);
    }

    xhr.open("GET", "http://chromium-status.appspot.com/current");
    xhr.send({});
  } catch(e) {
    console.log("exception: " + e);
  }
  setTimeout(requestStatus, 30000);
}

function statusClick() {
  window.open(botRoot);
}

requestStatus();
</script>
<style>
#main {
  /* TODO(erikkay) this shouldn't be necessary, see extensions_toolstrip.css */
  white-space: nowrap;
  padding-top: 0px;
  height: 100%;
}

.open {
  color: green;
}

.closed {
  color: red;
}

.button {
  padding: 2px 5px;
  height: 20px;
  float: left;
  display: table;
}

.button:hover {
  padding: 0px 4px;
  border: 1px solid silver;
  -webkit-border-radius: 5px;
  background-color: rgb(237, 244, 252);
  cursor: pointer;
}

#bots {
  border: 1px solid rgb(237, 244, 252);
  height: 20px;  /* hardcoded height sucks */
  width: 435px;  /* hardcoded width sucks */
  background-color: transparent;
}

#status {
  display: table-cell;
  vertical-align: middle;
}

</style>

<div id="main">
<div class="button" onclick="statusClick();">
<div id="status" class="open">
tree: open?
</div>
</div>
<iframe scrolling='no' id='bots' src="http://build.chromium.org/buildbot/waterfall/horizontal_one_box_per_builder"></iframe>
</div>