aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/components/tf-dashboard-common/tf-url-generator.html
blob: 803998daeb4d48e97b4f7c6981fa17c49bb6838f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<link rel="import" href="../../bower_components/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.
 -->
<dom-module id="tf-url-generator">
  <script src="urlGenerator.js"></script>
  <script>
    var polymerObject = {
      is: "tf-url-generator",
      properties: {
        outRunsUrl: {
          type: String,
          value: function() {
            return TF.Urls.runsUrl();
          },
          readOnly: true,
          notify: true,
        },
      },
    };
    TF.Urls.routes.forEach(function(route) {
      /* for each route (other than runs, handled seperately):
       * out`RouteName`: {
       *  type: Function,
       *  readOnly: true,
       *  notify: true,
       *  value: function() {
       *    return TF.Urls.`routeName`Url;
       *  }
       */
      if (route === "runs") {
        return;
      }
      var urlName = route + "Url";
      var propertyName = Polymer.CaseMap.dashToCamelCase("out-" + urlName + "Generator");
      polymerObject.properties[propertyName] = {
        type: Function,
        value: function() {
          return TF.Urls[urlName];
        },
        notify: true,
        readOnly: true,
      }
    });
    Polymer(polymerObject);
  </script>
</dom-module>