Title: [198499] trunk/Websites/perf.webkit.org
Revision
198499
Author
rn...@webkit.org
Date
2016-03-21 13:54:27 -0700 (Mon, 21 Mar 2016)

Log Message

v3 UI sometimes don't update the list of revisions on the commit log viewer
https://bugs.webkit.org/show_bug.cgi?id=155729

Rubber-stamped by Chris Dumez.

Fixed multiple bugs that were affecting the list of blame range and commit logs for the range weren't
updated in some cases on v3 UI. Also, the commit log viewer state is now a part of the URL state so
opening and closing the commit log viewer will persist across page loads.

Also fixed a regression from r198479 that Test object can't be created for a top level test.

* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype.configure):
(ChartPaneBase.prototype._mainSelectionDidChange): Fixed the bug that the list of blame range nor the
commit log viewer don't get updated when the selected range changes.
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateStatus): Extracted from _indicatorDidChange and _didFetchData.
(ChartPaneBase.prototype._requestOpeningCommitViewer): Renamed from _openCommitViewer.

* public/v3/components/chart-status-view.js:
(ChartStatusView.prototype.updateStatusIfNeeded): Fixed the bug that the blame range doesn't get set
on the initial page load when the selection range is set but the chart data hadn't been fetched yet.

* public/v3/components/commit-log-viewer.js:
(CommitLogViewer.prototype.view): Fixed the bug that we don't clear out the old list of commits while
loading the next set of commits to show as it looked as if the list was never updated.
(CommitLogViewer.prototype.render): Fixed the bug that the view always show the last repository name
even if there were nothing being fetched or commits to show.

* public/v3/components/pane-selector.js:
(PaneSelector.prototype.focus): Removed superfluous call to console.log.

* public/v3/models/data-model.js:
(DataModelObject.listForStaticMap): Generalized the code for all to fix the bug in Test.
(DataModelObject.all):

* public/v3/models/test.js:
(Test): Fixed the bug that this code was relying on the static map to be an array.
(Test.topLevelTests): Use newly added listForStaticMap to convert the dictionary to an array.

* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): Always initialize _usedRevisionRange as a triple to simplify code elsewhere.
(ChartPaneStatusView.prototype.render): Invoke _revisionCallback when user clicks on a repository
expansion mark (>>). Also fixed click handler from the row since this made selecting revision range
on the view cumbersome. Now user has to explicitly click on the expansion mark (>>).
(ChartPaneStatusView.prototype._setRevisionRange): Now takes shouldNotify, from, and to as arguments
as this function must not invoke_revisionCallback inside _updateRevisionListForNewCurrentRepository.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Use newly added setCurrentRepository
instead of manually invoking setCurrentRepository and updateRevisionListWithNotification.
(ChartPaneStatusView.prototype.setCurrentRepository): Fixed the bug that we weren't updating the
blame list here.
(ChartPaneStatusView.prototype.updateRevisionList): Renamed from updateRevisionListWithNotification
since we no longer call _revisionCallback. In general, callbacks are only meant to communicate user
initiated actions, and not program induced updates like this API so this was a bad pattern anyway.
ChartPane now explicitly updates the commit log viewer instead of relying on this function calling
_requestOpeningCommitViewer implicitly.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Extracted from
updateRevisionListWithNotification so that setCurrentRepository can also call this function.

* public/v3/pages/chart-pane.js:
(ChartPane.prototype._requestOpeningCommitViewer): Overrides ChartPaneBase's method. Open the same
repository in other panes via ChartsPage.setOpenRepository.
(ChartPane.prototype.setOpenRepository): This method is called when the user selected a repository in
another pane. Open the same repository in this pane if it wasn't already open.

* public/v3/pages/charts-page.js:
(ChartsPage): Added this._currentRepositoryId.
(ChartsPage.prototype.serializeState): Serialize _currentRepositoryId.
(ChartsPage.prototype.updateFromSerializedState): Set the commit log viewer's 
(ChartsPage.prototype.setOpenRepository): Added.

* tests/api-measurement-set.js: Fixed a test after r198479.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (198498 => 198499)


