build.webkit.org/dashboard should provide a way to focus on a subset of bots
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Nov 2013 20:28:08 +0000 (20:28 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Nov 2013 20:28:08 +0000 (20:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122676

Reviewed by Timothy Hatcher.

Add a small 'hide' button next to every platform logo, and a 'show all'
button which only appears when at least one platform is hidden. Hidden
platforms persist using localStorage.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js:
(updateHiddenPlatforms):
(documentReady.unhideButton):
(documentReady.hideButton):
(documentReady):
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js: Added.
(Settings.prototype.setObject):
(Settings.prototype.getObject):
(Settings.prototype.addSettingListener):
(Settings.prototype.fireSettingListener):
(Settings.prototype.toggleHiddenPlatform):
(Settings.prototype.clearHiddenPlatforms):
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
(div.cellButton):
(div.cellButton.hide):
(.hidden):
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html:

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

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js [new file with mode: 0644]
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html
Tools/ChangeLog

index aa20107..758c94f 100644 (file)
@@ -70,10 +70,30 @@ function sortedPlatforms()
     platforms.sort(function(a, b) {
         return a.order - b.order;
     });
-    
+
     return platforms;
 }
 
+function updateHiddenPlatforms()
+{
+    var hiddenPlatforms = settings.getObject("hiddenPlatforms");
+    if (!hiddenPlatforms)
+        hiddenPlatforms = [];
+
+    var platformRows = document.querySelectorAll("tr.platform");
+    for (var i = 0; i < platformRows.length; ++i)
+        platformRows[i].classList.remove("hidden");
+
+    for (var i = 0; i < hiddenPlatforms.length; ++i)
+        document.querySelector("tr.platform." + hiddenPlatforms[i]).classList.add("hidden");
+
+    var unhideButton = document.querySelector("div.cellButton.unhide");
+    if (hiddenPlatforms.length)
+        unhideButton.classList.remove("hidden");
+    else
+        unhideButton.classList.add("hidden");
+}
+
 function documentReady()
 {
     var table = document.createElement("table");
@@ -82,8 +102,12 @@ function documentReady()
     var row = document.createElement("tr");
     row.classList.add("headers");
 
-    // Empty header for the platform logo.
     var header = document.createElement("th");
+    var unhideButton = document.createElement("div");
+    unhideButton.addEventListener("click", function () { settings.clearHiddenPlatforms(); });
+    unhideButton.textContent = "Show All Platforms";
+    unhideButton.classList.add("cellButton", "unhide", "hidden");
+    header.appendChild(unhideButton);
     row.appendChild(header);
 
     header = document.createElement("th");
@@ -122,6 +146,12 @@ function documentReady()
         logoImage.classList.add("logo");
         cell.appendChild(logoImage);
 
+        var hideButton = document.createElement("div");
+        hideButton.addEventListener("click", function (platformName) { return function () { settings.toggleHiddenPlatform(platformName); }; }(platform.name) );
+        hideButton.textContent = "hide";
+        hideButton.classList.add("cellButton", "hide");
+        cell.appendChild(hideButton);
+
         row.appendChild(cell);
 
         cell = document.createElement("td");
@@ -146,6 +176,9 @@ function documentReady()
     }
 
     document.body.appendChild(table);
+
+    updateHiddenPlatforms();
+    settings.addSettingListener("hiddenPlatforms", updateHiddenPlatforms);
 }
 
 document.addEventListener("DOMContentLoaded", documentReady);
diff --git a/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js b/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js
new file mode 100644 (file)
index 0000000..6da17bc
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2013 Apple 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.
+ */
+
+Settings = function()
+{
+    BaseObject.call(this);
+
+    this.changeCallbacks = {};
+};
+
+BaseObject.addConstructorFunctions(Settings);
+
+Settings.prototype = {
+    constructor: Settings,
+    __proto__: BaseObject.prototype,
+
+    setObject: function(key, value)
+    {
+        localStorage.setItem(key, JSON.stringify(value));
+    },
+
+    getObject: function(key)
+    {
+        return JSON.parse(localStorage.getItem(key));
+    },
+
+    addSettingListener: function(key, callback)
+    {
+        if (!this.changeCallbacks[key])
+            this.changeCallbacks[key] = [];
+        this.changeCallbacks[key].push(callback);
+    },
+
+    fireSettingListener: function(key)
+    {
+        var callbacks = this.changeCallbacks[key];
+        if (!callbacks)
+            return;
+        for (var i = 0; i < callbacks.length; ++i)
+            callbacks[i]();
+    },
+
+    toggleHiddenPlatform: function(platform)
+    {
+        var hiddenPlatforms = this.getObject("hiddenPlatforms");
+        if (!hiddenPlatforms)
+            hiddenPlatforms = [];
+
+        var hiddenPlatformIndex = hiddenPlatforms.indexOf(platform);
+        if (hiddenPlatformIndex > -1)
+            hiddenPlatforms.splice(hiddenPlatformIndex, 1);
+        else
+            hiddenPlatforms.push(platform);
+
+        this.setObject("hiddenPlatforms", hiddenPlatforms);
+        this.fireSettingListener("hiddenPlatforms");
+    },
+
+    clearHiddenPlatforms: function()
+    {
+        this.setObject("hiddenPlatforms", []);
+        this.fireSettingListener("hiddenPlatforms");
+    },
+};
index 8e00439..79171f7 100644 (file)
@@ -38,6 +38,23 @@ a:link {
     -webkit-user-select: all;
 }
 
+div.cellButton {
+    font-family: "HelveticaNeue-Light", sans-serif;
+    font-size: 12px;
+    color: rgb(185, 175, 125);
+    cursor: pointer;
+}
+
+div.cellButton.hide {
+    position: absolute;
+    bottom: 2px;
+    right: 4px;
+}
+
+.hidden {
+    display: none;
+}
+
 body {
     background-color: rgb(233, 231, 223);
     text-align: center;
index 7223b74..ed34ba1 100644 (file)
@@ -44,6 +44,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
     <script src="Scripts/BuildbotBuilderQueueView.js"></script>
     <script src="Scripts/BuildbotTesterQueueView.js"></script>
     <script src="Scripts/StatusLineView.js"></script>
+    <script src="Scripts/Settings.js"></script>
     <script src="Scripts/Initialization.js"></script>
     <script src="Scripts/Main.js"></script>
 </head>
index 0f95411..221a263 100644 (file)
@@ -1,3 +1,33 @@
+2013-11-15  Tim Horton  <timothy_horton@apple.com>
+
+        build.webkit.org/dashboard should provide a way to focus on a subset of bots
+        https://bugs.webkit.org/show_bug.cgi?id=122676
+
+        Reviewed by Timothy Hatcher.
+
+        Add a small 'hide' button next to every platform logo, and a 'show all'
+        button which only appears when at least one platform is hidden. Hidden
+        platforms persist using localStorage.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js:
+        (updateHiddenPlatforms):
+        (documentReady.unhideButton):
+        (documentReady.hideButton):
+        (documentReady):
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js: Added.
+        (Settings.prototype.setObject):
+        (Settings.prototype.getObject):
+        (Settings.prototype.addSettingListener):
+        (Settings.prototype.fireSettingListener):
+        (Settings.prototype.toggleHiddenPlatform):
+        (Settings.prototype.clearHiddenPlatforms):
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
+        (div.cellButton):
+        (div.cellButton.hide):
+        (.hidden):
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html:
+
 2013-11-15  Jer Noble  <jer.noble@apple.com>
 
         MediaTime addition and subtraction operators have errors when the rhs is infinite.