From 4f3fdcf5183fa4fe0f266a7925bf8a3cb49094bc Mon Sep 17 00:00:00 2001 From: E Date: Tue, 9 Mar 2021 02:59:38 -0800 Subject: [PATCH 1/3] graph: fix PNG download button --- .../plugins/graph/tf_graph/tf-graph-scene.ts | 8 +++-- .../plugins/graph/tf_graph/tf-graph.ts | 5 ++- .../graph/tf_graph_app/tf-graph-app.ts | 9 ++++- .../graph/tf_graph_board/tf-graph-board.ts | 13 +++++-- .../plugins/graph/tf_graph_common/minimap.ts | 34 +++++-------------- .../tf_graph_controls/tf-graph-controls.ts | 17 ++++------ .../tf_graph_dashboard/tf-graph-dashboard.ts | 9 ++++- 7 files changed, 51 insertions(+), 44 deletions(-) diff --git a/tensorboard/plugins/graph/tf_graph/tf-graph-scene.ts b/tensorboard/plugins/graph/tf_graph/tf-graph-scene.ts index 3f36dc7213b..9085516983b 100644 --- a/tensorboard/plugins/graph/tf_graph/tf-graph-scene.ts +++ b/tensorboard/plugins/graph/tf_graph/tf-graph-scene.ts @@ -27,6 +27,7 @@ import * as tf_graph_scene from '../tf_graph_common/scene'; import * as tf_graph_scene_node from '../tf_graph_common/node'; import * as tf_graph_util from '../tf_graph_common/util'; import * as tf_graph_layout from '../tf_graph_common/layout'; +import * as tf_graph_minimap from '../tf_graph_common/minimap'; import * as tf_graph_render from '../tf_graph_common/render'; import {template} from './tf-graph-scene.html'; @@ -126,10 +127,8 @@ class TfGraphScene2 /** * A minimap object to notify for zoom events. - * This property is a tf.scene.Minimap object. */ - @property({type: Object}) - minimap: object; + private minimap: tf_graph_minimap.Minimap; /* * Dictionary for easily stylizing nodes when state changes. @@ -497,6 +496,9 @@ class TfGraphScene2 }.bind(this) ); } + getImageBlob(): Promise { + return this.minimap.getImageBlob(); + } isNodeSelected(n) { return n === this.selectedNode; } diff --git a/tensorboard/plugins/graph/tf_graph/tf-graph.ts b/tensorboard/plugins/graph/tf_graph/tf-graph.ts index 0a34082ac3b..836e8e15354 100644 --- a/tensorboard/plugins/graph/tf_graph/tf-graph.ts +++ b/tensorboard/plugins/graph/tf_graph/tf-graph.ts @@ -30,7 +30,7 @@ import {LegacyElementMixin} from '../../../components/polymer/legacy_element_mix import {ColorBy} from '../tf_graph_common/view_types'; @customElement('tf-graph') -class TfGraph extends LegacyElementMixin(PolymerElement) { +export class TfGraph extends LegacyElementMixin(PolymerElement) { static readonly template = html`