New perf dashboard should have multiple dashboard pages
[WebKit-https.git] / Websites / perf.webkit.org / public / v2 / data.js
index f337c62f4b6d550ef764fa8da37eab9f9e7832af..dfe3133d323746e1130835086753d4d782761a1b 100755 (executable)
@@ -141,8 +141,8 @@ function Measurement(rawData)
         revisions = {};
     this._raw['revisions'] = revisions;
 
-    for (var repositoryName in revisions) {
-        var commitTimeOrUndefined = revisions[repositoryName][1]; // e.g. ["162190", 1389945046000]
+    for (var repositoryId in revisions) {
+        var commitTimeOrUndefined = revisions[repositoryId][1]; // e.g. ["162190", 1389945046000]
         if (latestTime < commitTimeOrUndefined)
             latestTime = commitTimeOrUndefined;
     }
@@ -152,10 +152,10 @@ function Measurement(rawData)
     this._formattedRevisions = undefined;
 }
 
-Measurement.prototype.commitTimeForRepository = function (repositoryName)
+Measurement.prototype.commitTimeForRepository = function (repositoryId)
 {
     var revisions = this._raw['revisions'];
-    var rawData = revisions[repositoryName];
+    var rawData = revisions[repositoryId];
     if (!rawData)
         return null;
     return new Date(rawData[1]);
@@ -166,11 +166,11 @@ Measurement.prototype.formattedRevisions = function (previousMeasurement)
     var revisions = this._raw['revisions'];
     var previousRevisions = previousMeasurement ? previousMeasurement._raw['revisions'] : null;
     var formattedRevisions = {};
-    for (var repositoryName in revisions) {
-        var currentRevision = revisions[repositoryName][0];
-        var previousRevision = previousRevisions ? previousRevisions[repositoryName][0] : null;
+    for (var repositoryId in revisions) {
+        var currentRevision = revisions[repositoryId][0];
+        var previousRevision = previousRevisions ? previousRevisions[repositoryId][0] : null;
         var formatttedRevision = this._formatRevisionRange(previousRevision, currentRevision);
-        formattedRevisions[repositoryName] = formatttedRevision;
+        formattedRevisions[repositoryId] = formatttedRevision;
     }
 
     return formattedRevisions;
@@ -360,6 +360,11 @@ TimeSeries.prototype.findPointByMeasurementId = function (measurementId)
     return this._series.find(function (point) { return point.measurement.id() == measurementId; });
 }
 
+TimeSeries.prototype.findPointAfterTime = function (time)
+{
+    return this._series.find(function (point) { return point.time >= time; });
+}
+
 TimeSeries.prototype.seriesBetweenPoints = function (startPoint, endPoint)
 {
     if (!startPoint.seriesIndex || !endPoint.seriesIndex)
@@ -400,6 +405,13 @@ TimeSeries.prototype.minMaxForTimeRange = function (startTime, endTime)
 
 TimeSeries.prototype.series = function () { return this._series; }
 
+TimeSeries.prototype.lastPoint = function ()
+{
+    if (!this._series || !this._series.length)
+        return null;
+    return this._series[this._series.length - 1];
+}
+
 TimeSeries.prototype.previousPoint = function (point)
 {
     if (!point.seriesIndex)