aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <nobody@tensorflow.org>2016-01-06 17:04:33 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2016-01-06 17:04:33 -0800
commit816adeef1c6e9c48b31d3426b565a7851f7f8e39 (patch)
tree55948d81b1f596ffcae6f0f506d1d09a51ee57e0 /tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
parent7b00fe3f2605491cf62d4e1b2818f375e79c8b8c (diff)
Refactor how TensorBoard url overwriting works.
Currently TensorBoard urls are changed by modifying a global variable (TF.Urls). This creates racyness where we need to ensure that that global variable changes before the TensorBoard instantiates. It also makes it impossible e.g. to have multiple TensorBoards on the same page using different url schemes. This CL changes TensorBoard so it takes in a "router" object which specifies what the routes are. It also adds a tf-tensorboard-demo component which is just like a TensorBoard, except it has a "dataDir" property that determines where to look for demo data. Change: 111558450
Diffstat (limited to 'tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html')
-rw-r--r--tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html32
1 files changed, 21 insertions, 11 deletions
diff --git a/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html b/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
index 63485d6374..1207f40249 100644
--- a/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
+++ b/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
@@ -1,21 +1,30 @@
<link rel="import" href="../polymer/polymer.html">
-<!-- tf-url-generator is a plumbing component that provides two upward bindable properties:
- outRunsUrl and outValuesUrlGenerator. These may be used by the rest of the application to communicate
- with the backend, and by overriding the TF.Urls code that backs it, can be modified to load data from
- a demo data source instead.
+<!-- tf-url-generator is a plumbing component that provides upward bindable properties
+ for each route that TensorBoard uses to retrieve data from the backend. The properties
+ are generally functions that take in a run and a tag and produce a url for retrieving
+ data for that run and tag (although there are exceptions: for example, outRunsUrl is just
+ a string because no additional data is required to retrieve runs).
+
+ tf-url-generator takes a "router" object that provides the functions that back each
+ property - that makes it easy to overwrite how TensorBoard retrieves data from the
+ backend, e.g. for creating demo instances.
-->
<dom-module id="tf-url-generator">
<script src="urlGenerator.js"></script>
<script>
var polymerObject = {
is: "tf-url-generator",
+ _computeRuns: function(router) {
+ return router.runs();
+ },
properties: {
+ router: {
+ type: Object,
+ },
outRunsUrl: {
type: String,
- value: function() {
- return TF.Urls.runsUrl();
- },
+ computed: "_computeRuns(router)",
readOnly: true,
notify: true,
},
@@ -34,15 +43,16 @@
if (route === "runs") {
return;
}
+ var computeFnName = "_compute" + route;
+ polymerObject[computeFnName] = function(router) {
+ return router[route];
+ };
var urlName = route + "Url";
var propertyName = Polymer.CaseMap.dashToCamelCase("out-" + urlName + "Generator");
polymerObject.properties[propertyName] = {
type: Function,
- value: function() {
- return TF.Urls[urlName];
- },
+ computed: computeFnName + "(router)",
notify: true,
- readOnly: true,
}
});
Polymer(polymerObject);