aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dandelion Mané <dandelion@google.com>2017-02-07 17:39:24 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-02-07 17:50:30 -0800
commit8418879238584c3b81aa9dd29c65234f95c6d9f2 (patch)
tree5d78467d7ef297986ba27866d7a9e5d58f256316
parent50e03a2676c1c97c943e2a9c64b337ecee5c3b1a (diff)
Migrate tf_color_scale to use webfiles build rules.
Change: 146858476
-rw-r--r--tensorflow/tensorboard/components/tf_color_scale/BUILD63
-rw-r--r--tensorflow/tensorboard/components/tf_color_scale/demo/BUILD26
-rw-r--r--tensorflow/tensorboard/components/tf_color_scale/demo/index.html94
-rw-r--r--tensorflow/tensorboard/components/tf_color_scale/tf-color-scale.html1
4 files changed, 184 insertions, 0 deletions
diff --git a/tensorflow/tensorboard/components/tf_color_scale/BUILD b/tensorflow/tensorboard/components/tf_color_scale/BUILD
new file mode 100644
index 0000000000..75bf812fe5
--- /dev/null
+++ b/tensorflow/tensorboard/components/tf_color_scale/BUILD
@@ -0,0 +1,63 @@
+package(default_visibility = ["//tensorflow:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles")
+load("//tensorflow/tensorboard:defs.bzl", "tensorboard_ts_library")
+load("//tensorflow/tensorboard:defs.bzl", "tensorboard_typescript_genrule")
+load("//tensorflow/tensorboard:defs.bzl", "tensorboard_webcomponent_library")
+
+licenses(["notice"]) # Apache 2.0
+
+# TODO(dandelion): Add webfiles support for the test code.
+
+webfiles(
+ name = "tf_color_scale",
+ srcs = [
+ "tf-color-scale.html",
+ ":ts",
+ ],
+ path = "/tf-color-scale",
+ deps = [
+ "//tensorflow/tensorboard/components/tf_imports:d3",
+ "@org_polymer",
+ ],
+)
+
+tensorboard_typescript_genrule(
+ name = "ts",
+ srcs = [
+ "colorScale.ts",
+ "palettes.ts",
+ ],
+ typings = ["@org_definitelytyped//:d3.d.ts"],
+)
+
+filegroup(
+ name = "all_files",
+ srcs = glob(["**"]),
+ tags = ["notsan"],
+)
+
+################################################################################
+# MARKED FOR DELETION
+
+tensorboard_webcomponent_library(
+ name = "legacy",
+ srcs = [
+ "tf-color-scale.html",
+ ":legacy_ts",
+ ],
+ destdir = "tf-color-scale",
+ deps = [
+ "//tensorflow/tensorboard/components:tf_imports",
+ "//third_party/javascript/polymer/v1/polymer:lib",
+ ],
+)
+
+tensorboard_ts_library(
+ name = "legacy_ts",
+ srcs = [
+ "colorScale.ts",
+ "palettes.ts",
+ ],
+ deps = ["//tensorflow/tensorboard/components:common_deps"],
+)
diff --git a/tensorflow/tensorboard/components/tf_color_scale/demo/BUILD b/tensorflow/tensorboard/components/tf_color_scale/demo/BUILD
new file mode 100644
index 0000000000..00b8a033b8
--- /dev/null
+++ b/tensorflow/tensorboard/components/tf_color_scale/demo/BUILD
@@ -0,0 +1,26 @@
+package(default_visibility = ["//tensorflow:internal"])
+
+load("@io_bazel_rules_closure//closure:defs.bzl", "webfiles")
+
+licenses(["notice"]) # Apache 2.0
+
+# bazel run //third_party/tensorflow/tensorboard/components/tf_color_scale/demo
+webfiles(
+ name = "demo",
+ srcs = ["index.html"],
+ path = "/tf-color-scale/demo",
+ deps = [
+ "//tensorflow/tensorboard/components/tf_color_scale",
+ "//tensorflow/tensorboard/components/tf_imports:d3",
+ "@org_polymer_iron_demo_helpers",
+ "@org_polymer_paper_button",
+ "@org_polymer_paper_styles",
+ "@org_polymer_webcomponentsjs",
+ ],
+)
+
+filegroup(
+ name = "all_files",
+ srcs = glob(["**"]),
+ tags = ["notsan"],
+)
diff --git a/tensorflow/tensorboard/components/tf_color_scale/demo/index.html b/tensorflow/tensorboard/components/tf_color_scale/demo/index.html
new file mode 100644
index 0000000000..ad9edbda98
--- /dev/null
+++ b/tensorflow/tensorboard/components/tf_color_scale/demo/index.html
@@ -0,0 +1,94 @@
+<!doctype html>
+<!--
+@license
+Copyright 2016 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<title>tf-color-scale demo</title>
+<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
+<link rel="import" href="../tf-color-scale.html">
+<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
+<link rel="import" href="../../paper-styles/typography.html">
+<link rel="import" href="../../paper-button/paper-button.html">
+<link rel="import" href="../../tf-imports/d3.html">
+
+<style> body {font-family: "Roboto";}</style>
+<demo-snippet>
+ <template>
+ <dom-module id="color-scale-demo">
+ <template>
+ <paper-button raised id="button" on-tap="change">Change Runs</paper-button>
+ <tf-color-scale runs="[[runs]]" out-color-scale="{{scale}}"></tf-color-scale>
+ <div class="container">
+ <template is="dom-repeat" items="[[runs]]">
+ <div class="row">
+ <div class="circle" style$=[[_makeStyle(item)]]></div>
+ <span>[[item]]</span>
+ </div>
+ </template>
+ </div>
+ <style>
+ .circle {
+ width: 20px;
+ height: 20px;
+ border-radius: 10px;
+ display: inline-block;
+ }
+ .row {
+ height: 35px;
+ width: 200px;
+ display: inline-block;
+ }
+ .container {
+ height: 200px;
+ }
+ #button {
+ margin: 20px;
+ }
+ </style>
+ </template>
+ <script>
+ let fellowship = ["aragorn", "legolas", "gimli", "frodo",
+ "gandalf", "boromir", "merry", "pippin", "sam"];
+ let gems = ["garnet", "amethyst", "pearl", "and steven!"];
+ let numbers = d3.range(30).map(function(x) {return x.toString();});
+ let examples = [numbers, fellowship, gems];
+ Polymer({
+ is: "color-scale-demo",
+ properties: {
+ runs: {
+ type: Array,
+ value: examples[0],
+ },
+ i: {
+ type: Number,
+ value: 0,
+ },
+ },
+ _makeStyle: function(item) {
+ return "background-color: " + this.scale.scale(item);
+ },
+ change: function() {
+ this.i = (this.i + 1) % 3;
+ this.runs = examples[this.i];
+ },
+ });
+ </script>
+ </dom-module>
+ <color-scale-demo id="demo"></color-scale-demo>
+ </template>
+</demo-snippet>
diff --git a/tensorflow/tensorboard/components/tf_color_scale/tf-color-scale.html b/tensorflow/tensorboard/components/tf_color_scale/tf-color-scale.html
index 743996f624..79bee6d957 100644
--- a/tensorflow/tensorboard/components/tf_color_scale/tf-color-scale.html
+++ b/tensorflow/tensorboard/components/tf_color_scale/tf-color-scale.html
@@ -16,6 +16,7 @@ limitations under the License.
-->
<link rel="import" href="../polymer/polymer.html">
+<link rel="import" href="../tf-imports/d3.html">
<!--
tf-color-scale is a plumbing component that takes in an array of runs, and produces