From e68eba65aca897cbd91f76b33aa4531186f4b3eb Mon Sep 17 00:00:00 2001 From: William Chargin Date: Wed, 5 Jul 2017 10:53:55 -0700 Subject: [PATCH] Only display active dashboards Summary: This commit incorporates the backend's `is_active` plugin functions and the related `plugins_listing` handler, and uses them on the client: we will only display dashboards that correspond to backend plugins that are active. Test Plan: - Launch TensorBoard with a normal data set and note that the correct set of dashboards is displayed. - Launch TensorBoard with a nonexistent or empty logdir and observe the global "no data" message. - Launch TensorBoard and cause the `plugins_listing` network request to fail. (In Chrome: Network devtools tab, right-click the request, select "Block Request URL", refresh.) Note the resulting message. Then, unblock the request, and click TensorBoard's reload button: everything should work as usual. - Launch TensorBoard with a large data set, and open the frontend before it's read any text summaries. Then, click TensorBoard's reload button and note that the "Text" dashboard tab appears and functions. - Launch TensorBoard on a large data set. Select the "text" dashboard. Then, relaunch the TensorBoard backend on the same port, and click the frontend's reload button before any text summaries are loaded. Note that TensorBoard removes the text dashboard and shoves the user over to a different dashboard (the first dashboard loaded) with a notice. - Launch TensorBoard, let it load data, then kill the server and click TensorBoard's reload button. Note that the already-loaded features of TensorBoard are still operational. wchargin-branch: active-dashboards --- tensorboard/components/tf_backend/router.ts | 2 + tensorboard/components/tf_storage/storage.ts | 4 +- .../tf_tensorboard/tf-tensorboard.html | 461 ++++++++++++++++-- 3 files changed, 411 insertions(+), 56 deletions(-) diff --git a/tensorboard/components/tf_backend/router.ts b/tensorboard/components/tf_backend/router.ts index f4e74854078..81cfc33e9fa 100644 --- a/tensorboard/components/tf_backend/router.ts +++ b/tensorboard/components/tf_backend/router.ts @@ -20,6 +20,7 @@ export type RunTagUrlFn = (tag: string, run: string) => string; export interface Router { logdir: () => string; runs: () => string; + pluginsListing: () => string; isDemoMode: () => boolean; pluginRoute: (pluginName: string, route: string) => string; pluginRunTagRoute: (pluginName: string, route: string) => RunTagUrlFn; @@ -60,6 +61,7 @@ export function createRouter(dataDir = 'data', demoMode = false): Router { return { logdir: () => dataDir + '/logdir', runs: () => dataDir + '/runs' + (demoMode ? '.json' : ''), + pluginsListing: () => dataDir + '/plugins_listing', isDemoMode: () => demoMode, pluginRoute, pluginRunTagRoute, diff --git a/tensorboard/components/tf_storage/storage.ts b/tensorboard/components/tf_storage/storage.ts index d2441f83459..58ef52c1a70 100644 --- a/tensorboard/components/tf_storage/storage.ts +++ b/tensorboard/components/tf_storage/storage.ts @@ -311,8 +311,8 @@ function _componentToDict(component: string): StringDict { const tokens = component.split('&'); tokens.forEach((token) => { const kv = token.split('='); - // Special backwards compatibility for URI components like #events - if (kv.length === 1 && _.contains(TABS, kv[0])) { + // Special backwards compatibility for URI components like #scalars. + if (kv.length === 1) { items[TAB] = kv[0]; } else if (kv.length === 2) { items[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); diff --git a/tensorboard/components/tf_tensorboard/tf-tensorboard.html b/tensorboard/components/tf_tensorboard/tf-tensorboard.html index 03c6e4b44b9..4225da31aff 100644 --- a/tensorboard/components/tf_tensorboard/tf-tensorboard.html +++ b/tensorboard/components/tf_tensorboard/tf-tensorboard.html @@ -56,23 +56,59 @@

Settings

TensorBoard
- - Settings
+ + +