Commit f9eb7e5b authored by abarth@webkit.org's avatar abarth@webkit.org

garden-o-matic summary.html should have UI for examining failures

https://bugs.webkit.org/show_bug.cgi?id=66625

Reviewed by Dimitri Glazkov.

This patch introduces the notion of UI actions and converts our
existing manual <button> manipulation with this new abstraction.  The
patch also adds an Examine button to failure notifications.  In a
future patch, I'll add a controller that wires this button up to
something useful.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html:


git-svn-id: svn://svn.chromium.org/blink/trunk@93483 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ab0f1436
......@@ -59,6 +59,7 @@ James, a web developer from Birmingham, UK.
<script src="scripts/checkout.js"></script>
<script src="scripts/results.js"></script>
<script src="scripts/ui.js"></script>
<script src="scripts/ui/actions.js"></script>
<script src="scripts/ui/results.js"></script>
<script src="scripts/model.js"></script>
<script src="scripts/controllers.js"></script>
......
......@@ -53,6 +53,8 @@ THE POSSIBILITY OF SUCH DAMAGE.
<script src="scripts/results.js"></script>
<script src="scripts/results_unittests.js"></script>
<script src="scripts/ui.js"></script>
<script src="scripts/ui/actions.js"></script>
<script src="scripts/ui/actions_unittests.js"></script>
<script src="scripts/ui/results.js"></script>
<script src="scripts/controllers.js"></script> <!-- This script is slightly of order. -->
<script src="scripts/ui/results_unittests.js"></script>
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
var ui = ui || {};
ui.actions = ui.actions || {};
(function() {
var Action = base.extends('button', {
init: function() {
this._eventName = null;
this.addEventListener('click', function() {
if (this._eventName)
$(this).trigger(this._eventName);
}.bind(this));
},
makeDefault: function() {
$(this).addClass('default');
return this;
}
});
ui.actions.Rollout = base.extends(Action, {
init: function() {
this.textContent = 'Roll out';
this._eventName = 'rollout';
}
});
ui.actions.Examine = base.extends(Action, {
init: function() {
this.textContent = 'Examine';
this._eventName = 'examine';
}
});
ui.actions.Rebaseline = base.extends(Action, {
init: function() {
this.textContent = 'Rebaseline';
this._eventName = 'rebaseline';
}
});
ui.actions.Next = base.extends(Action, {
init: function() {
this.textContent = '&#9654;';
this._eventName = 'next';
this.className = 'next';
}
});
ui.actions.Previous = base.extends(Action, {
init: function() {
this.textContent = '&#9664;';
this._eventName = 'previous';
this.className = 'previous';
}
});
ui.actions.List = base.extends('ul', {
init: function(actions) {
this.className = 'actions';
$(this).append(actions.map(function(action) {
var item = document.createElement('li');
item.appendChild(action);
return item;
}));
}
});
})();
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
module('ui.actions');
test('Buttons', 6, function() {
var buttonInfos = [{
view: new ui.actions.Rollout(),
text: 'Roll out',
event: 'rollout'
}, {
view: new ui.actions.Examine(),
text: 'Examine',
event: 'examine'
}, {
view: new ui.actions.Rebaseline(),
text: 'Rebaseline',
event: 'rebaseline'
}];
buttonInfos.forEach(function(buttonInfo) {
equal(buttonInfo.view.textContent, buttonInfo.text);
equal(buttonInfo.view._eventName, buttonInfo.event);
});
});
test('click', 1, function() {
var examine = new ui.actions.Examine();
$(examine).bind('examine', function() {
ok('Examine triggered.');
});
$(examine).trigger('click');
});
test('default', 2, function() {
var next = new ui.actions.Next();
equal(next.makeDefault(), next);
equal(next.className, 'next default');
});
test('List', 1, function() {
var list = new ui.actions.List([
new ui.actions.Rebaseline(),
new ui.actions.Previous(),
new ui.actions.Next()
]);
equal(list.innerHTML,
'<li><button>Rebaseline</button></li>' +
'<li><button class="previous">&amp;#9664;</button></li>' +
'<li><button class="next">&amp;#9654;</button></li>');
});
}());
......@@ -113,10 +113,9 @@ var Cause = base.extends('li', {
{
this._description = this.appendChild(document.createElement('div'));
this._description.className = 'description';
var actions = this.appendChild(document.createElement('ul'));
actions.className = 'actions';
// FIXME: Actions should do something.
actions.appendChild(document.createElement('li')).innerHTML = '<button>Roll out</button>';
this.appendChild(new ui.actions.List([
new ui.actions.Rollout()
]));
}
});
......@@ -151,7 +150,11 @@ ui.notifications.Failure = base.extends(ui.notifications.Notification, {
});
ui.notifications.TestFailures = base.extends(ui.notifications.Failure, {
init: function() { },
init: function() {
this.appendChild(new ui.actions.List([
new ui.actions.Examine()
]));
},
containsFailureAnalysis: function(failureAnalysis)
{
return Array.prototype.some.call(this._effects.children, function(child) {
......
......@@ -93,17 +93,72 @@ test('SuspiciousCommit', 2, function() {
test('TestFailures', 7, function() {
var testFailures = new ui.notifications.TestFailures();
equal(testFailures.tagName, 'LI');
equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"></ul><ul class="causes"></ul></div></div>');
equal(testFailures.innerHTML,
'<time>Just now</time>' +
'<div class="what">' +
'<div class="problem">' +
'<ul class="effects"></ul>' +
'<ul class="causes"></ul>' +
'</div>' +
'</div>' +
'<ul class="actions">' +
'<li><button>Examine</button></li>' +
'</ul>');
testFailures.addFailureAnalysis({testName: 'test'});
equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"></ul></div></div>');
equal(testFailures.innerHTML,
'<time>Just now</time>' +
'<div class="what">' +
'<div class="problem">' +
'<ul class="effects">' +
'<li>test</li>' +
'</ul>' +
'<ul class="causes"></ul>' +
'</div>' +
'</div>' +
'<ul class="actions">' +
'<li><button>Examine</button></li>' +
'</ul>');
ok(testFailures.containsFailureAnalysis({testName: 'test'}));
ok(!testFailures.containsFailureAnalysis({testName: 'foo'}));
testFailures.addFailureAnalysis({testName: 'test'});
equal(testFailures.innerHTML, '<time>Just now</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"></ul></div></div>');
equal(testFailures.innerHTML,
'<time>Just now</time>' +
'<div class="what">' +
'<div class="problem">' +
'<ul class="effects">' +
'<li>test</li>' +
'</ul>' +
'<ul class="causes"></ul>' +
'</div>' +
'</div>' +
'<ul class="actions">' +
'<li><button>Examine</button></li>' +
'</ul>');
var time = new Date();
time.setMinutes(time.getMinutes() - 10);
testFailures.addCommitData({revision: 1, time: time, title: "title", author: "author", reviewer: "reviewer"});
equal(testFailures.innerHTML, '<time>10 minutes ago</time><div class="what"><div class="problem"><ul class="effects"><li>test</li></ul><ul class="causes"><li><div class="description"><a href="">1</a>title author (reviewer)</div><ul class="actions"><li><button>Roll out</button></li></ul></li></ul></div></div>');
equal(testFailures.innerHTML,
'<time>10 minutes ago</time>' +
'<div class="what">' +
'<div class="problem">' +
'<ul class="effects">' +
'<li>test</li>' +
'</ul>' +
'<ul class="causes">' +
'<li>' +
'<div class="description">' +
'<a href="">1</a>title author (reviewer)'+
'</div>' +
'<ul class="actions">' +
'<li><button>Roll out</button></li>' +
'</ul>' +
'</li>' +
'</ul>' +
'</div>' +
'</div>' +
'<ul class="actions">' +
'<li><button>Examine</button></li>' +
'</ul>');
});
test('BuildersFailing', 1, function() {
......
......@@ -207,24 +207,6 @@ ui.results.BuilderSelector = base.extends('select', {
}
});
ui.results.Actions = base.extends('div', {
init: function()
{
this.className = 'actions';
this.innerHTML = '<button class="rebaseline default">Rebaseline</button>' +
'<button class="previous">&#9664;</button>' +
'<button class="next">&#9654;</button>';
this._routeClickEvent('.rebaseline', 'rebaseline');
this._routeClickEvent('.previous', 'previous');
this._routeClickEvent('.next', 'next');
},
_routeClickEvent: function(selector, eventName) {
$(selector, this).bind('click', function() {
$(this).trigger(eventName);
}.bind(this));
}
});
ui.results.View = base.extends('div', {
init: function(delegate)
{
......@@ -235,7 +217,11 @@ ui.results.View = base.extends('div', {
this._builderSelector = new ui.results.BuilderSelector();
this._resultsDetails = new ui.results.ResultsDetails(delegate);
$('.toolbar', this).prepend(new ui.results.Actions())
$('.toolbar', this).prepend(new ui.actions.List([
new ui.actions.Rebaseline().makeDefault(),
new ui.actions.Previous(),
new ui.actions.Next(),
]));
$('.selector', this).append(this._testSelector).append(this._builderSelector);
$('.content', this).append(this._resultsDetails);
},
......
......@@ -43,7 +43,9 @@ James, a web developer from Birmingham, UK.
<script src="scripts/results.js"></script>
<script src="scripts/ui.js"></script>
<script src="scripts/model.js"></script>
<script src="scripts/ui/actions.js"></script>
<script src="scripts/ui/notifications.js"></script>
<script src="scripts/ui/results.js"></script>
<script src="scripts/summary.js"></script>
</body>
</html>
2011-08-20 Adam Barth <abarth@webkit.org>
garden-o-matic summary.html should have UI for examining failures
https://bugs.webkit.org/show_bug.cgi?id=66625
Reviewed by Dimitri Glazkov.
This patch introduces the notion of UI actions and converts our
existing manual <button> manipulation with this new abstraction. The
patch also adds an Examine button to failure notifications. In a
future patch, I'll add a controller that wires this button up to
something useful.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/actions_unittests.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/results.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html:
2011-08-20 Adam Barth <abarth@webkit.org>
garden-o-matic summary page should indiciate compile failures
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment