v3 UI should show and link the build number on charts page
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Dec 2015 00:37:50 +0000 (00:37 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Dec 2015 00:37:50 +0000 (00:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152359

Reviewed by Chris Dumez.

Show the hyperlinked build number in the v3 UI.

* public/v3/models/builder.js:
(Builder): Renamed _buildURL to _buildUrlTemplate.
(Builder.prototype.urlForBuild): Added.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView):
(ChartPaneStatusView.prototype.render): Added the code to render hyperlinked build number when one is available.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Store currentPoint's measurement object as _buildInfo
if the current point is set by an indicator (not by a selection).

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

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/v3/models/builder.js
Websites/perf.webkit.org/public/v3/pages/chart-pane-status-view.js

index 7f22612..6838589 100644 (file)
@@ -1,5 +1,23 @@
 2015-12-16  Ryosuke Niwa  <rniwa@webkit.org>
 
+        v3 UI should show and link the build number on charts page
+        https://bugs.webkit.org/show_bug.cgi?id=152359
+
+        Reviewed by Chris Dumez.
+
+        Show the hyperlinked build number in the v3 UI.
+
+        * public/v3/models/builder.js:
+        (Builder): Renamed _buildURL to _buildUrlTemplate.
+        (Builder.prototype.urlForBuild): Added.
+        * public/v3/pages/chart-pane-status-view.js:
+        (ChartPaneStatusView):
+        (ChartPaneStatusView.prototype.render): Added the code to render hyperlinked build number when one is available.
+        (ChartPaneStatusView.prototype.computeChartStatusLabels): Store currentPoint's measurement object as _buildInfo
+        if the current point is set by an indicator (not by a selection).
+
+2015-12-16  Ryosuke Niwa  <rniwa@webkit.org>
+
         v3 dashboard doesn't stretch charts to fill the screen
         https://bugs.webkit.org/show_bug.cgi?id=152354
 
index d6523b4..1de00db 100644 (file)
@@ -3,6 +3,13 @@ class Builder extends LabeledObject {
     constructor(id, object)
     {
         super(id, object);
-        this._buildURL = object.buildUrl;
+        this._buildUrlTemplate = object.buildUrl;
+    }
+
+    urlForBuild(buildNumber)
+    {
+        if (!this._buildUrlTemplate)
+            return null;
+        return this._buildUrlTemplate.replace(/\$builderName/g, this.name()).replace(/\$buildNumber/g, buildNumber);
     }
 }
index 3292109..02f7e26 100644 (file)
@@ -6,6 +6,10 @@ class ChartPaneStatusView extends ChartStatusView {
         super(metric, chart);
 
         this._router = router;
+
+        this._buildLabel = null;
+        this._buildUrl = null;
+
         this._revisionList = [];
         this._currentRepository = null;
         this._revisionCallback = revisionCallback;
@@ -31,8 +35,8 @@ class ChartPaneStatusView extends ChartStatusView {
         var element = ComponentBase.createElement;
         var link = ComponentBase.createLink;
         var self = this;
-        this.renderReplace(this.content().querySelector('.chart-pane-revisions'),
-            this._revisionList.map(function (info, rowIndex) {
+        var buildInfo = this._buildInfo;
+        var tableContent = this._revisionList.map(function (info, rowIndex) {
             var selected = info.repository == self._currentRepository;
             var action = function () {
                 if (self._currentRepository == info.repository)
@@ -46,7 +50,25 @@ class ChartPaneStatusView extends ChartStatusView {
                 element('td', info.url ? link(info.label, info.label, info.url, true) : info.label),
                 element('td', {class: 'commit-viewer-opener'}, link('\u00BB', action)),
             ]);
-        }));
+        });
+
+        if (this._buildInfo) {
+            var number = this._buildInfo.buildNumber();
+            var builder = Builder.findById(this._buildInfo.builderId());
+            var url = null;
+            if (builder)
+                url = builder.urlForBuild(number);
+            var buildTime = this._buildInfo.formattedBuildTime();
+
+            tableContent.unshift(element('tr', [
+                element('td', 'Build'),
+                element('td', {colspan: 2}, [
+                    url ? link(number, `Build ${number} on "${builder.name()}"`, url, true) : number,
+                    ` (${buildTime})`]),
+            ]));
+        }
+
+        this.renderReplace(this.content().querySelector('.chart-pane-revisions'), tableContent);
     }
 
     setCurrentRepository(repository)
@@ -102,26 +124,31 @@ class ChartPaneStatusView extends ChartStatusView {
     {
         super.computeChartStatusLabels(currentPoint, previousPoint);
 
-        if (!currentPoint || !currentPoint.measurement) {
-            this._revisionList = [];
-            this._analyzeData = null;
+        this._buildInfo = null;
+        this._revisionList = [];
+        this._analyzeData = null;
+
+        if (!currentPoint)
             return;
-        }
-        
+
+        var currentMeasurement = currentPoint.measurement();
+        if (!currentMeasurement)
+            return;
+
+        if (!this._chart.currentSelection() && currentMeasurement)
+            this._buildInfo = currentMeasurement;
+
         if (currentPoint && previousPoint && this._chart.currentSelection()) {
             this._analyzeData = {
                 startPointId: previousPoint.id,
                 endPointId: currentPoint.id,
             };
-        } else
-            this._analyzeData = null;
+        }
 
         // FIXME: Rewrite the interface to obtain the list of revision changes.
         var previousMeasurement = previousPoint ? previousPoint.measurement() : null;
-        var currentMeasurement = currentPoint.measurement();
 
         var revisions = currentMeasurement.formattedRevisions(previousMeasurement);
-
         var revisionList = [];
         for (var repositoryId in revisions) {
             var repository = Repository.findById(repositoryId);