aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/components/tf-graph-info/tf-node-list-item.html
blob: f16e9e451122deafde3ecd70b9f6dba6e2346e93 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../tf-graph/tf-graph-icon.html">

<dom-module id="tf-node-list-item">
  <style>
  #list-item {
    width: 100%;
    color: #565656;
    font-size: 11pt;
    font-weight: 400;
    position: relative;
  }

  #list-item:hover {
    background-color: var(--google-yellow-100);
  }

  .clickable {
    cursor: pointer;
  }

  #list-item span {
    display: block;
    margin-left: 40px;
  }

  #list-item.excluded span {
    color: #999;
  }

  .node-icon {
    position: absolute;
    top: 1px;
    left: 2px;
  }
  </style>
  <template>
    <div id="list-item"
         on-mouseover="_nodeListener"
         on-mouseout="_nodeListener"
         on-click="_nodeListener">
      <tf-graph-icon class="node-icon"
          node="[[itemNode]]" height="12"></tf-graph-icon>
      <span title$="[[name]]">[[name]]</span>
    </div>
  </template>

  <script>
    (function() {
      Polymer({
        is: 'tf-node-list-item',

        properties: {
          /**
           * The Node for the card itself, on which this item is being drawn.
           * @type {tf.graph.Node}
           */
          cardNode: Object,
          /**
           * The Node for the item within the card, somehow related to cardNode.
           * @type {tf.graph.Node}
           */
          itemNode: Object,
          name: String,
          itemType: {
            type: String,
            observer: '_itemTypeChanged'
          }
        },

        _itemTypeChanged: function() {
          if (this.itemType !== 'subnode') {
            this.$['list-item'].classList.add('clickable');
          } else {
            this.$['list-item'].classList.remove('clickable');
          }
        },

        _nodeListener: function(event) {
          // fire node.click/mouseover/mouseout
          this.fire('node-list-item-' + event.type, {
            cardNode: this.cardNode.name,
            nodeName: this.name,
            type: this.itemType
          });
        }

      });
    })();
  </script>
</dom-module>