2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
30 ui.displayURLForBuilder = function(builderName)
32 return 'http://build.chromium.org/p/chromium.webkit/waterfall?' + $.param({
33 'builder': builderName
37 ui.displayNameForBuilder = function(builderName)
39 return builderName.replace(/Webkit /, '');
42 ui.urlForTest = function(testName)
44 return 'http://trac.webkit.org/browser/trunk/LayoutTests/' + testName;
47 ui.rolloutReasonForTestNameList = function(testNameList)
49 return 'Broke:\n' + testNameList.map(function(testName) {
50 return '* ' + testName;
54 ui.onebar = base.extends('div', {
60 '<li><a href="#summary">Summary</a></li>' +
61 '<li><a href="#results">Results</a></li>' +
62 '<li><a href="#commits">Commits</a></li>' +
63 '<li><a href="#failures">Failures</a></li>' +
65 '<div id="summary"></div>' +
66 '<div id="results"></div>' +
67 '<div id="commits">Coming soon...</div>' +
68 '<div id="failures"></div>';
75 this._tabs = $(this).tabs({
81 document.body.insertBefore(this, document.body.firstChild);
83 tabNamed: function(tabName)
85 return $('#' + tabName, this)[0];
89 return this.tabNamed('summary');
93 return this.tabNamed('results');
97 return this.tabNamed('failures');
99 select: function(tabName)
101 var tabIndex = this._tabNames.indexOf(tabName);
102 this._tabs.tabs('enable', tabIndex);
103 this._tabs.tabs('select', tabIndex);
107 // FIXME: Loading a module shouldn't set off a timer. The controller should kick this off.
108 setInterval(function() {
109 Array.prototype.forEach.call(document.querySelectorAll("time.relative"), function(time) {
110 time.update && time.update();
112 }, config.kRelativeTimeUpdateFrequency);
114 ui.RelativeTime = base.extends('time', {
117 this.setDate(new Date());
118 this.className = 'relative';
126 this.textContent = base.relativizeTime(this._date);
128 setDate: function(date)
131 this.textContent = base.relativizeTime(date);
135 ui.MessageBox = base.extends('div', {
136 init: function(title, message)
138 this._content = document.createElement('div');
139 this.appendChild(this._content);
140 this.addMessage(message);
141 document.body.appendChild(this);
145 width: $(window).width() * 0.80, // FIXME: We should have CSS do this work for us.
147 $(this).bind('dialogclose', function() {
153 $(this).dialog('close');
155 addMessage: function(message)
157 var element = document.createElement('div');
158 $(element).addClass('message').text(message);
159 this._content.appendChild(element);
161 // FIXME: It's unclear whether this code could live here or in a controller.
162 addFinalMessage: function(message)
164 this.addMessage(message);
165 this.appendChild(new ui.actions.List([new ui.actions.Close()]));
166 $(statusView).bind('close', statusView.close.bind(statusView));