<!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>[174711] 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/174711">174711</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-14 16:46:45 -0700 (Tue, 14 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>New perf dashboard should have an ability to search commits by a keyword
https://bugs.webkit.org/show_bug.cgi?id=137675
Reviewed by Geoffrey Garen.
/api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to
include "authorEmail" and "authorName" directly as columns instead of including an "author" object.
This API change allows fetch_commits_between to generate results without processing Postgres query results.
In the front end side, we've added a search pane in pane controller, and the interactive chart component
now has a concept of highlighted items which is used to indicate commits found by the search pane.
* public/api/commits.php:
(main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits.
(fetch_commits_between): Moved some code from main. Now takes a search term as the third argument.
We look for a commit if its author name or email contains the keyword or if its revision matches the keyword.
(format_commit): Renamed from format_commits. Now only formats one commit.
* public/include/db.php:
(Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false).
* public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well.
* public/v2/app.js:
(App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems',
which is a hash table that contains highlighted items' measurements' ids as keys.
(App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets
the default commit repository.
(App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit.
(App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots.
Added the code to initialize this._highlights.
(App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines.
(App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto.
(App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes
the existing lines for the old highlighted items.
(App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above.
Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed.
* public/v2/chart-pane.css: Added style for the search pane and the search button.
* public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs.
(CommitLogs): Added.
(CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument.
(CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange.
(CommitLogs._cacheConsecutiveCommits): Ditto.
(FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted.
(Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions.
(Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime.
* public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding
for showingDetails since this property is no longer used.
* public/v2/manifest.js:
(App.Manifest.repositories): Added.
(App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find
the default repository to search.
(App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicapicommitsphp">trunk/Websites/perf.webkit.org/public/api/commits.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicincludedbphp">trunk/Websites/perf.webkit.org/public/include/db.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2appcss">trunk/Websites/perf.webkit.org/public/v2/app.css</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2appjs">trunk/Websites/perf.webkit.org/public/v2/app.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2chartpanecss">trunk/Websites/perf.webkit.org/public/v2/chart-pane.css</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2datajs">trunk/Websites/perf.webkit.org/public/v2/data.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2indexhtml">trunk/Websites/perf.webkit.org/public/v2/index.html</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2manifestjs">trunk/Websites/perf.webkit.org/public/v2/manifest.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 (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -1,5 +1,65 @@
</span><span class="cx"> 2014-10-13 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><ins>+ New perf dashboard should have an ability to search commits by a keyword
+ https://bugs.webkit.org/show_bug.cgi?id=137675
+
+ Reviewed by Geoffrey Garen.
+
+ /api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to
+ include "authorEmail" and "authorName" directly as columns instead of including an "author" object.
+ This API change allows fetch_commits_between to generate results without processing Postgres query results.
+
+ In the front end side, we've added a search pane in pane controller, and the interactive chart component
+ now has a concept of highlighted items which is used to indicate commits found by the search pane.
+
+ * public/api/commits.php:
+ (main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits.
+ (fetch_commits_between): Moved some code from main. Now takes a search term as the third argument.
+ We look for a commit if its author name or email contains the keyword or if its revision matches the keyword.
+ (format_commit): Renamed from format_commits. Now only formats one commit.
+
+ * public/include/db.php:
+ (Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false).
+
+ * public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well.
+
+ * public/v2/app.js:
+ (App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems',
+ which is a hash table that contains highlighted items' measurements' ids as keys.
+ (App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets
+ the default commit repository.
+ (App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit.
+ (App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots.
+ Added the code to initialize this._highlights.
+ (App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines.
+ (App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto.
+ (App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes
+ the existing lines for the old highlighted items.
+ (App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above.
+ Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed.
+
+ * public/v2/chart-pane.css: Added style for the search pane and the search button.
+
+ * public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs.
+ (CommitLogs): Added.
+ (CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument.
+ (CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange.
+ (CommitLogs._cacheConsecutiveCommits): Ditto.
+ (FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted.
+ (Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions.
+ (Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime.
+
+ * public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding
+ for showingDetails since this property is no longer used.
+
+ * public/v2/manifest.js:
+ (App.Manifest.repositories): Added.
+ (App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find
+ the default repository to search.
+ (App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits.
+
+2014-10-13 Ryosuke Niwa <rniwa@webkit.org>
+
</ins><span class="cx"> Unreviewed build fix after r174555.
</span><span class="cx">
</span><span class="cx"> * public/include/manifest.php:
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicapicommitsphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/api/commits.php (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/api/commits.php        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/api/commits.php        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -20,7 +20,10 @@
</span><span class="cx"> $single_commit = NULL;
</span><span class="cx"> $commits = array();
</span><span class="cx"> if (!$filter) {
</span><del>- $commits = $db->fetch_table('commits', 'commit_time');
</del><ins>+ $keyword = array_get($_GET, 'keyword');
+ $from = array_get($_GET, 'from');
+ $to = array_get($_GET, 'to');
+ $commits = fetch_commits_between($db, $repository_id, $from, $to, $keyword);
</ins><span class="cx"> } else if ($filter == 'oldest') {
</span><span class="cx"> $single_commit = $db->select_first_row('commits', 'commit', array('repository' => $repository_id), 'time');
</span><span class="cx"> } else if ($filter == 'latest') {
</span><span class="lines">@@ -28,20 +31,16 @@
</span><span class="cx"> } else if ($filter == 'last-reported') {
</span><span class="cx"> $single_commit = $db->select_last_row('commits', 'commit', array('repository' => $repository_id, 'reported' => true), 'time');
</span><span class="cx"> } else if (ctype_alnum($filter)) {
</span><del>- $single_commit = commit_from_revision($db, $repository_id, $repository_name, $filter);
</del><ins>+ $single_commit = commit_from_revision($db, $repository_id, $filter);
</ins><span class="cx"> } else {
</span><span class="cx"> $matches = array();
</span><span class="cx"> if (!preg_match('/([A-Za-z0-9]+)[\:\-]([A-Za-z0-9]+)/', $filter, $matches))
</span><span class="cx"> exit_with_error('UnknownFilter', array('repositoryName' => $repository_name, 'filter' => $filter));
</span><span class="cx">
</span><del>- $first = commit_from_revision($db, $repository_id, $matches[1])['commit_time'];
- $second = commit_from_revision($db, $repository_id, $matches[2])['commit_time'];
- $in_order = $first < $second;
-
- $commits = fetch_commits_between($db, $repository_id, $in_order ? $first : $second, $in_order ? $second : $first);
</del><ins>+ $commits = fetch_commits_between($db, $repository_id, $matches[1], $matches[2]);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- exit_with_success(array('commits' => format_commits($single_commit ? array($single_commit) : $commits)));
</del><ins>+ exit_with_success(array('commits' => $single_commit ? format_commit($single_commit) : $commits));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function commit_from_revision($db, $repository_id, $revision) {
</span><span class="lines">@@ -55,28 +54,51 @@
</span><span class="cx"> return $row;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function fetch_commits_between($db, $repository_id, $from, $to) {
- $commits = $db->query_and_fetch_all('SELECT * FROM commits
- WHERE commit_repository = $1 AND commit_time >= $2 AND commit_time <= $3 AND commit_reported = true ORDER BY commit_time',
- array($repository_id, $from, $to));
- if (!$commits)
- exit_with_error('FailedToFetchCommits', array('repository' => $repository_id, 'from' => $from, 'to' => $to));
</del><ins>+function fetch_commits_between($db, $repository_id, $first, $second, $keyword = NULL) {
+ $statements = 'SELECT commit_id as "id",
+ commit_revision as "revision",
+ commit_parent as "parent",
+ commit_time as "time",
+ commit_author_name as "authorName",
+ commit_author_email as "authorEmail",
+ commit_message as "message"
+ FROM commits WHERE commit_repository = $1 AND commit_reported = true';
+ $values = array($repository_id);
+
+ if ($first && $second) {
+ $first = commit_from_revision($db, $repository_id, $first)['commit_time'];
+ $second = commit_from_revision($db, $repository_id, $second)['commit_time'];
+ $in_order = $first < $second;
+ array_push($values, $in_order ? $first : $second);
+ $statements .= ' AND commit_time >= $' . count($values);
+ array_push($values, $in_order ? $second : $first);
+ $statements .= ' AND commit_time <= $' . count($values);
+ }
+
+ if ($keyword) {
+ array_push($values, '%' . str_replace(array('\\', '_', '@'), array('\\\\', '\\_', '\\%'), $keyword) . '%');
+ $index = '$' . count($values);
+ $statements .= " AND (commit_author_name LIKE $index OR commit_author_email LIKE $index";
+ array_push($values, ltrim($keyword, 'r'));
+ $statements .= ' OR commit_revision = $' . count($values) . ')';
+ }
+
+ $commits = $db->query_and_fetch_all($statements . ' ORDER BY commit_time', $values);
+ if (!is_array($commits))
+ exit_with_error('FailedToFetchCommits', array('repository' => $repository_id, 'first' => $first, 'second' => $second));
</ins><span class="cx"> return $commits;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function format_commits($commits) {
- $formatted_commits = array();
- foreach ($commits as $commit_row) {
- array_push($formatted_commits, array(
- 'id' => $commit_row['commit_id'],
- 'revision' => $commit_row['commit_revision'],
- 'parent' => $commit_row['commit_parent'],
- 'time' => $commit_row['commit_time'],
- 'author' => array('name' => $commit_row['commit_author_name'], 'email' => $commit_row['commit_author_email']),
- 'message' => $commit_row['commit_message']
- ));
- }
- return $formatted_commits;
</del><ins>+function format_commit($commit_row) {
+ return array(array(
+ 'id' => $commit_row['commit_id'],
+ 'revision' => $commit_row['commit_revision'],
+ 'parent' => $commit_row['commit_parent'],
+ 'time' => $commit_row['commit_time'],
+ 'authorName' => $commit_row['commit_author_name'],
+ 'authorEmail' => $commit_row['commit_author_email'],
+ 'message' => $commit_row['commit_message']
+ ));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> main(array_key_exists('PATH_INFO', $_SERVER) ? explode('/', trim($_SERVER['PATH_INFO'], '/')) : array());
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicincludedbphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/include/db.php (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/include/db.php        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/include/db.php        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -185,10 +185,12 @@
</span><span class="cx">
</span><span class="cx"> function query_and_fetch_all($query, $params = array()) {
</span><span class="cx"> if (!$this->connection)
</span><del>- return false;
</del><ins>+ return NULL;
</ins><span class="cx"> $result = pg_query_params($this->connection, $query, $params);
</span><span class="cx"> if (!$result)
</span><del>- return false;
</del><ins>+ return NULL;
+ if (pg_num_rows($result) == 0)
+ return array();
</ins><span class="cx"> return pg_fetch_all($result);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2appcss"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/app.css (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/app.css        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/app.css        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -115,14 +115,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><del>-.close-button {
</del><ins>+.icon-button {
</ins><span class="cx"> width: 1rem;
</span><span class="cx"> height: 1rem;
</span><span class="cx"> }
</span><del>-.close-button g {
</del><ins>+.icon-button g {
</ins><span class="cx"> stroke: #ccc;
</span><span class="cx"> }
</span><del>-.close-button:hover g {
</del><ins>+.icon-button:hover g {
</ins><span class="cx"> stroke: #666;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2appjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/app.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/app.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/app.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -287,9 +287,36 @@
</span><span class="cx"> metricId: null,
</span><span class="cx"> metric: null,
</span><span class="cx"> selectedItem: null,
</span><del>- init: function ()
- {
- this._super();
</del><ins>+ searchCommit: function (repository, keyword) {
+ var self = this;
+ var repositoryName = repository.get('id');
+ CommitLogs.fetchForTimeRange(repositoryName, null, null, keyword).then(function (commits) {
+ if (self.isDestroyed || !self.get('chartData') || !commits.length)
+ return;
+ var currentRuns = self.get('chartData').current.timeSeriesByCommitTime().series();
+ if (!currentRuns.length)
+ return;
+
+ var highlightedItems = {};
+ var commitIndex = 0;
+ for (var runIndex = 0; runIndex < currentRuns.length && commitIndex < commits.length; runIndex++) {
+ var measurement = currentRuns[runIndex].measurement;
+ var commitTime = measurement.commitTimeForRepository(repositoryName);
+ if (!commitTime)
+ continue;
+ if (commits[commitIndex].time <= commitTime) {
+ highlightedItems[measurement.id()] = true;
+ do {
+ commitIndex++;
+ } while (commitIndex < commits.length && commits[commitIndex].time <= commitTime);
+ }
+ }
+
+ self.set('highlightedItems', highlightedItems);
+ }, function () {
+ // FIXME: Report errors
+ this.set('highlightedItems', {});
+ });
</ins><span class="cx"> },
</span><span class="cx"> _fetch: function () {
</span><span class="cx"> var platformId = this.get('platformId');
</span><span class="lines">@@ -646,6 +673,19 @@
</span><span class="cx"> {
</span><span class="cx"> this.parentController.removePane(this.get('model'));
</span><span class="cx"> },
</span><ins>+ toggleSearch: function ()
+ {
+ if (!App.Manifest.repositoriesWithReportedCommits)
+ return;
+ var model = this.get('model');
+ if (!model.get('commitSearchRepository'))
+ model.set('commitSearchRepository', App.Manifest.repositoriesWithReportedCommits[0]);
+ this.toggleProperty('showingSearchPane');
+ },
+ searchCommit: function () {
+ var model = this.get('model');
+ model.searchCommit(model.get('commitSearchRepository'), model.get('commitSearchKeyword'));
+ },
</ins><span class="cx"> zoomed: function (selection)
</span><span class="cx"> {
</span><span class="cx"> this.set('mainPlotDomain', selection ? selection : this.get('overviewDomain'));
</span><span class="lines">@@ -843,7 +883,12 @@
</span><span class="cx"> if (this._areas)
</span><span class="cx"> this._areas.forEach(function (area) { area.remove(); });
</span><span class="cx"> this._areas = [];
</span><ins>+ if (this._dots)
+ this._dots.forEach(function (dot) { dots.remove(); });
</ins><span class="cx"> this._dots = [];
</span><ins>+ if (this._highlights)
+ this._highlights.forEach(function (highlight) { _highlights.remove(); });
+ this._highlights = [];
</ins><span class="cx">
</span><span class="cx"> this._currentTimeSeries = chartData.current.timeSeriesByCommitTime();
</span><span class="cx"> this._currentTimeSeriesData = this._currentTimeSeries.series();
</span><span class="lines">@@ -1018,6 +1063,7 @@
</span><span class="cx"> .attr("cx", function(measurement) { return xScale(measurement.time); })
</span><span class="cx"> .attr("cy", function(measurement) { return yScale(measurement.value); });
</span><span class="cx"> });
</span><ins>+ this._updateHighlightPositions();
</ins><span class="cx">
</span><span class="cx"> if (this._brush) {
</span><span class="cx"> if (selection)
</span><span class="lines">@@ -1045,6 +1091,19 @@
</span><span class="cx"> .style("z-index", "100")
</span><span class="cx"> .text(this._yAxisUnit);
</span><span class="cx"> },
</span><ins>+ _updateHighlightPositions: function () {
+ var xScale = this._x;
+ var yScale = this._y;
+ var y2 = this._margin.top + this._contentHeight;
+ this._highlights.forEach(function (highlight) {
+ highlight
+ .attr("y1", 0)
+ .attr("y2", y2)
+ .attr("y", function(measurement) { return yScale(measurement.value); })
+ .attr("x1", function(measurement) { return xScale(measurement.time); })
+ .attr("x2", function(measurement) { return xScale(measurement.time); });
+ });
+ },
</ins><span class="cx"> _computeXAxisDomain: function (timeSeries)
</span><span class="cx"> {
</span><span class="cx"> var extent = d3.extent(timeSeries, function(point) { return point.time; });
</span><span class="lines">@@ -1317,6 +1376,26 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }.observes('selectedItem').on('init'),
</span><ins>+ _highlightedItemsChanged: function () {
+ if (!this._margin)
+ return;
+
+ var highlightedItems = this.get('highlightedItems');
+
+ var data = this._currentTimeSeriesData.filter(function (item) { return highlightedItems[item.measurement.id()]; });
+
+ if (this._highlights)
+ this._highlights.forEach(function (highlight) { highlight.remove(); });
+
+ this._highlights.push(this._clippedContainer
+ .selectAll(".highlight")
+ .data(data)
+ .enter().append("line")
+ .attr("class", "highlight"));
+
+ this._updateHighlightPositions();
+
+ }.observes('highlightedItems'),
</ins><span class="cx"> _updateCurrentItemIndicators: function ()
</span><span class="cx"> {
</span><span class="cx"> if (!this._currentItemLine)
</span><span class="lines">@@ -1412,18 +1491,21 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> var self = this;
</span><del>- FetchCommitsForTimeRange(repository, from, to).then(function (commits) {
</del><ins>+ CommitLogs.fetchForTimeRange(repository.get('id'), from, to).then(function (commits) {
+ if (self.isDestroyed)
+ return;
</ins><span class="cx"> self.set('commits', commits.map(function (commit) {
</span><span class="cx"> return Ember.Object.create({
</span><span class="cx"> repository: repository,
</span><span class="cx"> revision: commit.revision,
</span><span class="cx"> url: repository.urlForRevision(commit.revision),
</span><del>- author: commit.author.name || commit.author.email,
</del><ins>+ author: commit.authorName || commit.authorEmail,
</ins><span class="cx"> message: commit.message ? commit.message.substr(0, 75) : null,
</span><span class="cx"> });
</span><span class="cx"> }));
</span><span class="cx"> }, function () {
</span><del>- self.set('commits', []);
</del><ins>+ if (!self.isDestroyed)
+ self.set('commits', []);
</ins><span class="cx"> })
</span><span class="cx"> }.observes('repository').observes('revisionInfo').on('init'),
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2chartpanecss"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/chart-pane.css (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/chart-pane.css        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/chart-pane.css        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx"> padding: 0;
</span><span class="cx"> margin-bottom: 1rem;
</span><span class="cx"> outline: none;
</span><ins>+ position: relative;
</ins><span class="cx"> }
</span><span class="cx"> .chart-pane header {
</span><span class="cx"> background: #fff;
</span><span class="lines">@@ -49,6 +50,50 @@
</span><span class="cx"> top: 0.55rem;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.chart-pane a.search-button {
+ display: inline-block;
+ position: absolute;
+ right: 0.55rem;
+ top: 0.55rem;
+}
+
+.search-pane {
+ position: absolute;
+ right: 0rem;
+ top: 1.7rem;
+ border: 1px solid #bbb;
+ padding: 0;
+ border-radius: 0.5rem;
+ display: table;
+ background: white;
+}
+
+.search-pane.hidden {
+ display: none;
+}
+
+.search-pane input {
+ display: table-cell;
+ vertical-align: middle;
+ outline: none;
+ border: none;
+ border-top-right-radius: 0.5rem;
+ border-bottom-right-radius: 0.5rem;
+ padding: 0.5rem;
+ font-size: 1rem;
+ margin: 0;
+}
+
+.search-pane .repositories {
+ display: table-cell;
+ vertical-align: middle;
+ padding: 0 0.5rem;
+}
+
+.search-pane input:focus {
+ background-color: rgb(249, 242, 228);
+}
+
</ins><span class="cx"> .chart-pane .body {
</span><span class="cx"> position: relative;
</span><span class="cx"> width: 100%;
</span><span class="lines">@@ -222,6 +267,13 @@
</span><span class="cx"> fill: #f93;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.chart .highlight {
+ stroke: #39f;
+ stroke-dasharray: 4, 4;
+ stroke-width: 1px;
+ fill: none;
+}
+
</ins><span class="cx"> .chart .extent {
</span><span class="cx"> stroke: #9c6;
</span><span class="cx"> stroke-width: 1px;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2datajs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/data.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/data.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/data.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -1,22 +1,30 @@
</span><span class="cx"> // We don't use DS.Model for these object types because we can't afford to process millions of them.
</span><span class="cx">
</span><del>-function FetchCommitsForTimeRange(repository, from, to)
</del><ins>+var CommitLogs = {
+ _cachedCommitsByRepository: {}
+};
+
+CommitLogs.fetchForTimeRange = function (repository, from, to, keyword)
</ins><span class="cx"> {
</span><del>- var url = '../api/commits/' + repository.get('id') + '/' + from + '-' + to;
-
- var cachedCommits = FetchCommitsForTimeRange._cachedCommitsByRepository[repository];
- if (!cachedCommits) {
- cachedCommits = {commitsByRevision: {}, commitsByTime: []};
- FetchCommitsForTimeRange._cachedCommitsByRepository[repository] = cachedCommits;
</del><ins>+ var params = [];
+ if (from && to) {
+ params.push(['from', from]);
+ params.push(['to', to]);
</ins><span class="cx"> }
</span><ins>+ if (keyword)
+ params.push(['keyword', keyword]);
</ins><span class="cx">
</span><del>- if (cachedCommits) {
- var startCommit = cachedCommits.commitsByRevision[from];
- var endCommit = cachedCommits.commitsByRevision[to];
- if (startCommit && endCommit) {
- return new Ember.RSVP.Promise(function (resolve) {
- resolve(cachedCommits.commitsByTime.slice(startCommit.index, endCommit.index + 1)) });
- }
</del><ins>+ // FIXME: We should be able to use the cache if all commits in the range have been cached.
+ var useCache = from && to && !keyword;
+
+ var url = '../api/commits/' + repository + '/?' + params.map(function (keyValue) {
+ return encodeURIComponent(keyValue[0]) + '=' + encodeURIComponent(keyValue[1]);
+ }).join('&');
+
+ if (useCache) {
+ var cachedCommitsForRange = CommitLogs._cachedCommitsBetween(repository, from, to);
+ if (cachedCommitsForRange)
+ return new Ember.RSVP.Promise(function (resolve) { resolve(cachedCommitsForRange); });
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> console.log('Fecthing ' + url);
</span><span class="lines">@@ -28,26 +36,53 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- data.commits.forEach(function (commit) {
- if (cachedCommits.commitsByRevision[commit.revision])
- return;
- commit.time = new Date(commit.time.replace(' ', 'T'));
- cachedCommits.commitsByRevision[commit.revision] = commit;
- cachedCommits.commitsByTime.push(commit);
- });
</del><ins>+ var fetchedCommits = data.commits;
+ fetchedCommits.forEach(function (commit) { commit.time = new Date(commit.time.replace(' ', 'T')); });
</ins><span class="cx">
</span><del>- cachedCommits.commitsByTime.sort(function (a, b) { return a.time - b.time; });
- cachedCommits.commitsByTime.forEach(function (commit, index) { commit.index = index; });
</del><ins>+ if (useCache)
+ CommitLogs._cacheConsecutiveCommits(repository, from, to, fetchedCommits);
</ins><span class="cx">
</span><del>- resolve(data.commits);
</del><ins>+ resolve(fetchedCommits);
</ins><span class="cx"> }).fail(function (xhr, status, error) {
</span><span class="cx"> reject(xhr.status + (error ? ', ' + error : ''));
</span><span class="cx"> })
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-FetchCommitsForTimeRange._cachedCommitsByRepository = {};
</del><ins>+CommitLogs._cachedCommitsBetween = function (repository, from, to)
+{
+ var cachedCommits = this._cachedCommitsByRepository[repository];
+ if (!cachedCommits)
+ return null;
</ins><span class="cx">
</span><ins>+ var startCommit = cachedCommits.commitsByRevision[from];
+ var endCommit = cachedCommits.commitsByRevision[to];
+ if (!startCommit || !endCommit)
+ return null;
+
+ return cachedCommits.commitsByTime.slice(startCommit.cacheIndex, endCommit.cacheIndex + 1);
+}
+
+CommitLogs._cacheConsecutiveCommits = function (repository, from, to, consecutiveCommits)
+{
+ var cachedCommits = this._cachedCommitsByRepository[repository];
+ if (!cachedCommits) {
+ cachedCommits = {commitsByRevision: {}, commitsByTime: []};
+ this._cachedCommitsByRepository[repository] = cachedCommits;
+ }
+
+ consecutiveCommits.forEach(function (commit) {
+ if (cachedCommits.commitsByRevision[commit.revision])
+ return;
+ cachedCommits.commitsByRevision[commit.revision] = commit;
+ cachedCommits.commitsByTime.push(commit);
+ });
+
+ cachedCommits.commitsByTime.sort(function (a, b) { return a.time - b.time; });
+ cachedCommits.commitsByTime.forEach(function (commit, index) { commit.cacheIndex = index; });
+}
+
+
</ins><span class="cx"> function Measurement(rawData)
</span><span class="cx"> {
</span><span class="cx"> this._raw = rawData;
</span><span class="lines">@@ -70,6 +105,15 @@
</span><span class="cx"> this._formattedRevisions = undefined;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Measurement.prototype.commitTimeForRepository = function (repositoryName)
+{
+ var revisions = this._raw['revisions'];
+ var rawData = revisions[repositoryName];
+ if (!rawData)
+ return null;
+ return new Date(rawData[1]);
+}
+
</ins><span class="cx"> Measurement.prototype.formattedRevisions = function (previousMeasurement)
</span><span class="cx"> {
</span><span class="cx"> var revisions = this._raw['revisions'];
</span><span class="lines">@@ -77,13 +121,8 @@
</span><span class="cx"> var formattedRevisions = {};
</span><span class="cx"> for (var repositoryName in revisions) {
</span><span class="cx"> var currentRevision = revisions[repositoryName][0];
</span><del>- var commitTimeInPOSIX = revisions[repositoryName][1];
-
</del><span class="cx"> var previousRevision = previousRevisions ? previousRevisions[repositoryName][0] : null;
</span><del>-
</del><span class="cx"> var formatttedRevision = this._formatRevisionRange(previousRevision, currentRevision);
</span><del>- if (commitTimeInPOSIX)
- formatttedRevision['commitTime'] = new Date(commitTimeInPOSIX);
</del><span class="cx"> formattedRevisions[repositoryName] = formatttedRevision;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2indexhtml"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/index.html (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/index.html        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/index.html        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -135,9 +135,12 @@
</span><span class="cx"> {{metric.label}}
</span><span class="cx"> - {{ platform.name}}</h2>
</span><span class="cx"> <a href="#" title="Close" class="close-button" {{action "close"}}>{{partial "close-button"}}</a>
</span><ins>+ {{if App.Manifest.repositoriesWithReportedCommits}}
+ <a href="#" title="Search" class="search-button" {{action "toggleSearch"}}>{{partial "search-button"}}</a>
+ {{/if}}
</ins><span class="cx"> </header>
</span><span class="cx">
</span><del>- <div {{bind-attr class=":body showingDetails"}}>
</del><ins>+ <div class="body">
</ins><span class="cx"> <div class="svg-container">
</span><span class="cx"> {{#if chartData}}
</span><span class="cx"> {{interactive-chart
</span><span class="lines">@@ -147,6 +150,7 @@
</span><span class="cx"> currentItem=currentItem
</span><span class="cx"> currentTime=sharedTime
</span><span class="cx"> selectedItem=selectedItem
</span><ins>+ highlightedItems=highlightedItems
</ins><span class="cx"> selection=timeRange
</span><span class="cx"> sharedSelection=sharedSelection
</span><span class="cx"> selectionChanged="rangeChanged"
</span><span class="lines">@@ -177,6 +181,16 @@
</span><span class="cx"> {{/if}}
</span><span class="cx"> </div>
</span><span class="cx"> </div>
</span><ins>+
+ <form {{bind-attr class=":search-pane showingSearchPane::hidden"}}>
+ <span class="repositories">
+ {{view Ember.Select content=App.Manifest.repositoriesWithReportedCommits
+ optionLabelPath='content.id'
+ selection=commitSearchRepository}}
+ </span>
+ {{input action="searchCommit" placeholder="Name or email" value=commitSearchKeyword}}
+ </form>
+
</ins><span class="cx"> </section>
</span><span class="cx"> {{/each}}
</span><span class="cx"> </script>
</span><span class="lines">@@ -258,7 +272,7 @@
</span><span class="cx"> </script>
</span><span class="cx">
</span><span class="cx"> <script type="text/x-handlebars" data-template-name="close-button">
</span><del>- <svg class="close-button" viewBox="0 0 100 100">
</del><ins>+ <svg class="close-button icon-button" viewBox="0 0 100 100">
</ins><span class="cx"> <g stroke="black" stroke-width="10">
</span><span class="cx"> <circle cx="50" cy="50" r="45" fill="transparent"/>
</span><span class="cx"> <polygon points="30,30 70,70" />
</span><span class="lines">@@ -267,6 +281,15 @@
</span><span class="cx"> </svg>
</span><span class="cx"> </script>
</span><span class="cx">
</span><ins>+ <script type="text/x-handlebars" data-template-name="search-button">
+ <svg class="search-button icon-button" viewBox="0 0 100 100">
+ <g stroke="black" stroke-width="15">
+ <circle cx="60" cy="40" r="30" fill="transparent"/>
+ <line x1="10" y1="90" x2="40" y2="60"/>
+ </g>
+ </svg>
+ </script>
+
</ins><span class="cx"> <script type="text/x-handlebars" data-template-name="spinner">
</span><span class="cx"> <svg class="spinner" viewBox="0 0 100 100">
</span><span class="cx"> <line x1="10" y1="50" x2="30" y2="50" stroke="black" stroke-width="10" stroke-linecap="round"/>
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2manifestjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/manifest.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -147,6 +147,8 @@
</span><span class="cx"> _platformById: {},
</span><span class="cx"> _metricById: {},
</span><span class="cx"> _builderById: {},
</span><ins>+ repositories: null,
+ repositoriesWithReportedCommits: null,
</ins><span class="cx"> _repositoryById: {},
</span><span class="cx"> _fetchPromise: null,
</span><span class="cx"> fetch: function ()
</span><span class="lines">@@ -190,8 +192,12 @@
</span><span class="cx"> self._builderById[builder.get('id')] = builder;
</span><span class="cx"> });
</span><span class="cx">
</span><del>- store.all('repository').forEach(function (repository) {
</del><ins>+ var repositories = store.all('repository');
+ repositories.forEach(function (repository) {
</ins><span class="cx"> self._repositoryById[repository.get('id')] = repository;
</span><span class="cx"> });
</span><ins>+ this.set('repositories', repositories);
+ this.set('repositoriesWithReportedCommits',
+ repositories.filter(function (repository) { return repository.get('hasReportedCommits'); }));
</ins><span class="cx"> }
</span><span class="cx"> }).create();
</span></span></pre>
</div>
</div>
</body>
</html>