Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js

Issue 13712005: Move GardeningServer out of BuildSlaveSupport (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 var ui = ui || {};
27 ui.failures = ui.failures || {};
28
29 (function(){
30
31 var kBuildingResult = 'BUILDING';
32
33 ui.failures.Builder = base.extends('a', {
34 init: function(builderName, failures)
35 {
36 var platformBuilders = config.currentBuilders();
37 var configuration = platformBuilders[builderName];
38 if (configuration) {
39 if (configuration.version)
40 this._addSpan('version', configuration.version);
41 if (configuration.is64bit)
42 this._addSpan('architecture', '64-bit');
43 this._configuration = configuration;
44 } else
45 this._addSpan('version', builderName);
46
47 this.className = 'failing-builder';
48 this.target = '_blank';
49 this.href = ui.displayURLForBuilder(builderName);
50 if (failures)
51 this._addSpan('failures', ' ' + failures.join(', '));
52 },
53 _addSpan: function(className, text)
54 {
55 var span = this.appendChild(document.createElement('span'));
56 span.className = className;
57 span.textContent = text;
58 },
59 equals: function(configuration)
60 {
61 return this._configuration && this._configuration.is64bit == configurati on.is64bit && this._configuration.version == configuration.version;
62 }
63 });
64
65 function cellContainsConfiguration(cell, configuration)
66 {
67 return Array.prototype.some.call(cell.children, function(configurationElemen t) {
68 return configurationElement.equals && configurationElement.equals(config uration);
69 });
70 }
71
72 function cellByBuildType(row, configuration)
73 {
74 return row.cells[configuration.debug ? 2 : 1];
75 }
76
77 ui.failures.FailureGrid = base.extends('table', {
78 init: function()
79 {
80 this.className = 'failures';
81 var titles = this.createTHead().insertRow();
82 titles.insertCell().textContent = 'debug';
83 titles.insertCell().textContent = 'release';
84 titles.insertCell().textContent = 'type';
85 this._body = this.appendChild(document.createElement('tbody'));
86 this._reset();
87 },
88 _rowByResult: function(result)
89 {
90 var row = this._resultRows[result];
91 $(row).show();
92 if (row)
93 return row;
94
95 row = this._resultRows[result] = this._body.insertRow(0);
96 row.className = result;
97 row.insertCell();
98 row.insertCell();
99 var titleCell = row.insertCell();
100 titleCell.appendChild(document.createElement('span')).textContent = resu lt;
101 return row;
102 },
103 update: function(resultsByBuilder)
104 {
105 if (this._pendingReset)
106 this._reset();
107
108 if (!resultsByBuilder)
109 return;
110
111 Object.keys(resultsByBuilder).forEach(function(builderName) {
112 var configuration = config.kPlatforms[config.currentPlatform].builde rs[builderName];
113 if (!configuration)
114 throw "Unknown builder name: " + builderName;
115 var row = this._rowByResult(resultsByBuilder[builderName].actual);
116 var cell = cellByBuildType(row, configuration);
117 if (cellContainsConfiguration(cell, configuration))
118 return;
119 cell.appendChild(new ui.failures.Builder(builderName));
120 }, this);
121 },
122 purge: function()
123 {
124 this._pendingReset = true;
125 },
126 _reset: function()
127 {
128 this._pendingReset = false;
129 this._resultRows = {};
130 $(this._body).empty();
131 // Add the BUILDING row eagerly so that it appears last.
132 this._rowByResult(kBuildingResult);
133 $(this._resultRows[kBuildingResult]).hide();
134 }
135 });
136
137 ui.failures.ListItem = base.extends('li', {
138 init: function(groupName, failingTestsList)
139 {
140 this._failingTestsList = failingTestsList;
141 this.appendChild(new ui.actions.List([
142 new ui.actions.Examine().makeDefault(),
143 ]));
144 var label = this.appendChild(document.createElement('label'))
145 label.textContent = failingTestsList.length == 1 ? failingTestsList[0] : groupName;
146 },
147 });
148
149 ui.failures.List = base.extends('ul', {
150 init: function()
151 {
152 this.className = 'failures';
153 this.textContent = 'Loading...';
154 }
155 });
156
157 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698