| OLD | NEW |
| (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 configuration = config.builders[builderName]; | |
| 37 if (configuration) { | |
| 38 if (configuration.version) | |
| 39 this._addSpan('version', configuration.version); | |
| 40 if (configuration.is64bit) | |
| 41 this._addSpan('architecture', '64-bit'); | |
| 42 this._configuration = configuration; | |
| 43 } else | |
| 44 this._addSpan('version', builderName); | |
| 45 | |
| 46 this.className = 'failing-builder'; | |
| 47 this.href = ui.displayURLForBuilder(builderName); | |
| 48 ui.setTargetForLink(this); | |
| 49 if (failures) | |
| 50 this._addSpan('failures', ' ' + failures.join(', ')); | |
| 51 }, | |
| 52 _addSpan: function(className, text) | |
| 53 { | |
| 54 var span = this.appendChild(document.createElement('span')); | |
| 55 span.className = className; | |
| 56 span.textContent = text; | |
| 57 }, | |
| 58 equals: function(configuration) | |
| 59 { | |
| 60 return this._configuration && this._configuration.is64bit == configurati
on.is64bit && this._configuration.version == configuration.version; | |
| 61 } | |
| 62 }); | |
| 63 | |
| 64 function cellContainsConfiguration(cell, configuration) | |
| 65 { | |
| 66 return Array.prototype.some.call(cell.children, function(configurationElemen
t) { | |
| 67 return configurationElement.equals && configurationElement.equals(config
uration); | |
| 68 }); | |
| 69 } | |
| 70 | |
| 71 function cellByBuildType(row, configuration) | |
| 72 { | |
| 73 return row.cells[configuration.debug ? 2 : 1]; | |
| 74 } | |
| 75 | |
| 76 ui.failures.FailureGrid = base.extends('table', { | |
| 77 init: function() | |
| 78 { | |
| 79 this.className = 'failures'; | |
| 80 var titles = this.createTHead().insertRow(); | |
| 81 titles.insertCell().textContent = 'type'; | |
| 82 titles.insertCell().textContent = 'release'; | |
| 83 titles.insertCell().textContent = 'debug'; | |
| 84 this._body = this.appendChild(document.createElement('tbody')); | |
| 85 this._reset(); | |
| 86 }, | |
| 87 _rowByResult: function(result) | |
| 88 { | |
| 89 var row = this._resultRows[result]; | |
| 90 if (row) { | |
| 91 row.style.display = ''; | |
| 92 return row; | |
| 93 } | |
| 94 | |
| 95 row = this._resultRows[result] = this._body.insertRow(0); | |
| 96 row.className = result; | |
| 97 var titleCell = row.insertCell(); | |
| 98 titleCell.appendChild(document.createElement('span')).textContent = resu
lt; | |
| 99 row.insertCell(); | |
| 100 row.insertCell(); | |
| 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.builders[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.innerHTML = ''; | |
| 131 // Add the BUILDING row eagerly so that it appears last. | |
| 132 this._rowByResult(kBuildingResult).style.display = 'none'; | |
| 133 } | |
| 134 }); | |
| 135 | |
| 136 })(); | |
| OLD | NEW |