Title: [190702] trunk/Websites/perf.webkit.org
Revision
190702
Author
rn...@webkit.org
Date
2015-10-07 19:06:40 -0700 (Wed, 07 Oct 2015)

Log Message

Add a page that cycles through v2 dashboards
https://bugs.webkit.org/show_bug.cgi?id=149907

Reviewed by Chris Dumez.

Add cycler.html that goes through each dashboard on v2 UI.

This allows the dashboards to be cycled through on a TV screen.

* public/cycler.html: Added.
(loadURLAt): Appends a new iframe to load the next URL (i is the index of the dashboard to be shown)
at the end of body. We don't immediately show the new iframe since it might take a while to load.
(showNewFrameIfLoaded): Remove the current iframe and show the next iframe if the next dashboard has
finished loading. We can't rely on DOMContentLoaded or load events because we use asynchronous XHR to
load each chart's data. Instead, wait until some chart becomes available or fails to load and none of
charts are still in progress to be shown.

Modified Paths

Added Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (190701 => 190702)


--- trunk/Websites/perf.webkit.org/ChangeLog	2015-10-08 02:06:37 UTC (rev 190701)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2015-10-08 02:06:40 UTC (rev 190702)
@@ -1,5 +1,24 @@
 2015-10-07  Ryosuke Niwa  <rn...@webkit.org>
 
+        Add a page that cycles through v2 dashboards
+        https://bugs.webkit.org/show_bug.cgi?id=149907
+
+        Reviewed by Chris Dumez.
+
+        Add cycler.html that goes through each dashboard on v2 UI.
+
+        This allows the dashboards to be cycled through on a TV screen.
+
+        * public/cycler.html: Added.
+        (loadURLAt): Appends a new iframe to load the next URL (i is the index of the dashboard to be shown)
+        at the end of body. We don't immediately show the new iframe since it might take a while to load.
+        (showNewFrameIfLoaded): Remove the current iframe and show the next iframe if the next dashboard has
+        finished loading. We can't rely on DOMContentLoaded or load events because we use asynchronous XHR to
+        load each chart's data. Instead, wait until some chart becomes available or fails to load and none of
+        charts are still in progress to be shown.
+
+2015-10-07  Ryosuke Niwa  <rn...@webkit.org>
+
         Allow custom revisions to be specified in A/B testing
         https://bugs.webkit.org/show_bug.cgi?id=149905
 

Added: trunk/Websites/perf.webkit.org/public/cycler.html (0 => 190702)


--- trunk/Websites/perf.webkit.org/public/cycler.html	                        (rev 0)
+++ trunk/Websites/perf.webkit.org/public/cycler.html	2015-10-08 02:06:40 UTC (rev 190702)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="refresh" content="3600">
+<style>
+html, body, iframe { margin: 0; padding: 0; border: none; width: 100%; height: 100%; }
+</style>
+</head>
+<body>
+<script>
+
+var urls = [];
+var CycleSeconds = 30;
+
+var request = new XMLHttpRequest();
+request.open('GET', '/data/manifest.json', true);
+request.send(null);
+request._onreadystatechange_ = function () {
+    if (request.readyState != XMLHttpRequest.DONE)
+        return;
+    if (request.status !== 200) {
+        alert('Failed with status: ' + request.status);
+        return;
+    }
+
+    var manifest = JSON.parse(request.responseText);
+    var dashboards = [];
+    for (var dashboardName in manifest.dashboards)
+        dashboards.push(dashboardName);
+    dashboards = dashboards.sort();
+
+    for (var dashboardName of dashboards)
+        urls.push('/v2/#/dashboard/' + dashboardName);
+
+    loadURLAt(0);
+}
+
+var oldIframe = null;
+function loadURLAt(i) {
+    var newIframe = document.createElement('iframe');
+    document.body.appendChild(newIframe);
+    newIframe.src = ""
+    newIframe._onload_ = showNewFrameIfLoaded.bind(window, i, newIframe);
+}
+
+function showNewFrameIfLoaded(i, iframe) {
+    var doc = iframe.contentDocument;
+    if ((!doc.querySelector('.chart') && !doc.querySelector('.failure')) || doc.querySelector('.progress'))
+        return setTimeout(showNewFrameIfLoaded.bind(window, i, iframe), 500);
+
+    if (oldIframe)
+        document.body.removeChild(oldIframe);
+    oldIframe = iframe;
+
+    i = (i + 1) % urls.length;
+    setTimeout(loadURLAt.bind(window, i), CycleSeconds * 1000);
+}
+
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to