<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201127] trunk/Websites/perf.webkit.org</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201127">201127</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-05-18 22:20:03 -0700 (Wed, 18 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Perf dashboard &quot;Add pane&quot; should list first by test, then by machine
https://bugs.webkit.org/show_bug.cgi?id=157880

Reviewed by Stephanie Lewis.

Reversed the order which tests and platforms are selected. Also split .pane-selector-container into #tests and
#platform for the ease of DOM node manipulations.

* public/v3/components/pane-selector.js:
(PaneSelector):
(PaneSelector.prototype._renderPlatformList): Renamed from _renderPlatformLists since there is a single list
for platforms. This list now disappears while a non-metric item is selected in the collection of test lists.
e.g. &quot;Speedometer&quot; instead of its &quot;Score&quot; metric. Remember the last metric we rendered to avoid churning.
(PaneSelector.prototype._renderTestLists): Render the top level tests once. The index of lists have been
decreased by one since test lists are now inside #tests instead of appearing after the platform list.
(PaneSelector.prototype._buildTestList): Don't filter tests since platform is chosen after tests now.
(PaneSelector.prototype._replaceList):
(PaneSelector.prototype._selectedItem): Don't reset the test path (specifies which subtest or metric is picked)
when a platform is selected since it happens after a test metric is chosen now.
(PaneSelector.prototype._clickedItem): Add a pane when a platform is clicked, not when a metric is clicked.
(PaneSelector.cssTemplate):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv3componentspaneselectorjs">trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (201126 => 201127)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2016-05-19 04:57:41 UTC (rev 201126)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2016-05-19 05:20:03 UTC (rev 201127)
</span><span class="lines">@@ -1,5 +1,29 @@
</span><span class="cx"> 2016-05-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        Perf dashboard &quot;Add pane&quot; should list first by test, then by machine
+        https://bugs.webkit.org/show_bug.cgi?id=157880
+
+        Reviewed by Stephanie Lewis.
+
+        Reversed the order which tests and platforms are selected. Also split .pane-selector-container into #tests and
+        #platform for the ease of DOM node manipulations.
+
+        * public/v3/components/pane-selector.js:
+        (PaneSelector):
+        (PaneSelector.prototype._renderPlatformList): Renamed from _renderPlatformLists since there is a single list
+        for platforms. This list now disappears while a non-metric item is selected in the collection of test lists.
+        e.g. &quot;Speedometer&quot; instead of its &quot;Score&quot; metric. Remember the last metric we rendered to avoid churning.
+        (PaneSelector.prototype._renderTestLists): Render the top level tests once. The index of lists have been
+        decreased by one since test lists are now inside #tests instead of appearing after the platform list.
+        (PaneSelector.prototype._buildTestList): Don't filter tests since platform is chosen after tests now.
+        (PaneSelector.prototype._replaceList):
+        (PaneSelector.prototype._selectedItem): Don't reset the test path (specifies which subtest or metric is picked)
+        when a platform is selected since it happens after a test metric is chosen now.
+        (PaneSelector.prototype._clickedItem): Add a pane when a platform is clicked, not when a metric is clicked.
+        (PaneSelector.cssTemplate):
+
+2016-05-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
</ins><span class="cx">         Analysis task should look for a git commit based on abridged hashes
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=157877
</span><span class="cx">         &lt;rdar://problem/26254374&gt;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv3componentspaneselectorjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js (201126 => 201127)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js        2016-05-19 04:57:41 UTC (rev 201126)
+++ trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js        2016-05-19 05:20:03 UTC (rev 201127)
</span><span class="lines">@@ -5,18 +5,19 @@
</span><span class="cx">         super('pane-selector');
</span><span class="cx">         this._currentPlatform = null;
</span><span class="cx">         this._currentPath = [];
</span><del>-        this._platformItems = null;
-        this._renderedPlatform = null;
</del><ins>+        this._platformItems = [];
+        this._renderedMetric = null;
</ins><span class="cx">         this._renderedPath = null;
</span><span class="cx">         this._updateTimer = null;
</span><del>-        this._container = this.content().querySelector('.pane-selector-container');
</del><ins>+        this._platformContainer = this.content().querySelector('#platform');
+        this._testsContainer = this.content().querySelector('#tests');
</ins><span class="cx">         this._callback = null;
</span><span class="cx">         this._previouslySelectedItem = null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     render()
</span><span class="cx">     {
</span><del>-        this._renderPlatformLists();
</del><ins>+        this._renderPlatformList();
</ins><span class="cx">         this._renderTestLists();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -30,16 +31,29 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _renderPlatformLists()
</del><ins>+    _renderPlatformList()
</ins><span class="cx">     {
</span><del>-        if (!this._platformItems) {
</del><ins>+        var currentMetric = null;
+        if (this._currentPath.length) {
+            var lastItem = this._currentPath[this._currentPath.length - 1];
+            if (lastItem instanceof Metric)
+                currentMetric = lastItem;
+        }
+
+        if (this._renderedMetric != currentMetric) {
+            if (this._platformContainer.firstChild)
+                this._platformContainer.removeChild(this._platformContainer.firstChild);
+
+            this._renderedMetric = currentMetric;
</ins><span class="cx">             this._platformItems = [];
</span><span class="cx"> 
</span><del>-            var platforms = Platform.sortByName(Platform.all());
-            for (var platform of platforms)
-                this._platformItems.push(this._createListItem(platform, platform.label()));
-
-            this._replaceList(0, this._buildList(this._platformItems));
</del><ins>+            if (currentMetric) {
+                for (var platform of Platform.sortByName(Platform.all())) {
+                    if (platform.hasMetric(currentMetric))
+                        this._platformItems.push(this._createListItem(platform, platform.label()));
+                }
+                this._platformContainer.appendChild(this._buildList(this._platformItems));
+            }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         for (var li of this._platformItems) {
</span><span class="lines">@@ -50,10 +64,8 @@
</span><span class="cx"> 
</span><span class="cx">     _renderTestLists()
</span><span class="cx">     {
</span><del>-        if (this._renderedPlatform != this._currentPlatform) {
-            this._replaceList(1, this._buildTestList(Test.topLevelTests()), []);
-            this._renderedPlatform = this._currentPlatform;
-        }
</del><ins>+        if (this._renderedPath == null)
+            this._replaceList(0, this._buildTestList(Test.topLevelTests()), []);
</ins><span class="cx"> 
</span><span class="cx">         for (var i = 0; i &lt; this._currentPath.length; i++) {
</span><span class="cx">             var item = this._currentPath[i];
</span><span class="lines">@@ -62,17 +74,17 @@
</span><span class="cx">             if (item instanceof Metric)
</span><span class="cx">                 break;
</span><span class="cx">             var newList = this._buildTestList(Test.sortByName(item.childTests()), Metric.sortByName(item.metrics()));
</span><del>-            this._replaceList(i + 2, newList);
</del><ins>+            this._replaceList(i + 1, newList);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        var removeNodeCount = this._container.childNodes.length - i - 2;
</del><ins>+        var removeNodeCount = this._testsContainer.childNodes.length - i - 1;
</ins><span class="cx">         if (removeNodeCount &gt; 0) {
</span><span class="cx">             while (removeNodeCount--)
</span><del>-                this._container.removeChild(this._container.lastChild);
</del><ins>+                this._testsContainer.removeChild(this._testsContainer.lastChild);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         for (var i = 0; i &lt; this._currentPath.length; i++) {
</span><del>-            var list = this._container.childNodes[i + 1];
</del><ins>+            var list = this._testsContainer.childNodes[i];
</ins><span class="cx">             var item = this._currentPath[i];
</span><span class="cx">             for (var j = 0; j &lt; list.childNodes.length; j++) {
</span><span class="cx">                 var option = list.childNodes[j];
</span><span class="lines">@@ -90,11 +102,9 @@
</span><span class="cx">         var platform = this._currentPlatform;
</span><span class="cx"> 
</span><span class="cx">         var metricItems = (metrics || [])
</span><del>-            .filter(function (metric) { return platform &amp;&amp; platform.hasMetric(metric); })
</del><span class="cx">             .map(function (metric) { return self._createListItem(metric, metric.label()); });
</span><span class="cx"> 
</span><span class="cx">         var testItems = tests
</span><del>-            .filter(function (test) { return platform &amp;&amp; platform.hasTest(test); })
</del><span class="cx">             .map(function (test) {
</span><span class="cx">                 var data = test;
</span><span class="cx">                 var label = test.label();
</span><span class="lines">@@ -110,11 +120,11 @@
</span><span class="cx"> 
</span><span class="cx">     _replaceList(position, newList)
</span><span class="cx">     {
</span><del>-        var existingList = this._container.childNodes[position];
</del><ins>+        var existingList = this._testsContainer.childNodes[position];
</ins><span class="cx">         if (existingList)
</span><del>-            this._container.replaceChild(newList, existingList);
</del><ins>+            this._testsContainer.replaceChild(newList, existingList);
</ins><span class="cx">         else
</span><del>-            this._container.appendChild(newList);
</del><ins>+            this._testsContainer.appendChild(newList);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _createListItem(data, label, hoverCallback, activationCallback)
</span><span class="lines">@@ -150,10 +160,9 @@
</span><span class="cx">             return;
</span><span class="cx">         this._previouslySelectedItem = data;
</span><span class="cx"> 
</span><del>-        if (data instanceof Platform) {
</del><ins>+        if (data instanceof Platform)
</ins><span class="cx">             this._currentPlatform = data;
</span><del>-            this._currentPath = [];
-        } else {
</del><ins>+        else {
</ins><span class="cx">             this._currentPath = data.path();
</span><span class="cx">             if (data instanceof Metric &amp;&amp; data.test().onlyContainsSingleMetric())
</span><span class="cx">                 this._currentPath.splice(this._currentPath.length - 2, 1);
</span><span class="lines">@@ -168,7 +177,7 @@
</span><span class="cx"> 
</span><span class="cx">     _clickedItem(data, event)
</span><span class="cx">     {
</span><del>-        if (!(data instanceof Metric) || !this._callback || !this._currentPlatform || !this._currentPath.length)
</del><ins>+        if (!(data instanceof Platform) || !this._callback || !this._currentPlatform || !this._currentPath.length)
</ins><span class="cx">             return;
</span><span class="cx">         event.preventDefault();
</span><span class="cx">         this._callback(this._currentPlatform, this._currentPath[this._currentPath.length - 1]);
</span><span class="lines">@@ -177,14 +186,15 @@
</span><span class="cx">     static htmlTemplate()
</span><span class="cx">     {
</span><span class="cx">         return `
</span><del>-            &lt;div class=&quot;pane-selector-container&quot;&gt;&lt;/div&gt;
</del><ins>+            &lt;div class=&quot;pane-selector-container&quot;&gt;&lt;div id=&quot;tests&quot;&gt;&lt;/div&gt;&lt;div id=&quot;platform&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</ins><span class="cx">         `;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static cssTemplate()
</span><span class="cx">     {
</span><span class="cx">         return `
</span><del>-            .pane-selector-container {
</del><ins>+            .pane-selector-container,
+            .pane-selector-container &gt; div {
</ins><span class="cx">                 display: flex;
</span><span class="cx">                 flex-direction: row-reverse;
</span><span class="cx">                 height: 10rem;
</span></span></pre>
</div>
</div>

</body>
</html>