2017-01-16 00:12:22 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2017-03-21 01:19:39 +00:00
|
|
|
<meta charset="utf-8">
|
2017-01-19 22:58:46 +00:00
|
|
|
<title>In-Browser Tests for Performance Dashboard</title>
|
2017-03-21 01:19:39 +00:00
|
|
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
|
|
|
|
<script src="../node_modules/mocha/mocha.js"></script>
|
2017-02-17 05:36:05 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/expect.js/0.2.0/expect.min.js"></script>
|
2017-01-16 00:12:22 +00:00
|
|
|
<script>
|
|
|
|
|
|
|
|
mocha.setup('bdd');
|
|
|
|
|
|
|
|
</script>
|
2017-02-17 09:15:55 +00:00
|
|
|
<script src="../unit-tests/resources/mock-remote-api.js"></script>
|
2017-01-16 00:12:22 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="mocha"></div>
|
2018-05-02 06:16:16 +00:00
|
|
|
<script src="async-task-tests.js"></script>
|
2017-01-16 00:12:22 +00:00
|
|
|
<script src="component-base-tests.js"></script>
|
2018-01-29 20:31:06 +00:00
|
|
|
<script src="page-tests.js"></script>
|
2018-01-31 23:41:37 +00:00
|
|
|
<script src="page-router-tests.js"></script>
|
2017-01-19 22:58:46 +00:00
|
|
|
<script src="close-button-tests.js"></script>
|
2017-01-26 04:00:41 +00:00
|
|
|
<script src="editable-text-tests.js"></script>
|
2017-02-17 09:15:55 +00:00
|
|
|
<script src="time-series-chart-tests.js"></script>
|
2017-02-28 04:48:36 +00:00
|
|
|
<script src="interactive-time-series-chart-tests.js"></script>
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
<script src="chart-status-evaluator-tests.js"></script>
|
|
|
|
<script src="chart-revision-range-tests.js"></script>
|
2017-03-21 01:19:39 +00:00
|
|
|
<script src="commit-log-viewer-tests.js"></script>
|
2017-04-12 04:37:38 +00:00
|
|
|
<script src="test-group-form-tests.js"></script>
|
2019-01-17 05:56:18 +00:00
|
|
|
<script src="custom-analysis-task-configurator-tests.js"></script>
|
2018-11-07 05:58:15 +00:00
|
|
|
<script src="customizable-test-group-form-tests.js"></script>
|
Add the basic support for writing components in node.js
https://bugs.webkit.org/show_bug.cgi?id=186299
Reviewed by Antti Koivisto.
Add the basic support for writing components in node.js for generating rich email notifications.
To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API
to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend
and the backend in the future. Because there is no support for declarative custom elements or
shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree
to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and
MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order
to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of
CSS selectors to select elements by their local names and class names.
Specifically, each class name and element name based selectors are replaced by a globally unique
class name based selector, and each element which matches the selector is applied of the same
globally unique class name. The transformation is applied when constructing the "content" tree
as well as calls to renderReplace.
Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form
of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid
reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates
to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in
both frontend & backend.
* browser-tests/close-button-tests.js: Include CommonComponentBase.
* browser-tests/commit-log-viewer-tests.js: Ditto.
* browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates.
(async.importComponentBase): Added.
* browser-tests/editable-text-tests.js: Include CommonComponentBase.
* browser-tests/index.html:
* browser-tests/markup-page-tests.js: Added.
* browser-tests/page-router-tests.js: Include CommonComponentBase.
* browser-tests/page-tests.js: Ditto.
* browser-tests/test-group-form-tests.js: Ditto.
* public/shared/common-component-base.js: Added.
(CommonComponentBase): Extracted out of ComponentBase.
(CommonComponentBase.prototype.renderReplace): Added.
(CommonComponentBase.renderReplace): Moved from ComponentBase.
(CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from
ComponentBase's _recursivelyReplaceUnknownElementsByComponents.
(CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function.
(CommonComponentBase._constructStylesheetFromTemplate): Added.
(CommonComponentBase._constructNodeTreeFromTemplate): Added.
(CommonComponentBase.prototype.createElement): Added.
(CommonComponentBase.createElement): Moved from ComponentBase.
(CommonComponentBase._addContentToElement): Moved from ComponentBase.
(CommonComponentBase.prototype.createLink): Added.
(CommonComponentBase.createLink): Moved from ComponentBase.
(CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js.
(CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check.
(CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase.
* public/v3/components/base.js:
(ComponentBase):
(ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates.
Also avoid parsing the html template each time a component is instantiated by caching the result.
* public/v3/index.html:
* tools/js/markup-component.js: Added.
(MarkupDocument): Added. A fake Document.
(MarkupDocument.prototype.createContentRoot): A substitude for attachShadow.
(MarkupDocument.prototype.createElement):
(MarkupDocument.prototype.createTextNode):
(MarkupDocument.prototype._idForClone):
(MarkupDocument.prototype.reset):
(MarkupDocument.prototype.markup):
(MarkupDocument.prototype.escapeAttributeValue):
(MarkupDocument.prototype.escapeNodeData):
(MarkupNode): Added. A fake Node. Each node gets an unique ID.
(MarkupNode.prototype._markup):
(MarkupNode.prototype.clone): Implemented by the leave class.
(MarkupNode.prototype._cloneNodeData):
(MarkupNode.prototype.remove):
(MarkupParentNode): Added. An equivalent of ContainerNode in WebCore.
(MarkupParentNode.prototype.get childNodes):
(MarkupParentNode.prototype._cloneNodeData):
(MarkupParentNode.prototype.appendChild):
(MarkupParentNode.prototype.removeChild):
(MarkupParentNode.prototype.removeAllChildren):
(MarkupParentNode.prototype.replaceChild):
(MarkupContentRoot): Added. Used like a shadow tree.
(MarkupContentRoot.prototype._markup): Added.
(MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by
subclasses such as HTMLInputElement for simplicity.
(MarkupElement.prototype.get id): Added.
(MarkupElement.prototype.get localName): Added.
(MarkupElement.prototype.clone): Added.
(MarkupElement.prototype.appendChild): Added.
(MarkupElement.prototype.addEventListener): Added.
(MarkupElement.prototype.setAttribute): Added.
(MarkupElement.prototype.getAttribute): Added.
(MarkupElement.prototype.get attributes): Added.
(MarkupElement.prototype.get textContent): Added.
(MarkupElement.prototype.set textContent): Added.
(MarkupElement.prototype._serializeStyle): Added.
(MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so
this can't be used to implement innerHTML.
(MarkupElement.prototype.get value): Added.
(MarkupElement.prototype.set value): Added.
(MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration.
(MarkupElement.prototype.set style): Added.
(MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation.
(MarkupText): Added.
(MarkupText.prototype.clone): Added.
(MarkupText.prototype._markup): Added.
(MarkupText.prototype.get data): Added.
(MarkupText.prototype.set data): Added.
(MarkupComponentBase): Added.
(MarkupComponentBase.prototype.element): Added. Like ComponentBase's element.
(MarkupComponentBase.prototype.content): Added. Like ComponentBase's content.
(MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById.
(MarkupComponentBase.prototype.render): Added. Like ComponentBase's render.
(MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame.
In MarkupComponentBase, we keep rendering until the queue drains empty.
(MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies
the transformation of classes to workaround the lack of shadow tree support in scriptless HTML.
(MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation.
(MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree.
(MarkupComponentBase.reset): Added.
(MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the
transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be
unique across all components. The function to apply the necessary changes to an element is saved in
the global map of components, and later used in renderReplace via _applyStyleOverrides.
(MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement.
(MarkupComponentBase.prototype.createEventHandler): Added.
(MarkupComponentBase.createEventHandler): Added.
(MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body.
(MarkupPage.prototype.pageTitle): Added.
(MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would
be the content of the body element as opposed to the html element for the connivance of subclasses,
and to match the behavior of the frontend Page class.
(MarkupPage.prototype.render): Added.
(MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of
all components used.
(MarkupPage.get contentTemplate): Added.
(MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and
generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after
all subcomponent had finished rendering.
* unit-tests/markup-component-base-tests.js: Added.
* unit-tests/markup-element-tests.js: Added.
(.createElement): Added.
* unit-tests/markup-page-tests.js: Added.
Canonical link: https://commits.webkit.org/201761@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
|
|
|
<script src="markup-page-tests.js"></script>
|
2018-06-08 03:44:28 +00:00
|
|
|
<script src="test-group-result-page-tests.js"></script>
|
2017-01-16 00:12:22 +00:00
|
|
|
<script>
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
BrowsingContext.cleanup();
|
|
|
|
});
|
|
|
|
|
|
|
|
class BrowsingContext {
|
|
|
|
|
|
|
|
constructor()
|
|
|
|
{
|
|
|
|
let iframe = document.createElement('iframe');
|
|
|
|
document.body.appendChild(iframe);
|
|
|
|
iframe.style.position = 'absolute';
|
|
|
|
iframe.style.left = '0px';
|
|
|
|
iframe.style.top = '0px';
|
|
|
|
BrowsingContext._iframes.push(iframe);
|
|
|
|
|
2017-03-22 22:50:57 +00:00
|
|
|
// Expedite calls to callbacks to make tests go faster.
|
|
|
|
iframe.contentWindow.requestAnimationFrame = (callback) => setTimeout(callback, 0);
|
|
|
|
|
2021-03-07 02:25:25 +00:00
|
|
|
// Allow markup-component.js to function.
|
|
|
|
iframe.contentWindow.require = (module) => {
|
|
|
|
expect(module).to.be('assert');
|
|
|
|
return {
|
|
|
|
ok: (condition) => expect(!!condition).to.be(true)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-02-17 09:15:55 +00:00
|
|
|
this.iframe = iframe;
|
2017-01-16 00:12:22 +00:00
|
|
|
this.symbols = {};
|
2017-02-17 09:15:55 +00:00
|
|
|
this.global = this.iframe.contentWindow;
|
|
|
|
this.document = this.iframe.contentDocument;
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
this._didLoadMockRemote = false;
|
2017-01-16 00:12:22 +00:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:22:39 +00:00
|
|
|
importScripts(pathList, ...symbolList)
|
2017-01-16 00:12:22 +00:00
|
|
|
{
|
2017-02-17 09:15:55 +00:00
|
|
|
const doc = this.iframe.contentDocument;
|
|
|
|
const global = this.iframe.contentWindow;
|
2017-01-18 21:22:39 +00:00
|
|
|
|
2017-02-17 09:15:55 +00:00
|
|
|
pathList = pathList.map((path) => `../public/v3/${path}`);
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
if (!this._didLoadMockRemote) {
|
|
|
|
this._didLoadMockRemote = true;
|
|
|
|
pathList.unshift('../unit-tests/resources/mock-remote-api.js');
|
|
|
|
}
|
2017-02-17 09:15:55 +00:00
|
|
|
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
return Promise.all(pathList.map((path) => {
|
2017-01-18 21:22:39 +00:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
let script = doc.createElement('script');
|
|
|
|
script.addEventListener('load', resolve);
|
|
|
|
script.addEventListener('error', reject);
|
2017-02-17 09:15:55 +00:00
|
|
|
script.src = path;
|
2017-01-19 22:58:46 +00:00
|
|
|
script.async = false;
|
2017-01-18 21:22:39 +00:00
|
|
|
doc.body.appendChild(script);
|
|
|
|
});
|
|
|
|
})).then(() => {
|
2017-01-16 00:12:22 +00:00
|
|
|
const script = doc.createElement('script');
|
|
|
|
script.textContent = `window.importedSymbols = [${symbolList.join(', ')}];`;
|
2017-02-17 09:15:55 +00:00
|
|
|
global.RemoteAPI = global.MockRemoteAPI;
|
2017-01-16 00:12:22 +00:00
|
|
|
doc.body.appendChild(script);
|
|
|
|
|
|
|
|
const importedSymbols = global.importedSymbols;
|
|
|
|
for (let i = 0; i < symbolList.length; i++)
|
|
|
|
this.symbols[symbolList[i]] = importedSymbols[i];
|
|
|
|
|
|
|
|
return symbolList.length == 1 ? importedSymbols[0] : importedSymbols;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-01-18 21:22:39 +00:00
|
|
|
importScript(path, ...symbols)
|
2017-01-16 00:12:22 +00:00
|
|
|
{
|
2017-01-18 21:22:39 +00:00
|
|
|
return this.importScripts([path], ...symbols);
|
2017-01-16 00:12:22 +00:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:22:39 +00:00
|
|
|
static cleanup()
|
2017-01-16 00:12:22 +00:00
|
|
|
{
|
2017-01-18 21:22:39 +00:00
|
|
|
BrowsingContext._iframes.forEach((iframe) => { iframe.remove(); });
|
|
|
|
BrowsingContext._iframes = [];
|
2017-01-16 00:12:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
BrowsingContext._iframes = [];
|
|
|
|
|
2017-02-17 09:15:55 +00:00
|
|
|
function waitForComponentsToRender(context)
|
|
|
|
{
|
|
|
|
if (!context._dummyComponent) {
|
|
|
|
const ComponentBase = context.symbols.ComponentBase;
|
|
|
|
context._dummyComponent = class SomeComponent extends ComponentBase {
|
|
|
|
constructor(resolve)
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
this._resolve = resolve;
|
|
|
|
}
|
|
|
|
render() { setTimeout(this._resolve, 0); }
|
|
|
|
}
|
|
|
|
ComponentBase.defineElement('dummy-component', context._dummyComponent);
|
|
|
|
}
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
const instance = new context._dummyComponent(resolve);
|
|
|
|
context.document.body.appendChild(instance.element());
|
Add tests for InteractiveTimeSeriesChart and adopt actions
https://bugs.webkit.org/show_bug.cgi?id=168750
Reviewed by Chris Dumez.
Added tests for InteractiveTimeSeriesChart.
Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks
by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively.
Also fixed various bugs and bad code I encountered while writing these tests.
* browser-tests/index.html:
(waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there
might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let
all those promises get resolved first. Otherwise, some tests become racy.
(canvasImageData): Extracted from time-series-chart-tests.js.
(canvasRefTest): Ditto.
(CanvasTest): Ditto.
(CanvasTest.fillCanvasBeforeRedrawCheck): Ditto.
(CanvasTest.hasCanvasBeenRedrawn): Ditto.
(CanvasTest.canvasImageData): Ditto.
(CanvasTest.expectCanvasesMatch): Ditto.
(CanvasTest.expectCanvasesMismatch): Ditto.
* browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing
the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive
time series chart and one for rendering annotations.
(scripts): Moved.
(posixTime): Added. A helper function for sampleCluster.
(dayInMilliseconds): Ditto.
(sampleCluster): Moved here. Made the same cluster more artifical for an easier testing.
(createChartWithSampleCluster): Moved out of one of the tests.
(respondWithSampleCluster): Ditto.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart.
* public/v3/components/chart-status-view.js:
(ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log.
* public/v3/components/chart-styles.js:
(ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine
whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false
instead of relying on undefined to be treated as falsey.
(InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements.
(InteractiveTimeSeriesChart.htmlTemplate):
(InteractiveTimeSeriesChart.cssTemplate):
(InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false
instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found
by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender
but won't work in a standalone instance of InteractiveTimeSeriesChart.
(InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling
_mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing
call to enqueueToRender in the other code path.
(InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback
by the newly added "annotationClick" action, and added the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function.
(InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by
the newly added "indicatorChange" action.
(InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by
the newly added "selectionChange" action.
(InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton
is set instead of relying on the presence of selection.onzoom especially now that the callback has been
replaced by the "zoom" action.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender.
* public/v3/main.js:
Canonical link: https://commits.webkit.org/185800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
|
|
|
setTimeout(() => {
|
|
|
|
instance.enqueueToRender();
|
|
|
|
}, 0);
|
2017-02-17 09:15:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-07 02:25:25 +00:00
|
|
|
function waitForElementResize(element)
|
|
|
|
{
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
const observer = new ResizeObserver(() => {
|
|
|
|
observer.disconnect();
|
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
observer.observe(element);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-02-17 09:15:55 +00:00
|
|
|
function wait(milliseconds)
|
|
|
|
{
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
setTimeout(resolve, milliseconds);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
Add tests for InteractiveTimeSeriesChart and adopt actions
https://bugs.webkit.org/show_bug.cgi?id=168750
Reviewed by Chris Dumez.
Added tests for InteractiveTimeSeriesChart.
Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks
by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively.
Also fixed various bugs and bad code I encountered while writing these tests.
* browser-tests/index.html:
(waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there
might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let
all those promises get resolved first. Otherwise, some tests become racy.
(canvasImageData): Extracted from time-series-chart-tests.js.
(canvasRefTest): Ditto.
(CanvasTest): Ditto.
(CanvasTest.fillCanvasBeforeRedrawCheck): Ditto.
(CanvasTest.hasCanvasBeenRedrawn): Ditto.
(CanvasTest.canvasImageData): Ditto.
(CanvasTest.expectCanvasesMatch): Ditto.
(CanvasTest.expectCanvasesMismatch): Ditto.
* browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing
the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive
time series chart and one for rendering annotations.
(scripts): Moved.
(posixTime): Added. A helper function for sampleCluster.
(dayInMilliseconds): Ditto.
(sampleCluster): Moved here. Made the same cluster more artifical for an easier testing.
(createChartWithSampleCluster): Moved out of one of the tests.
(respondWithSampleCluster): Ditto.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart.
* public/v3/components/chart-status-view.js:
(ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log.
* public/v3/components/chart-styles.js:
(ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine
whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false
instead of relying on undefined to be treated as falsey.
(InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements.
(InteractiveTimeSeriesChart.htmlTemplate):
(InteractiveTimeSeriesChart.cssTemplate):
(InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false
instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found
by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender
but won't work in a standalone instance of InteractiveTimeSeriesChart.
(InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling
_mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing
call to enqueueToRender in the other code path.
(InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback
by the newly added "annotationClick" action, and added the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function.
(InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by
the newly added "indicatorChange" action.
(InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by
the newly added "selectionChange" action.
(InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton
is set instead of relying on the presence of selection.onzoom especially now that the callback has been
replaced by the "zoom" action.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender.
* public/v3/main.js:
Canonical link: https://commits.webkit.org/185800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
|
|
|
function canvasImageData(canvas)
|
|
|
|
{
|
|
|
|
return canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
function canvasRefTest(canvas1, canvas2, shouldMatch)
|
|
|
|
{
|
|
|
|
expect(canvas1.offsetWidth).to.be(canvas2.offsetWidth);
|
|
|
|
expect(canvas2.offsetHeight).to.be(canvas2.offsetHeight);
|
|
|
|
const data1 = canvasImageData(canvas1).data;
|
|
|
|
const data2 = canvasImageData(canvas2).data;
|
|
|
|
expect(data1.length).to.be.a('number');
|
|
|
|
expect(data1.length).to.be(data2.length);
|
|
|
|
|
|
|
|
let match = true;
|
|
|
|
for (let i = 0; i < data1.length; i++) {
|
|
|
|
if (data1[i] != data2[i]) {
|
|
|
|
match = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match == shouldMatch)
|
|
|
|
return;
|
|
|
|
|
|
|
|
[canvas1, canvas2].forEach((canvas) => {
|
|
|
|
let image = document.createElement('img');
|
|
|
|
image.src = canvas.toDataURL();
|
|
|
|
image.style.display = 'block';
|
|
|
|
document.body.appendChild(image);
|
|
|
|
});
|
|
|
|
|
|
|
|
throw new Error(shouldMatch ? 'Canvas contents were different' : 'Canvas contents were identical');
|
|
|
|
}
|
|
|
|
|
|
|
|
const CanvasTest = {
|
|
|
|
fillCanvasBeforeRedrawCheck(canvas)
|
|
|
|
{
|
|
|
|
const canvasContext = canvas.getContext('2d');
|
|
|
|
canvasContext.fillStyle = 'white';
|
|
|
|
canvasContext.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
|
},
|
|
|
|
|
|
|
|
hasCanvasBeenRedrawn(canvas)
|
|
|
|
{
|
|
|
|
return canvasImageData(canvas).data.some((value) => value != 255);
|
|
|
|
},
|
|
|
|
|
|
|
|
canvasImageData(canvas) { return canvasImageData(canvas); },
|
2017-02-24 06:57:04 +00:00
|
|
|
|
|
|
|
canvasContainsColor(canvas, color, rect = {})
|
|
|
|
{
|
|
|
|
const content = canvas.getContext('2d').getImageData(rect.x || 0, rect.y || 0, rect.width || canvas.width, rect.height || canvas.height);
|
|
|
|
let found = false;
|
|
|
|
const data = content.data;
|
|
|
|
for (let startOfPixel = 0; startOfPixel < data.length; startOfPixel += 4) {
|
|
|
|
let r = data[startOfPixel];
|
|
|
|
let g = data[startOfPixel + 1];
|
|
|
|
let b = data[startOfPixel + 2];
|
|
|
|
let a = data[startOfPixel + 3];
|
|
|
|
if (r == color.r && g == color.g && b == color.b && (color.a == undefined || a == color.a))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
Add tests for InteractiveTimeSeriesChart and adopt actions
https://bugs.webkit.org/show_bug.cgi?id=168750
Reviewed by Chris Dumez.
Added tests for InteractiveTimeSeriesChart.
Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks
by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively.
Also fixed various bugs and bad code I encountered while writing these tests.
* browser-tests/index.html:
(waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there
might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let
all those promises get resolved first. Otherwise, some tests become racy.
(canvasImageData): Extracted from time-series-chart-tests.js.
(canvasRefTest): Ditto.
(CanvasTest): Ditto.
(CanvasTest.fillCanvasBeforeRedrawCheck): Ditto.
(CanvasTest.hasCanvasBeenRedrawn): Ditto.
(CanvasTest.canvasImageData): Ditto.
(CanvasTest.expectCanvasesMatch): Ditto.
(CanvasTest.expectCanvasesMismatch): Ditto.
* browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing
the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive
time series chart and one for rendering annotations.
(scripts): Moved.
(posixTime): Added. A helper function for sampleCluster.
(dayInMilliseconds): Ditto.
(sampleCluster): Moved here. Made the same cluster more artifical for an easier testing.
(createChartWithSampleCluster): Moved out of one of the tests.
(respondWithSampleCluster): Ditto.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart.
* public/v3/components/chart-status-view.js:
(ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log.
* public/v3/components/chart-styles.js:
(ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine
whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false
instead of relying on undefined to be treated as falsey.
(InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements.
(InteractiveTimeSeriesChart.htmlTemplate):
(InteractiveTimeSeriesChart.cssTemplate):
(InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false
instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found
by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender
but won't work in a standalone instance of InteractiveTimeSeriesChart.
(InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling
_mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing
call to enqueueToRender in the other code path.
(InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback
by the newly added "annotationClick" action, and added the missing call to enqueueToRender.
(InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function.
(InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by
the newly added "indicatorChange" action.
(InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by
the newly added "selectionChange" action.
(InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton
is set instead of relying on the presence of selection.onzoom especially now that the callback has been
replaced by the "zoom" action.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender.
* public/v3/main.js:
Canonical link: https://commits.webkit.org/185800@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-23 21:39:55 +00:00
|
|
|
expectCanvasesMatch(canvas1, canvas2) { return canvasRefTest(canvas1, canvas2, true); },
|
|
|
|
expectCanvasesMismatch(canvas1, canvas2) { return canvasRefTest(canvas1, canvas2, false); },
|
|
|
|
}
|
|
|
|
|
2017-02-28 04:48:36 +00:00
|
|
|
const dayInMilliseconds = 24 * 3600 * 1000;
|
|
|
|
|
|
|
|
function posixTime(string) { return +new Date(string); }
|
|
|
|
|
|
|
|
const ChartTest = {
|
|
|
|
importChartScripts(context)
|
|
|
|
{
|
|
|
|
return context.importScripts([
|
2018-05-02 06:16:16 +00:00
|
|
|
'async-task.js',
|
2017-02-28 04:48:36 +00:00
|
|
|
'../shared/statistics.js',
|
Make it possible to view results for sub tests and metrics in A/B testing
https://bugs.webkit.org/show_bug.cgi?id=170975
Reviewed by Chris Dumez.
Replaced TestGroupResultsTable, which was a single table that presented the test results with a set of revisions
each build request used, with TestGroupResultsViewer and TestGroupRevisionTable. TestGroupResultsViewer provides
an UI to look the results of sub-tests and sub-metrics and TestGroupRevisionTable provides an UI to display
the set of revisions each build request used. TestGroupRevisionTable can also show the list of custom roots now
that we've added UI to schedule an analysis task with a custom test group.
This patch extends BarGraphGroup to show multiple bars per SingleBarGraph using a canvas with bars indicating
their mean and confidence interval.
* browser-tests/index.html:
(ChartTest.importChartScripts): Include lazily-evaluated-function.js now that Test model object uses
LazilyEvaluatedFunction.
* public/v3/components/analysis-results-viewer.js:
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus):
* public/v3/components/bar-graph-group.js:
(BarGraphGroup): No longer takes formatter. Added _computeRangeLazily and _showLabels as instance variables.
(BarGraphGroup.prototype.addBar): Now takes a list of values, their labels, mean, confidence interval, and
the colors of bar graphs shown for each value and the mean indicator.
(BarGraphGroup.prototype.showLabels): Added.
(BarGraphGroup.prototype.setShowLabels): Added.
(BarGraphGroup.prototype.range): Added.
(BarGraphGroup.prototype._computeRange): Renamed from updateGroupRendering. Now returns the range instead off
setting it to each bar, and each SingleBarGraph's render function uses the value via BarGraphGroup's range.
(BarGraph): Renamed from SingleBarGraph. Added various arguments introduced in addBar, and now stores various
lazily evaluated functions used for rendering.
(BarGraph.prototype.render): Rewritten to use canvas to draw bar graphs and show a label when group's
showLabels() returns true.
(BarGraph.prototype._resizeCanvas): Added.
(BarGraph.prototype._renderCanvas): Added.
(BarGraph.prototype._renderLabels): Added. We align the top of each label to the middle of each bar and shift it
back up by half the height of the label (0.4rem) using margin-top in css.
(BarGraph.htmlTemplate): Uses a canvas now.
(BarGraph.cssTemplate):
* public/v3/components/results-table.js:
(ResultsTable.prototype.renderTable): Updated per code changes to BarGraphGroup.
(ResultsTableRow.prototype.resultContent): Ditto.
* public/v3/components/test-group-results-table.js: Removed.
* public/v3/components/test-group-results-viewer.js: Added.
(TestGroupResultsViewer): Added. Shows a list of test results with bar graphs with mean and confidence interval
indicators. The results of sub tests and metrics can be expanded via "(Breakdown)" link shown below each test.
(TestGroupResultsViewer.prototype.setTestGroup): Added.
(TestGroupResultsViewer.prototype.setAnalysisResults): Added.
(TestGroupResultsViewer.prototype.render): Added.
(TestGroupResultsViewer.prototype._renderResultsTable): Compute the depth of the test tree we show, and construct
the header rows. Each sub test is "indented" by a new column.
(TestGroupResultsViewer.prototype._buildRowForTest): Added. Build rows for metrics of the given test. Expand the
list of its child tests if it's in expandedTests. Otherwise add a link to "Breakdown" if it has any child tests.
(TestGroupResultsViewer.prototype._buildRowForMetric): Added. Builds rows of table cells to show the results for
the given metric for each configuration.
(TestGroupResultsViewer.prototype._buildRowForMetric.createConfigurationRow): Added. A helper to build cells for
a given configuration represented by a requested commit set.
(TestGroupResultsViewer.prototype._buildValueMap): Added. Creates a mappting between a requested commit set, and
the list of values, mean, etc... associated with the results for the commit set.
(TestGroupResultsViewer.prototype._buildEmptyCells): Added. A helper to create empty cells to indent sub tests.
(TestGroupResultsViewer.prototype._expandCurrentMetrics): Added. Highlights the current metrics and renders the
label for each bar in the results.
(TestGroupResultsViewer.htmlTemplate): Added.
(TestGroupResultsViewer.cssTemplate): Added.
* public/v3/components/test-group-revision-table.js: Added.
(TestGroupRevisionTable): Added. Renders the list of revisions requested for each test configuration as well as
ones used in actual testing, and additional repositories being reported (e.g. repositories for helper scripts).
(TestGroupRevisionTable.prototype.setTestGroup): Added.
(TestGroupRevisionTable.prototype.setAnalysisResults): Added.
(TestGroupRevisionTable.prototype.render): Added.
(TestGroupRevisionTable.prototype._renderTable): Added. The basic algorithm here is to first create a row entry
object for each build request, merge cells that use the same revision of the same repository, and then render
the entire table.
(TestGroupRevisionTable.prototype._buildCommitCell): Added.
(TestGroupRevisionTable.prototype._buildCustomRootsCell): Added.
(TestGroupRevisionTable.prototype._mergeCellsWithSameCommitsAcrossRows): Added. Compute rowspan for each cell
by traversing the rows that use the same revision per repository, and store it in rowCountByRepository while
adding the repository to each succeeding row's repositoriesToSkip.
(TestGroupRevisionTable.htmlTemplate): Added.
(TestGroupRevisionTable.cssTemplate): Added.
* public/v3/index.html:
* public/v3/models/analysis-results.js:
(AnalysisResults): Added _metricIds and _lazilyComputedHighestTests as instance variables.
(AnalysisResults.prototype.findResult): Renamed from find.
(AnalysisResults.prototype.highestTests): Added.
(AnalysisResults.prototype._computeHighestTests): Added. Finds the root tests for this analysis result.
(AnalysisResults.prototype.add): Update _metricIds.
(AnalysisResults.prototype.commitSetForRequest): Added. Returns the reported commit set for the build request.
This commit set contains the set of revisions reported to /api/report by A/B testers.
(AnalysisResultsView.prototype.resultForRequest): Renamed from resultForBuildId.
* public/v3/models/metric.js:
(Metric.prototype.relativeName): Added. Computes the relative name given the test/metric path. This function is
used to determine the label for each test/metric in TestGroupResultsViewer.
(Metric.prototype.aggregatorLabel): Extracted from label.
(Metric.prototype.label):
(Metric.makeFormatter): Added the default value of false to alwaysShowSign.
* public/v3/models/test-group.js:
(TestGroup.prototype.compareTestResults): Now takes a metric instead of retrieving it from the analysis task
since a custom analysis task may not have a metric associated with it.
* public/v3/models/test.js:
(Test): Added _computePathLazily as an instance variable.
(Test.prototype.path): Lazily computes the path now that this function can be called on the same test for many
times in TestGroupResultsViewer while computing relative names of tests and metrics.
(Test.prototype._computePath): Extracted path.
(Test.prototype.fullName): Modernized the code.
(Test.prototype.relativeName): Added.
* public/v3/models/uploaded-file.js:
(UploadedFile):
(UploadedFile.prototype.deletedAt): Added.
(UploadedFile.prototype.label): Added.
(UploadedFile.prototype.url): Added.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskTestGroupPane.prototype.setTestGroups):
(AnalysisTaskTestGroupPane.prototype.setAnalysisResults): Replaced setAnalysisResultsView. Now takes an
analysisResults instead of its view.
(AnalysisTaskTestGroupPane.prototype.render): No longer enqueues the results table and the retry form to render
since the results table no longer exists, and the retry form re-renders itself as needed.
(AnalysisTaskTestGroupPane.htmlTemplate): Now uses test-group-results-viewer and test-group-revision-table
instead of test-group-results-table, which has been removed.
(AnalysisTaskTestGroupPane.cssTemplate):
(AnalysisTaskPage.prototype._assignTestResultsIfPossible):
* public/v3/pages/create-analysis-task-page.js:
(CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Removed superflous console.log's.
* tools/js/v3-models.js: Import LazilyEvaluatedFunction now that it's used in the Test model.
* unit-tests/test-model-tests.js: Added.
Canonical link: https://commits.webkit.org/188037@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-21 20:20:05 +00:00
|
|
|
'lazily-evaluated-function.js',
|
2017-02-28 04:48:36 +00:00
|
|
|
'instrumentation.js',
|
|
|
|
'models/data-model.js',
|
|
|
|
'models/time-series.js',
|
|
|
|
'models/measurement-set.js',
|
|
|
|
'models/measurement-cluster.js',
|
|
|
|
'models/measurement-adaptor.js',
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
'models/repository.js',
|
|
|
|
'models/platform.js',
|
|
|
|
'models/test.js',
|
|
|
|
'models/metric.js',
|
2017-03-14 23:06:40 +00:00
|
|
|
'models/commit-set.js',
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
'models/commit-log.js',
|
Add the basic support for writing components in node.js
https://bugs.webkit.org/show_bug.cgi?id=186299
Reviewed by Antti Koivisto.
Add the basic support for writing components in node.js for generating rich email notifications.
To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API
to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend
and the backend in the future. Because there is no support for declarative custom elements or
shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree
to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and
MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order
to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of
CSS selectors to select elements by their local names and class names.
Specifically, each class name and element name based selectors are replaced by a globally unique
class name based selector, and each element which matches the selector is applied of the same
globally unique class name. The transformation is applied when constructing the "content" tree
as well as calls to renderReplace.
Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form
of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid
reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates
to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in
both frontend & backend.
* browser-tests/close-button-tests.js: Include CommonComponentBase.
* browser-tests/commit-log-viewer-tests.js: Ditto.
* browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates.
(async.importComponentBase): Added.
* browser-tests/editable-text-tests.js: Include CommonComponentBase.
* browser-tests/index.html:
* browser-tests/markup-page-tests.js: Added.
* browser-tests/page-router-tests.js: Include CommonComponentBase.
* browser-tests/page-tests.js: Ditto.
* browser-tests/test-group-form-tests.js: Ditto.
* public/shared/common-component-base.js: Added.
(CommonComponentBase): Extracted out of ComponentBase.
(CommonComponentBase.prototype.renderReplace): Added.
(CommonComponentBase.renderReplace): Moved from ComponentBase.
(CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from
ComponentBase's _recursivelyReplaceUnknownElementsByComponents.
(CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function.
(CommonComponentBase._constructStylesheetFromTemplate): Added.
(CommonComponentBase._constructNodeTreeFromTemplate): Added.
(CommonComponentBase.prototype.createElement): Added.
(CommonComponentBase.createElement): Moved from ComponentBase.
(CommonComponentBase._addContentToElement): Moved from ComponentBase.
(CommonComponentBase.prototype.createLink): Added.
(CommonComponentBase.createLink): Moved from ComponentBase.
(CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js.
(CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check.
(CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase.
* public/v3/components/base.js:
(ComponentBase):
(ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates.
Also avoid parsing the html template each time a component is instantiated by caching the result.
* public/v3/index.html:
* tools/js/markup-component.js: Added.
(MarkupDocument): Added. A fake Document.
(MarkupDocument.prototype.createContentRoot): A substitude for attachShadow.
(MarkupDocument.prototype.createElement):
(MarkupDocument.prototype.createTextNode):
(MarkupDocument.prototype._idForClone):
(MarkupDocument.prototype.reset):
(MarkupDocument.prototype.markup):
(MarkupDocument.prototype.escapeAttributeValue):
(MarkupDocument.prototype.escapeNodeData):
(MarkupNode): Added. A fake Node. Each node gets an unique ID.
(MarkupNode.prototype._markup):
(MarkupNode.prototype.clone): Implemented by the leave class.
(MarkupNode.prototype._cloneNodeData):
(MarkupNode.prototype.remove):
(MarkupParentNode): Added. An equivalent of ContainerNode in WebCore.
(MarkupParentNode.prototype.get childNodes):
(MarkupParentNode.prototype._cloneNodeData):
(MarkupParentNode.prototype.appendChild):
(MarkupParentNode.prototype.removeChild):
(MarkupParentNode.prototype.removeAllChildren):
(MarkupParentNode.prototype.replaceChild):
(MarkupContentRoot): Added. Used like a shadow tree.
(MarkupContentRoot.prototype._markup): Added.
(MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by
subclasses such as HTMLInputElement for simplicity.
(MarkupElement.prototype.get id): Added.
(MarkupElement.prototype.get localName): Added.
(MarkupElement.prototype.clone): Added.
(MarkupElement.prototype.appendChild): Added.
(MarkupElement.prototype.addEventListener): Added.
(MarkupElement.prototype.setAttribute): Added.
(MarkupElement.prototype.getAttribute): Added.
(MarkupElement.prototype.get attributes): Added.
(MarkupElement.prototype.get textContent): Added.
(MarkupElement.prototype.set textContent): Added.
(MarkupElement.prototype._serializeStyle): Added.
(MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so
this can't be used to implement innerHTML.
(MarkupElement.prototype.get value): Added.
(MarkupElement.prototype.set value): Added.
(MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration.
(MarkupElement.prototype.set style): Added.
(MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation.
(MarkupText): Added.
(MarkupText.prototype.clone): Added.
(MarkupText.prototype._markup): Added.
(MarkupText.prototype.get data): Added.
(MarkupText.prototype.set data): Added.
(MarkupComponentBase): Added.
(MarkupComponentBase.prototype.element): Added. Like ComponentBase's element.
(MarkupComponentBase.prototype.content): Added. Like ComponentBase's content.
(MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById.
(MarkupComponentBase.prototype.render): Added. Like ComponentBase's render.
(MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame.
In MarkupComponentBase, we keep rendering until the queue drains empty.
(MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies
the transformation of classes to workaround the lack of shadow tree support in scriptless HTML.
(MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation.
(MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree.
(MarkupComponentBase.reset): Added.
(MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the
transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be
unique across all components. The function to apply the necessary changes to an element is saved in
the global map of components, and later used in renderReplace via _applyStyleOverrides.
(MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement.
(MarkupComponentBase.prototype.createEventHandler): Added.
(MarkupComponentBase.createEventHandler): Added.
(MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body.
(MarkupPage.prototype.pageTitle): Added.
(MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would
be the content of the body element as opposed to the html element for the connivance of subclasses,
and to match the behavior of the frontend Page class.
(MarkupPage.prototype.render): Added.
(MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of
all components used.
(MarkupPage.get contentTemplate): Added.
(MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and
generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after
all subcomponent had finished rendering.
* unit-tests/markup-component-base-tests.js: Added.
* unit-tests/markup-element-tests.js: Added.
(.createElement): Added.
* unit-tests/markup-page-tests.js: Added.
Canonical link: https://commits.webkit.org/201761@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
|
|
|
'../shared/common-component-base.js',
|
2017-02-28 04:48:36 +00:00
|
|
|
'components/base.js',
|
|
|
|
'components/time-series-chart.js',
|
|
|
|
'components/interactive-time-series-chart.js'],
|
Add the basic support for writing components in node.js
https://bugs.webkit.org/show_bug.cgi?id=186299
Reviewed by Antti Koivisto.
Add the basic support for writing components in node.js for generating rich email notifications.
To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API
to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend
and the backend in the future. Because there is no support for declarative custom elements or
shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree
to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and
MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order
to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of
CSS selectors to select elements by their local names and class names.
Specifically, each class name and element name based selectors are replaced by a globally unique
class name based selector, and each element which matches the selector is applied of the same
globally unique class name. The transformation is applied when constructing the "content" tree
as well as calls to renderReplace.
Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form
of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid
reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates
to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in
both frontend & backend.
* browser-tests/close-button-tests.js: Include CommonComponentBase.
* browser-tests/commit-log-viewer-tests.js: Ditto.
* browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates.
(async.importComponentBase): Added.
* browser-tests/editable-text-tests.js: Include CommonComponentBase.
* browser-tests/index.html:
* browser-tests/markup-page-tests.js: Added.
* browser-tests/page-router-tests.js: Include CommonComponentBase.
* browser-tests/page-tests.js: Ditto.
* browser-tests/test-group-form-tests.js: Ditto.
* public/shared/common-component-base.js: Added.
(CommonComponentBase): Extracted out of ComponentBase.
(CommonComponentBase.prototype.renderReplace): Added.
(CommonComponentBase.renderReplace): Moved from ComponentBase.
(CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from
ComponentBase's _recursivelyReplaceUnknownElementsByComponents.
(CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function.
(CommonComponentBase._constructStylesheetFromTemplate): Added.
(CommonComponentBase._constructNodeTreeFromTemplate): Added.
(CommonComponentBase.prototype.createElement): Added.
(CommonComponentBase.createElement): Moved from ComponentBase.
(CommonComponentBase._addContentToElement): Moved from ComponentBase.
(CommonComponentBase.prototype.createLink): Added.
(CommonComponentBase.createLink): Moved from ComponentBase.
(CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js.
(CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check.
(CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase.
* public/v3/components/base.js:
(ComponentBase):
(ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates.
Also avoid parsing the html template each time a component is instantiated by caching the result.
* public/v3/index.html:
* tools/js/markup-component.js: Added.
(MarkupDocument): Added. A fake Document.
(MarkupDocument.prototype.createContentRoot): A substitude for attachShadow.
(MarkupDocument.prototype.createElement):
(MarkupDocument.prototype.createTextNode):
(MarkupDocument.prototype._idForClone):
(MarkupDocument.prototype.reset):
(MarkupDocument.prototype.markup):
(MarkupDocument.prototype.escapeAttributeValue):
(MarkupDocument.prototype.escapeNodeData):
(MarkupNode): Added. A fake Node. Each node gets an unique ID.
(MarkupNode.prototype._markup):
(MarkupNode.prototype.clone): Implemented by the leave class.
(MarkupNode.prototype._cloneNodeData):
(MarkupNode.prototype.remove):
(MarkupParentNode): Added. An equivalent of ContainerNode in WebCore.
(MarkupParentNode.prototype.get childNodes):
(MarkupParentNode.prototype._cloneNodeData):
(MarkupParentNode.prototype.appendChild):
(MarkupParentNode.prototype.removeChild):
(MarkupParentNode.prototype.removeAllChildren):
(MarkupParentNode.prototype.replaceChild):
(MarkupContentRoot): Added. Used like a shadow tree.
(MarkupContentRoot.prototype._markup): Added.
(MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by
subclasses such as HTMLInputElement for simplicity.
(MarkupElement.prototype.get id): Added.
(MarkupElement.prototype.get localName): Added.
(MarkupElement.prototype.clone): Added.
(MarkupElement.prototype.appendChild): Added.
(MarkupElement.prototype.addEventListener): Added.
(MarkupElement.prototype.setAttribute): Added.
(MarkupElement.prototype.getAttribute): Added.
(MarkupElement.prototype.get attributes): Added.
(MarkupElement.prototype.get textContent): Added.
(MarkupElement.prototype.set textContent): Added.
(MarkupElement.prototype._serializeStyle): Added.
(MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so
this can't be used to implement innerHTML.
(MarkupElement.prototype.get value): Added.
(MarkupElement.prototype.set value): Added.
(MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration.
(MarkupElement.prototype.set style): Added.
(MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation.
(MarkupText): Added.
(MarkupText.prototype.clone): Added.
(MarkupText.prototype._markup): Added.
(MarkupText.prototype.get data): Added.
(MarkupText.prototype.set data): Added.
(MarkupComponentBase): Added.
(MarkupComponentBase.prototype.element): Added. Like ComponentBase's element.
(MarkupComponentBase.prototype.content): Added. Like ComponentBase's content.
(MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById.
(MarkupComponentBase.prototype.render): Added. Like ComponentBase's render.
(MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame.
In MarkupComponentBase, we keep rendering until the queue drains empty.
(MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies
the transformation of classes to workaround the lack of shadow tree support in scriptless HTML.
(MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation.
(MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree.
(MarkupComponentBase.reset): Added.
(MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the
transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be
unique across all components. The function to apply the necessary changes to an element is saved in
the global map of components, and later used in renderReplace via _applyStyleOverrides.
(MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement.
(MarkupComponentBase.prototype.createEventHandler): Added.
(MarkupComponentBase.createEventHandler): Added.
(MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body.
(MarkupPage.prototype.pageTitle): Added.
(MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would
be the content of the body element as opposed to the html element for the connivance of subclasses,
and to match the behavior of the frontend Page class.
(MarkupPage.prototype.render): Added.
(MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of
all components used.
(MarkupPage.get contentTemplate): Added.
(MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and
generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after
all subcomponent had finished rendering.
* unit-tests/markup-component-base-tests.js: Added.
* unit-tests/markup-element-tests.js: Added.
(.createElement): Added.
* unit-tests/markup-page-tests.js: Added.
Canonical link: https://commits.webkit.org/201761@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
|
|
|
'CommonComponentBase', 'ComponentBase', 'TimeSeriesChart', 'InteractiveTimeSeriesChart',
|
2018-05-02 06:16:16 +00:00
|
|
|
'Platform', 'Metric', 'Test', 'Repository', 'MeasurementSet', 'MockRemoteAPI', 'AsyncTask').then(() => {
|
2017-02-28 04:48:36 +00:00
|
|
|
return context.symbols.TimeSeriesChart;
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
posixTime: posixTime,
|
|
|
|
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
get sampleCluster() { return this.makeSampleCluster(); },
|
|
|
|
|
|
|
|
makeModelObjectsForSampleCluster(context)
|
|
|
|
{
|
|
|
|
const test = context.symbols.Test.ensureSingleton(2, {name: 'Test'});
|
|
|
|
const metric = context.symbols.Metric.ensureSingleton(1, {name: 'Time', test})
|
|
|
|
const platform = context.symbols.Platform.ensureSingleton(1,
|
|
|
|
{name: 'SomePlatform', metrics: [metric], lastModifiedByMetric: [posixTime('2016-01-18T00:00:00Z')]});
|
|
|
|
metric.addPlatform(platform);
|
|
|
|
context.symbols.Repository.ensureSingleton(1, {name: 'SomeApp'});
|
|
|
|
context.symbols.Repository.ensureSingleton(2, {name: 'macOS'});
|
|
|
|
},
|
|
|
|
|
|
|
|
makeSampleCluster(options = {})
|
|
|
|
{
|
|
|
|
const baselineStart = options.baselineIsSmaller ? 30 : 130;
|
|
|
|
const targetStart = options.targetIsBigger ? 120 : 90;
|
|
|
|
return {
|
2017-02-28 04:48:36 +00:00
|
|
|
"clusterStart": posixTime('2016-01-01T00:00:00Z'),
|
|
|
|
"clusterSize": 7 * dayInMilliseconds,
|
|
|
|
"startTime": posixTime('2016-01-01T00:00:00Z'),
|
|
|
|
"endTime": posixTime('2016-01-08T00:00:00Z'),
|
|
|
|
"lastModified": posixTime('2016-01-18T00:00:00Z'),
|
|
|
|
"clusterCount": 1,
|
|
|
|
"status": "OK",
|
|
|
|
"formatMap": [
|
|
|
|
"id", "mean", "iterationCount", "sum", "squareSum", "markedOutlier",
|
|
|
|
"revisions",
|
2019-10-24 22:00:37 +00:00
|
|
|
"commitTime", "build", "buildTime", "buildTag", "builder"
|
2017-02-28 04:48:36 +00:00
|
|
|
],
|
|
|
|
"configurations": {
|
|
|
|
"current": [
|
|
|
|
[
|
|
|
|
1000, 100, 1, 100, 100 * 100, false,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2000, 1, "4000", null, posixTime('2016-01-05T17:35:00Z')], [3000, 2, "15B42", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-05T17:35:00Z'), 5000, posixTime('2016-01-05T19:23:00Z'), "10", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1001, 131, 1, 131, 131 * 131, true,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2001, 1, "4001", null, posixTime('2016-01-05T18:43:01Z')], [3000, 2, "15B42", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-05T18:43:01Z'), 5001, posixTime('2016-01-05T20:58:01Z'), "11", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1002, 122, 1, 122, 122 * 122, false,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2002, 1, "4002", null, posixTime('2016-01-05T20:01:02Z')], [3000, 2, "15B42", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-05T20:01:02Z'), 5002, posixTime('2016-01-05T22:37:02Z'), "12", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1003, 113, 1, 113, 113 * 113, false,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2003, 1, "4003", null, posixTime('2016-01-05T23:19:03Z')], [3000, 2, "15B42", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-05T23:19:03Z'), 5003, posixTime('2016-01-06T23:19:03Z'), "13", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1004, 124, 1, 124, 124 * 124, false,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2004, 1, "4004", null, posixTime('2016-01-06T01:52:04Z')], [3001, 2, "15C50", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-06T01:52:04Z'), 5004, posixTime('2016-01-06T02:42:04Z'), "14", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1005, 115, 1, 115, 115 * 115, true,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2005, 1, "4005", null, posixTime('2016-01-06T03:22:05Z')], [3001, 2, "15C50", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-06T03:22:05Z'), 5005, posixTime('2016-01-06T06:01:05Z'), "15", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
1006, 116, 1, 116, 116 * 116, false,
|
2021-04-15 03:06:39 +00:00
|
|
|
[ [2006, 1, "4006", null, posixTime('2016-01-06T05:59:06Z')], [3001, 2, "15C50", null, 0, 0] ],
|
2017-02-28 04:48:36 +00:00
|
|
|
posixTime('2016-01-06T05:59:06Z'), 5006, posixTime('2016-01-06T08:34:06Z'), "16", 7
|
|
|
|
]
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
],
|
|
|
|
"baseline": [
|
|
|
|
[
|
|
|
|
7000, baselineStart, 1, baselineStart, baselineStart * baselineStart, false,
|
|
|
|
[ ],
|
|
|
|
posixTime('2016-01-05T12:00:30Z'), 5030, posixTime('2016-01-05T12:00:30Z'), "30", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
7001, baselineStart + 1, 1, baselineStart + 1, Math.pow(baselineStart + 1, 2), false,
|
|
|
|
[ ],
|
|
|
|
posixTime('2016-01-06T00:00:31Z'), 5031, posixTime('2016-01-06T00:00:31Z'), "31", 7
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"target": [
|
|
|
|
[
|
|
|
|
8000, targetStart, 1, targetStart, targetStart * targetStart, false,
|
|
|
|
[ ],
|
|
|
|
posixTime('2016-01-05T12:00:30Z'), 5030, posixTime('2016-01-05T12:00:30Z'), "90", 7
|
|
|
|
],
|
|
|
|
[
|
|
|
|
8001, targetStart + 1, 1, targetStart + 1, Math.pow(targetStart + 1, 2), false,
|
|
|
|
[ ],
|
|
|
|
posixTime('2016-01-06T00:00:31Z'), 5031, posixTime('2016-01-06T00:00:31Z'), "91", 7
|
|
|
|
],
|
2017-02-28 04:48:36 +00:00
|
|
|
]
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
}};
|
2017-02-28 04:48:36 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
createChartWithSampleCluster(context, sourceList = null, chartOptions = {}, className = 'TimeSeriesChart')
|
|
|
|
{
|
|
|
|
const TimeSeriesChart = context.symbols[className];
|
|
|
|
const MeasurementSet = context.symbols.MeasurementSet;
|
|
|
|
|
|
|
|
if (sourceList == null)
|
|
|
|
sourceList = [{type: 'current'}];
|
|
|
|
|
|
|
|
const sampleCluster = MeasurementSet.findSet(1, 1, 0);
|
|
|
|
for (let source of sourceList) {
|
|
|
|
if (!source.type)
|
|
|
|
source.type = 'current';
|
|
|
|
source.measurementSet = sampleCluster;
|
|
|
|
}
|
|
|
|
|
|
|
|
const chart = new TimeSeriesChart(sourceList, chartOptions);
|
|
|
|
const element = chart.element();
|
|
|
|
element.style.width = chartOptions.width || '300px';
|
|
|
|
element.style.height = chartOptions.height || '100px';
|
|
|
|
context.document.body.appendChild(element);
|
|
|
|
|
|
|
|
return chart;
|
|
|
|
},
|
|
|
|
|
|
|
|
createInteractiveChartWithSampleCluster(context, sourceList = null, chartOptions = {})
|
|
|
|
{
|
|
|
|
if (sourceList == null)
|
|
|
|
sourceList = [{type: 'current', interactive: true}];
|
|
|
|
return this.createChartWithSampleCluster(context, sourceList, chartOptions, 'InteractiveTimeSeriesChart');
|
|
|
|
},
|
|
|
|
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
respondWithSampleCluster(request, options)
|
2017-02-28 04:48:36 +00:00
|
|
|
{
|
2018-05-11 20:15:08 +00:00
|
|
|
expect(request.url).to.be('/data/measurement-set-1-1.json');
|
2017-02-28 04:48:36 +00:00
|
|
|
expect(request.method).to.be('GET');
|
Make baseline data points selectable
https://bugs.webkit.org/show_bug.cgi?id=169069
<rdar://problem/29209427>
Reviewed by Antti Koivisto.
Add the capability to select data points other than "current" configuration type.
This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was
responsible for determining two data points for which to compute the status, and computing the status
between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts
page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for
each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView
to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware
of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it.
This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and
InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and
their time series view. It also extracts ChartStatusEvaluator which computes the current status values
and ChartRevisionRange which computes a list of revision differences both based on the referencePoints.
As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been
renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on
ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of
ChartRevisionRange, eliminating the need for the callback.
To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to
memoize the return value of a function when called with the same arguments. Delaying the computation of
a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard
so I expect this class would be used in a lot more places in the future.
* browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange.
* browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator.
* browser-tests/index.html:
(BrowsingContext):
(BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI
being loaded twice.
(ChartTest.importChartScripts): Import more model objects.
(ChartTest.sampleCluster): Made this a getter.
(ChartTest.makeModelObjectsForSampleCluster):
(ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options.
(ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster.
* public/v3/components/chart-pane-base.js:
(ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying
on _mainChartStatus or _commitLogViewer to keep track of it.
(ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in
ChartPaneStatusView has been replaced by "openRepository" action.
(ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane.
(ChartPaneBase.prototype._mainSelectionDidChange):
(ChartPaneBase.prototype._indicatorDidChange):
(ChartPaneBase.prototype._didFetchData):
(ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus.
(ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that
clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in
arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository.
(ChartPaneBase.prototype._keyup):
(ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's
moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys.
* public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView.
(ChartRevisionRange): Added.
(ChartRevisionRange.prototype.revisionList): Added.
(ChartRevisionRange.prototype.rangeForRepository): Added.
(ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's
_updateRevisionListForNewCurrentRepository.
(ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels.
* public/v3/components/chart-status-evaluator.js: Added.
(ChartStatusEvaluator): Added.
(ChartStatusEvaluator.prototype.status): Added.
(ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded.
* public/v3/components/chart-status-view.js: Removed.
(ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView.
* public/v3/components/chart-styles.js:
(ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what
enables the user to interact with the data points. The rest of changes in this patch mostly deals with
the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer
which would have shown the wrong range without these changes.
* public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView.
(DashboardChartStatusView): Added.
(DashboardChartStatusView.prototype.render): Added.
(DashboardChartStatusView.htmlTemplate): Added.
(DashboardChartStatusView.cssTemplate): Added.
* public/v3/components/interactive-time-series-chart.js:
(InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point
as the reference points when there is a selection. Only report the previous point if they are distinct as
showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply
return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's
referencePoints which always returns the latest point as the reference point.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It
never returns the previous point even if there were more data points as there is no way for the user to
specify which data points to compare.
* public/v3/index.html: Include newly added files.
* public/v3/lazily-evaluated-function.js: Added.
(LazilyEvaluatedFunction): Added.
(LazilyEvaluatedFunction.prototype.evaluate): Added.
* public/v3/models/commit-log.js:
(CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results
in "from" field to be unexpectedly an integer instead of a string.
* public/v3/models/metric.js:
(Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes
writing tests easier since it eliminates the need to load v2's data.js.
(Metric.prototype.unit):
(Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better.
* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code.
* public/v3/pages/chart-pane-status-view.js:
(ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and
ChartRevisionRange to to compute the chart status and the list of revision changes.
(ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted.
(ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using
LazilyEvaluatedFunction.
(ChartPaneStatusView.prototype._renderStatus): Added.
(ChartPaneStatusView.prototype._renderBuildRevisionTable): Added.
(ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been
moved into ChartRevisionRange. Just enqueue itself to re-render.
(ChartPaneStatusView.prototype._setRevisionRange): Deleted.
(ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted.
(ChartPaneStatusView.prototype.updateRevisionList): Deleted.
(ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted.
(ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted.
(ChartPaneStatusView.htmlTemplate):
(ChartPaneStatusView.cssTemplate):
* public/v3/pages/chart-pane.js:
(ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from
_requestOpeningCommitViewer.
(ChartPane.prototype._analyzeRange):
(ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether
an analysis task can be created for the currenty selected range.
* public/v3/pages/dashboard-page.js:
(DashboardPage.prototype._createChartForCell):
* unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction.
Canonical link: https://commits.webkit.org/186092@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213300 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-02 21:23:07 +00:00
|
|
|
request.resolve(this.makeSampleCluster(options));
|
2017-02-28 04:48:36 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-01-16 00:12:22 +00:00
|
|
|
mocha.checkLeaks();
|
2021-03-07 02:25:25 +00:00
|
|
|
mocha.globals(['expect', 'BrowsingContext', 'CanvasTest', 'ChartTest', 'wait', 'waitForComponentsToRender', 'waitForElementResize']);
|
2017-01-16 00:12:22 +00:00
|
|
|
mocha.run();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|