garden-o-matic needs a summary view with actions for each problem.
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2011 20:57:28 +0000 (20:57 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2011 20:57:28 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66144

Reviewed by Adam Barth.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html: Added notifications tests.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/summary.css: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/summary.css [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html [new file with mode: 0644]
Tools/ChangeLog

index bfe69c5..eebac6c 100644 (file)
@@ -56,6 +56,8 @@ THE POSSIBILITY OF SUCH DAMAGE.
 <script src="ui_unittests.js"></script>
 <script src="model.js"></script>
 <script src="model_unittests.js"></script>
+<script src="scripts/ui/notifications.js"></script>
+<script src="scripts/ui/notifications_unittests.js"></script>
 
 <!-- FIXME: We should have tests for these files! -->
 <script src="Bugzilla.js"></script>
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js
new file mode 100644 (file)
index 0000000..27f9da2
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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() {
+
+var g_actions = new ui.notifications.Stream();
+var g_info = new ui.notifications.Stream();
+
+var g_updateTimerId = 0;
+var g_testFailures = new base.UpdateTracker();
+
+function update()
+{
+    // FIXME: This should be a button with a progress element.
+    var updating = new ui.notifications.Info("Updating ...");
+    g_info.push(updating);
+
+    // FIXME: Also provide information on bot failures.
+    base.callInParallel([model.updateRecentCommits, model.updateResultsByBuilder], function() {
+        model.analyzeUnexpectedFailures(function(failureAnalysis) {
+            var key = failureAnalysis.newestPassingRevision + "+" + failureAnalysis.oldestFailingRevision;
+            var failure = g_testFailures.get(key);
+            if (!failure) {
+                failure = g_actions.push(new ui.notifications.TestFailures());
+                model.commitDataListForRevisionRange(failureAnalysis.newestPassingRevision + 1, failureAnalysis.oldestFailingRevision).forEach(function(commitData) {
+                    failure.addCommitData(commitData);
+                });
+            }
+            failure.addFailureAnalysis(failureAnalysis);
+            g_testFailures.update(key, failure);
+        }, function() {
+            g_testFailures.purge(function(failure) {
+                failure.dismiss();
+            });
+            updating.dismiss();
+        });
+    });
+}
+
+$(document).ready(function() {
+    g_updateTimerId = window.setInterval(update, config.kUpdateFrequency);
+    document.body.insertBefore(g_actions, document.body.firstChild);
+    document.body.insertBefore(g_info, document.body.firstChild);
+    update();
+});
+
+})();
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js
new file mode 100644 (file)
index 0000000..b99374f
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * 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.notifications = ui.notifications || {};
+
+(function(){
+
+ui.notifications.Stream = base.extends('ol', {
+    init: function()
+    {
+        this.className = 'notifications';
+    },
+    push: function(notification)
+    {
+        this.insertBefore(notification, this.firstChild);
+        return notification;
+    }
+});
+
+var Notification = base.extends('li', {
+    init: function()
+    {
+        this._what = this.appendChild(document.createElement('div'));
+        this._what.className = 'what';
+        $(this).hide().fadeIn('fast');
+    },
+    dismiss: function()
+    {
+        // FIXME: These fade in/out effects are lame.
+        $(this).fadeOut(function()
+        {
+            this.parentNode && this.parentNode.removeChild(this);
+        });
+    }
+});
+
+ui.notifications.Info = base.extends(Notification, {
+    init: function(message)
+    {
+        this._what.textContent = message;
+    }
+});
+
+var Time = base.extends('time', {
+    init: function()
+    {
+        this.updateTime("Just Now");
+    },
+    updateTime: function(time)
+    {
+        // FIXME: Implement displaying actual time.
+        // FIXME: Implement relative time.
+        this.textContent = time;
+    }
+});
+
+ui.notifications.FailingTest = base.extends('li', {
+    init: function(failureAnalysis)
+    {
+        // FIXME: Show type of failure and where it's failing.
+        this.textContent = failureAnalysis.testName;
+    }
+})
+
+var Cause = base.extends('li', {
+    init: function()
+    {
+        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>';
+    }
+});
+
+ui.notifications.SuspiciousCommit = base.extends(Cause, {
+    init: function(commitData)
+    {
+        var linkToRevision = this._description.appendChild(document.createElement('a'));
+        // FIXME: Set href.
+        linkToRevision.href = '';
+        linkToRevision.textContent = commitData.revision;
+        // FIXME: Reviewer could be unknown.
+        // FIXME: Provide opportunities to style title/author/reviewer separately.
+        this._description.appendChild(document.createTextNode(commitData.title + ' ' + commitData.author + ' (' + commitData.reviewer + ')'));
+    }
+});
+
+ui.notifications.TestFailures = base.extends(Notification, {
+    init: function()
+    {
+        this._time = this.insertBefore(new Time(), this.firstChild);
+        var problem = this._what.appendChild(document.createElement('div'));
+        problem.className = 'problem';
+        this._tests = problem.appendChild(document.createElement('ul'));
+        this._tests.className = 'effects';
+        this._causes = problem.appendChild(document.createElement('ul'));
+        this._causes.className = 'causes';
+    },
+    addFailureAnalysis: function(failureAnalysis)
+    {
+        // FIXME: Add in order.
+        // FIXME: Don't add more than once.
+        // FIXME: Retrieve date from failureAnalysis and set this._time.
+        return this._tests.appendChild(new ui.notifications.FailingTest(failureAnalysis));
+    },
+    addCommitData: function(commitData)
+    {
+        return this._causes.appendChild(new ui.notifications.SuspiciousCommit(commitData));
+    }
+});
+
+})();
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js
new file mode 100644 (file)
index 0000000..db6466a
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.notifications');
+
+test('ui.notifications.Stream', 5, function() {
+    var stream = new ui.notifications.Stream();
+    equal(stream.tagName, 'OL');
+    equal(stream.className, 'notifications');
+    stream.push(document.createElement('li')).textContent = 'o-matic';
+    equal(stream.childElementCount, 1);
+    stream.push(document.createElement('li')).textContent = 'garden-';
+    equal(stream.childElementCount, 2);
+    equal(stream.textContent, 'garden-o-matic');
+});
+
+test('ui.notifications.Info', 3, function() {
+    var info = new ui.notifications.Info('info');
+    equal(info.tagName, 'LI');
+    equal(info.innerHTML, '<div class="what">info</div>');
+    // FIXME: Really need to figure out how to mock/test animated removal.
+    ok(info.dismiss);
+});
+
+test('ui.notifications.FailingTest', 2, function() {
+    var failingTest = new ui.notifications.FailingTest({testName: 'test'});
+    equal(failingTest.tagName, 'LI');
+    equal(failingTest.innerHTML, 'test');
+});
+
+test('ui.notifications.SuspiciousCommit', 2, function() {
+    var suspiciousCommit = new ui.notifications.SuspiciousCommit({revision: 1, title: "title", author: "author", reviewer: "reviewer"});
+    equal(suspiciousCommit.tagName, 'LI');
+    equal(suspiciousCommit.innerHTML, '<div class="description"><a href="">1</a>title author (reviewer)</div><ul class="actions"><li><button>Roll out</button></li></ul>');
+});
+
+test('ui.notifications.TestFailures', 4, 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>');
+    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>');
+    testFailures.addCommitData({revision: 1, title: "title", author: "author", reviewer: "reviewer"});
+    equal(testFailures.innerHTML, '<time>Just Now</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>');
+});
+
+}());
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/summary.css b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/summary.css
new file mode 100644 (file)
index 0000000..da1f2f1
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+ol.notifications {
+    list-style: none;
+    padding: 0;
+}
+
+ol.notifications ul {
+    list-style: none;
+    padding: 0;
+}
+
+ol.notifications>li {
+    display: -webkit-box;
+    width: 100%;
+    padding: 10px 0;
+    border: 1px solid LightGray;
+}
+
+ol.notifications>li>time {
+    padding: 0 0 0 10px;
+    text-align: right;
+    width: 100px;
+}
+
+ol.notifications>li>div.what {
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    padding: 0 10px;
+    -webkit-box-flex: 1;
+}
+
+ol.notifications>li ul.causes>li {
+    padding: 10px;
+    border: 1px solid Red;
+}
+
+ol.notifications>li ul.causes>li ul.actions {
+    text-align: right;
+}
+
+ol.notifications>li ul.causes>li li {
+    padding: 10px 0 0 0;
+    display: inline;
+}
\ No newline at end of file
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html
new file mode 100644 (file)
index 0000000..1b02599
--- /dev/null
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<!--
+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.
+
+The favicons are from the awesome famfamfam.com, which is the website of Mark
+James, a web developer from Birmingham, UK.
+-->
+<html>
+<head>
+<title>Garden-O-Matic Summary View</title>
+<link rel="stylesheet" href="styles/summary.css">
+</head>
+<body>
+<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+<script src="config.js"></script>
+<script src="base.js"></script>
+<script src="net.js"></script>
+<script src="Trac.js"></script>
+<script src="Bugzilla.js"></script>
+<script src="builders.js"></script>
+<script src="checkout.js"></script>
+<script src="results.js"></script>
+<script src="ui.js"></script>
+<script src="model.js"></script>
+<script src="scripts/ui/notifications.js"></script>
+<script src="scripts/summary.js"></script>
+</body>
+</html>
index e65fe39..d9c5cac 100644 (file)
@@ -1,3 +1,17 @@
+2011-08-16  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        garden-o-matic needs a summary view with actions for each problem.
+        https://bugs.webkit.org/show_bug.cgi?id=66144
+
+        Reviewed by Adam Barth.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html: Added notifications tests.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/styles/summary.css: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html: Added.
+
 2011-08-16  Dean Jackson  <dino@apple.com>
 
         Adding Ted "hober" O'Connor as a non-committing contributor.