--- trunk/Websites/perf.webkit.org/ChangeLog	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2016-03-21 20:54:27 UTC (rev 198499)
@@ -1,5 +1,81 @@
 2016-03-21  Ryosuke Niwa  <rn...@webkit.org>
 
+        v3 UI sometimes don't update the list of revisions on the commit log viewer
+        https://bugs.webkit.org/show_bug.cgi?id=155729
+
+        Rubber-stamped by Chris Dumez.
+
+        Fixed multiple bugs that were affecting the list of blame range and commit logs for the range weren't
+        updated in some cases on v3 UI. Also, the commit log viewer state is now a part of the URL state so
+        opening and closing the commit log viewer will persist across page loads.
+
+        Also fixed a regression from r198479 that Test object can't be created for a top level test.
+
+        * public/v3/components/chart-pane-base.js:
+        (ChartPaneBase.prototype.configure):
+        (ChartPaneBase.prototype._mainSelectionDidChange): Fixed the bug that the list of blame range nor the
+        commit log viewer don't get updated when the selected range changes.
+        (ChartPaneBase.prototype._indicatorDidChange):
+        (ChartPaneBase.prototype._didFetchData):
+        (ChartPaneBase.prototype._updateStatus): Extracted from _indicatorDidChange and _didFetchData.
+        (ChartPaneBase.prototype._requestOpeningCommitViewer): Renamed from _openCommitViewer.
+
+        * public/v3/components/chart-status-view.js:
+        (ChartStatusView.prototype.updateStatusIfNeeded): Fixed the bug that the blame range doesn't get set
+        on the initial page load when the selection range is set but the chart data hadn't been fetched yet.
+
+        * public/v3/components/commit-log-viewer.js:
+        (CommitLogViewer.prototype.view): Fixed the bug that we don't clear out the old list of commits while
+        loading the next set of commits to show as it looked as if the list was never updated.
+        (CommitLogViewer.prototype.render): Fixed the bug that the view always show the last repository name
+        even if there were nothing being fetched or commits to show.
+
+        * public/v3/components/pane-selector.js:
+        (PaneSelector.prototype.focus): Removed superfluous call to console.log.
+
+        * public/v3/models/data-model.js:
+        (DataModelObject.listForStaticMap): Generalized the code for all to fix the bug in Test.
+        (DataModelObject.all):
+
+        * public/v3/models/test.js:
+        (Test): Fixed the bug that this code was relying on the static map to be an array.
+        (Test.topLevelTests): Use newly added listForStaticMap to convert the dictionary to an array.
+
+        * public/v3/pages/chart-pane-status-view.js:
+        (ChartPaneStatusView): Always initialize _usedRevisionRange as a triple to simplify code elsewhere.
+        (ChartPaneStatusView.prototype.render): Invoke _revisionCallback when user clicks on a repository
+        expansion mark (>>). Also fixed click handler from the row since this made selecting revision range
+        on the view cumbersome. Now user has to explicitly click on the expansion mark (>>).
+        (ChartPaneStatusView.prototype._setRevisionRange): Now takes shouldNotify, from, and to as arguments
+        as this function must not invoke_revisionCallback inside _updateRevisionListForNewCurrentRepository.
+        (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Use newly added setCurrentRepository
+        instead of manually invoking setCurrentRepository and updateRevisionListWithNotification.
+        (ChartPaneStatusView.prototype.setCurrentRepository): Fixed the bug that we weren't updating the
+        blame list here.
+        (ChartPaneStatusView.prototype.updateRevisionList): Renamed from updateRevisionListWithNotification
+        since we no longer call _revisionCallback. In general, callbacks are only meant to communicate user
+        initiated actions, and not program induced updates like this API so this was a bad pattern anyway.
+        ChartPane now explicitly updates the commit log viewer instead of relying on this function calling
+        _requestOpeningCommitViewer implicitly.
+        (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Extracted from
+        updateRevisionListWithNotification so that setCurrentRepository can also call this function.
+
+        * public/v3/pages/chart-pane.js:
+        (ChartPane.prototype._requestOpeningCommitViewer): Overrides ChartPaneBase's method. Open the same
+        repository in other panes via ChartsPage.setOpenRepository.
+        (ChartPane.prototype.setOpenRepository): This method is called when the user selected a repository in
+        another pane. Open the same repository in this pane if it wasn't already open.
+
+        * public/v3/pages/charts-page.js:
+        (ChartsPage): Added this._currentRepositoryId.
+        (ChartsPage.prototype.serializeState): Serialize _currentRepositoryId.
+        (ChartsPage.prototype.updateFromSerializedState): Set the commit log viewer's 
+        (ChartsPage.prototype.setOpenRepository): Added.
+
+        * tests/api-measurement-set.js: Fixed a test after r198479.
+
+2016-03-21  Ryosuke Niwa  <rn...@webkit.org>
+
         V3 Perf Dashboard should automatically select initial range when creating a new task
         https://bugs.webkit.org/show_bug.cgi?id=155677
 

Modified: trunk/Websites/perf.webkit.org/public/v3/components/chart-pane-base.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/components/chart-pane-base.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/components/chart-pane-base.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -54,7 +54,7 @@
         this._mainChart = new InteractiveTimeSeriesChart(result.sourceList, mainOptions);
         this.renderReplace(this.content().querySelector('.chart-pane-main'), this._mainChart);
 
-        this._mainChartStatus = new ChartPaneStatusView(result.metric, this._mainChart, this._openCommitViewer.bind(this));
+        this._mainChartStatus = new ChartPaneStatusView(result.metric, this._mainChart, this._requestOpeningCommitViewer.bind(this));
         this.renderReplace(this.content().querySelector('.chart-pane-details'), this._mainChartStatus);
 
         this.content().querySelector('.chart-pane').addEventListener('keyup', this._keyup.bind(this));
@@ -97,7 +97,7 @@
 
     _mainSelectionDidChange(selection, didEndDrag)
     {
-        this.render();
+        this._updateStatus();
     }
 
     _mainSelectionDidZoom(selection)
@@ -109,13 +109,18 @@
 
     _indicatorDidChange(indicatorID, isLocked)
     {
-        this._mainChartStatus.updateRevisionListWithNotification();
-        this.render();
+        this._updateStatus();
     }
 
     _didFetchData()
     {
-        this._mainChartStatus.updateRevisionListWithNotification();
+        this._updateStatus();
+    }
+
+    _updateStatus()
+    {
+        var range = this._mainChartStatus.updateRevisionList();
+        this._commitLogViewer.view(range.repository, range.from, range.to).then(this.render.bind(this));
         this.render();
     }
 
@@ -128,7 +133,7 @@
 
     router() { return null; }
 
-    _openCommitViewer(repository, from, to)
+    _requestOpeningCommitViewer(repository, from, to)
     {
         this._mainChartStatus.setCurrentRepository(repository);
         this._commitLogViewer.view(repository, from, to).then(this.render.bind(this));

Modified: trunk/Websites/perf.webkit.org/public/v3/components/chart-status-view.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/components/chart-status-view.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/components/chart-status-view.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -53,9 +53,9 @@
                 var data = "" selection[0], selection[1]);
                 if (!data)
                     return false;
-                this._usedSelection = selection;
 
                 if (data && data.length > 1) {
+                    this._usedSelection = selection;
                     currentPoint = data[data.length - 1];
                     previousPoint = data[0];
                 }

Modified: trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -20,15 +20,17 @@
             this._repository = null;
             return Promise.resolve(null);
         }
-        
+
+        this._repository = repository;
+
         if (!to) {
             this._fetchingPromise = null;
+            this.render();
             return Promise.resolve(null);
         }
 
         var promise = CommitLog.fetchBetweenRevisions(repository, from || to, to);
 
-        this._repository = repository;
         this._fetchingPromise = promise;
 
         var self = this;
@@ -42,6 +44,11 @@
                 return;
             self._fetchingPromise = null;
             self._commits = commits;
+        }, function (error) {
+            if (self._fetchingPromise != promise)
+                return;
+            self._fetchingPromise = null;
+            self._commits = null;
         });
 
         return this._fetchingPromise;
@@ -49,8 +56,10 @@
 
     render()
     {
-        if (this._repository)
-            this.content().querySelector('caption').textContent = this._repository.name();
+        var caption = '';
+        if (this._repository && (this._commits || this._fetchingPromise))
+            caption = this._repository.name();
+        this.content().querySelector('caption').textContent = caption;
 
         var element = ComponentBase.createElement;
         var link = ComponentBase.createLink;

Modified: trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/components/pane-selector.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -23,7 +23,6 @@
     focus()
     {
         var select = this.content().querySelector('select');
-        console.log(select);
         if (select) {
             if (select.selectedIndex < 0)
                 select.selectedIndex = 0;

Modified: trunk/Websites/perf.webkit.org/public/v3/models/data-model.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/models/data-model.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/models/data-model.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -47,10 +47,10 @@
         return idMap ? idMap[id] : null;
     }
 
-    static all()
+    static listForStaticMap(name)
     {
         var list = [];
-        var idMap = this.namedStaticMap('id');
+        var idMap = this.namedStaticMap(name);
         if (idMap) {
             for (var id in idMap)
                 list.push(idMap[id]);
@@ -58,6 +58,8 @@
         return list;
     }
 
+    static all() { return this.listForStaticMap('id'); }
+
     static cachedFetch(path, params, noCache)
     {
         var query = [];

Modified: trunk/Websites/perf.webkit.org/public/v3/models/test.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/models/test.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/models/test.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -10,10 +10,10 @@
         this._metrics = [];
 
         if (isTopLevel)
-            this.ensureNamedStaticMap('topLevelTests').push(this);
+            this.ensureNamedStaticMap('topLevelTests')[id] = this;
     }
 
-    static topLevelTests() { return this.sortByName(this.namedStaticMap('topLevelTests')); }
+    static topLevelTests() { return this.sortByName(this.listForStaticMap('topLevelTests')); }
 
     parentTest() { return this._parent; }
 

Modified: trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane-status-view.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane-status-view.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane-status-view.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -16,7 +16,7 @@
         this._renderedRevisionList = null;
         this._renderedRepository = null;
 
-        this._usedRevisionRange = null;
+        this._usedRevisionRange = [null, null, null];
     }
 
     pointsRangeForAnalysis() { return this._pointsRangeForAnalysis; }
@@ -38,12 +38,12 @@
             var selected = info.repository == self._currentRepository;
             var action = "" () {
                 if (self._currentRepository == info.repository)
-                    self._setRevisionRange(null, null, null);
+                    self._setRevisionRange(true, null, null, null);
                 else
-                    self._setRevisionRange(info.repository, info.from, info.to);
+                    self._setRevisionRange(true, info.repository, info.from, info.to);
             };
 
-            return element('tr', {class: selected ? 'selected' : '', onclick: action}, [
+            return element('tr', {class: selected ? 'selected' : ''}, [
                 element('td', info.repository.name()),
                 element('td', info.url ? link(info.label, info.label, info.url, true) : info.label),
                 element('td', {class: 'commit-viewer-opener'}, link('\u00BB', action)),
@@ -74,16 +74,17 @@
     setCurrentRepository(repository)
     {
         this._currentRepository = repository;
-        this._forceRender = true;
+        return this._updateRevisionListForNewCurrentRepository();
     }
 
-    _setRevisionRange(repository, from, to)
+    _setRevisionRange(shouldNotify, repository, from, to)
     {
-        if (this._usedRevisionRange && this._usedRevisionRange[0] == repository
+        if (this._usedRevisionRange[0] == repository
             && this._usedRevisionRange[1] == from && this._usedRevisionRange[2] == to)
             return;
         this._usedRevisionRange = [repository, from, to];
-        this._revisionCallback(repository, from, to);
+        if (shouldNotify)
+            this._revisionCallback(repository, from, to);
     }
 
     moveRepositoryWithNotification(forward)
@@ -99,26 +100,32 @@
         if (newIndex == index)
             return false;
 
-        var info = this._revisionList[newIndex];
-        this.setCurrentRepository(info.repository);
-        this.updateRevisionListWithNotification();
+        var item = this._revisionList[newIndex];
+        this.setCurrentRepository(item ? item.repository : null);
+
+        return true;
     }
 
-    updateRevisionListWithNotification()
+    updateRevisionList()
     {
         if (!this._currentRepository)
-            return;
+            return {repository: null, from: null, to: null};
+        return this._updateRevisionListForNewCurrentRepository();
+    }
 
+    _updateRevisionListForNewCurrentRepository()
+    {
         this.updateStatusIfNeeded();
 
         this._forceRender = true;
         for (var info of this._revisionList) {
             if (info.repository == this._currentRepository) {
-                this._setRevisionRange(info.repository, info.from, info.to);
-                return;
+                this._setRevisionRange(false, info.repository, info.from, info.to);
+                return {repository: info.repository, from: info.from, to: info.to};
             }
         }
-        this._setRevisionRange(this._currentRepository, null, null);
+        this._setRevisionRange(false, null, null, null);
+        return {repository: this._currentRepository, from: null, to: null};
     }
 
     computeChartStatusLabels(currentPoint, previousPoint)

Modified: trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/pages/chart-pane.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -65,6 +65,21 @@
 
     router() { return this._chartsPage.router(); }
 
+    _requestOpeningCommitViewer(repository, from, to)
+    {
+        super._requestOpeningCommitViewer(repository, from, to);
+        this._chartsPage.setOpenRepository(repository);
+    }
+
+    setOpenRepository(repository)
+    {
+        if (repository != this._commitLogViewer.currentRepository()) {
+            var range = this._mainChartStatus.setCurrentRepository(repository);
+            this._commitLogViewer.view(repository, range.from, range.to).then(this.render.bind(this));
+            this.render();
+        }
+    }
+
     _indicatorDidChange(indicatorID, isLocked)
     {
         this._mainChartIndicatorWasLocked = isLocked;

Modified: trunk/Websites/perf.webkit.org/public/v3/pages/charts-page.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/public/v3/pages/charts-page.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/public/v3/pages/charts-page.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -7,6 +7,7 @@
         this._paneList = [];
         this._paneListChanged = false;
         this._mainDomain = null;
+        this._currentRepositoryId = null;
 
         toolbar.setAddPaneCallback(this.insertPaneAfter.bind(this));
     }
@@ -54,6 +55,10 @@
         if (serializedPaneList.length)
             state['paneList'] = serializedPaneList;
 
+        var repository = this._currentRepositoryId;
+        if (repository)
+            state['repository'] = this._currentRepositoryId;
+
         return state;
     }
 
@@ -72,9 +77,14 @@
 
         this._updateDomainsFromSerializedState(state);
 
+        this._currentRepositoryId = parseInt(state['repository']);
+        var currentRepository = Repository.findById(this._currentRepositoryId);
+
         console.assert(this._paneList.length == paneList.length);
-        for (var i = 0; i < this._paneList.length; i++)
+        for (var i = 0; i < this._paneList.length; i++) {
             this._paneList[i].updateFromSerializedState(state.paneList[i], isOpen);
+            this._paneList[i].setOpenRepository(currentRepository);
+        }
     }
 
     _updateDomainsFromSerializedState(state)
@@ -168,6 +178,14 @@
             this.scheduleUrlStateUpdate();
     }
 
+    setOpenRepository(repository)
+    {
+        this._currentRepositoryId = repository ? repository.id() : null;
+        for (var pane of this._paneList)
+            pane.setOpenRepository(repository);
+        this.scheduleUrlStateUpdate();
+    }
+
     _updateOverviewDomain()
     {
         var startTime = this.toolbar().startTime();

Modified: trunk/Websites/perf.webkit.org/tests/api-measurement-set.js (198498 => 198499)


--- trunk/Websites/perf.webkit.org/tests/api-measurement-set.js	2016-03-21 20:23:23 UTC (rev 198498)
+++ trunk/Websites/perf.webkit.org/tests/api-measurement-set.js	2016-03-21 20:54:27 UTC (rev 198499)
@@ -304,7 +304,7 @@
                            sum: 65,
                            squareSum: 855,
                            markedOutlier: false,
-                           revisions: [[repositoryId, '144000', revisionTime]],
+                           revisions: [[1, repositoryId, '144000', revisionTime]],
                            commitTime: revisionTime,
                            buildTime: revisionBuildTime,
                            buildNumber: '124' });
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to