diff --git a/tensorflow/tensorboard/components/vz_projector/data-loader.ts b/tensorflow/tensorboard/components/vz_projector/data-loader.ts index 07a11237c34cdb..7b9b073be31c3a 100644 --- a/tensorflow/tensorboard/components/vz_projector/data-loader.ts +++ b/tensorflow/tensorboard/components/vz_projector/data-loader.ts @@ -90,6 +90,10 @@ class ServerDataProvider implements DataProvider { retrieveRuns(callback: (runs: string[]) => void): void { let msgId = logging.setModalMessage('Fetching runs...'); d3.json(`${this.routePrefix}/runs`, (err, runs) => { + if (err) { + logging.setModalMessage('Error: ' + err.responseText); + return; + } logging.setModalMessage(null, msgId); callback(runs); }); @@ -104,6 +108,10 @@ class ServerDataProvider implements DataProvider { let msgId = logging.setModalMessage('Fetching checkpoint info...'); d3.json(`${this.routePrefix}/info?run=${run}`, (err, checkpointInfo) => { + if (err) { + logging.setModalMessage('Error: ' + err.responseText); + return; + } logging.setModalMessage(null, msgId); this.runCheckpointInfoCache[run] = checkpointInfo; callback(checkpointInfo); @@ -115,9 +123,9 @@ class ServerDataProvider implements DataProvider { logging.setModalMessage('Fetching tensor values...', TENSORS_MSG_ID); d3.text( `${this.routePrefix}/tensor?run=${run}&name=${tensorName}`, - (err: Error, tsv: string) => { + (err: any, tsv: string) => { if (err) { - console.error(err); + logging.setModalMessage('Error: ' + err.responseText); return; } parseTensors(tsv).then(dataPoints => { @@ -131,9 +139,9 @@ class ServerDataProvider implements DataProvider { logging.setModalMessage('Fetching metadata...', METADATA_MSG_ID); d3.text( `${this.routePrefix}/metadata?run=${run}&name=${tensorName}`, - (err: Error, rawMetadata: string) => { + (err: any, rawMetadata: string) => { if (err) { - console.error(err); + logging.setModalMessage('Error: ' + err.responseText); return; } parseMetadata(rawMetadata).then(result => callback(result)); @@ -526,10 +534,9 @@ class DemoDataProvider implements DataProvider { let separator = demoDataSet.fpath.substr(-3) === 'tsv' ? '\t' : ' '; let url = `${DemoDataProvider.DEMO_FOLDER}/${demoDataSet.fpath}`; logging.setModalMessage('Fetching tensors...', TENSORS_MSG_ID); - d3.text(url, (error: Error, dataString: string) => { + d3.text(url, (error: any, dataString: string) => { if (error) { - console.error(error); - logging.setModalMessage('Error loading data.'); + logging.setModalMessage('Error: ' + error.responseText); return; } parseTensors(dataString, separator).then(points => { @@ -547,9 +554,9 @@ class DemoDataProvider implements DataProvider { logging.setModalMessage('Fetching metadata...', METADATA_MSG_ID); d3.text( `${DemoDataProvider.DEMO_FOLDER}/${demoDataSet.metadata_path}`, - (err: Error, rawMetadata: string) => { + (err: any, rawMetadata: string) => { if (err) { - console.error(err); + logging.setModalMessage('Error: ' + err.responseText); reject(err); return; } diff --git a/tensorflow/tensorboard/components/vz_projector/vz-projector-data-panel.ts b/tensorflow/tensorboard/components/vz_projector/vz-projector-data-panel.ts index f7e11303f72839..bb4daf2ef0bc8b 100644 --- a/tensorflow/tensorboard/components/vz_projector/vz-projector-data-panel.ts +++ b/tensorflow/tensorboard/components/vz_projector/vz-projector-data-panel.ts @@ -75,8 +75,8 @@ export class DataPanel extends DataPanelPolymer { // Get all the runs. this.dataProvider.retrieveRuns(runs => { this.runNames = runs; - // If there is only 1 run, choose that one by default. - if (this.runNames.length === 1) { + // Choose the first run by default. + if (this.runNames.length > 0) { this.selectedRun = runs[0]; } }); @@ -208,7 +208,13 @@ export class DataPanel extends DataPanelPolymer { .text(this.checkpointInfo.checkpointFile) .attr('title', this.checkpointInfo.checkpointFile); this.dataProvider.getDefaultTensor(this.selectedRun, defaultTensor => { - this.selectedTensor = defaultTensor; + if (this.selectedTensor === defaultTensor) { + // Explicitly call the observer. Polymer won't call it if the previous + // string matches the current string. + this._selectedTensorChanged(); + } else { + this.selectedTensor = defaultTensor; + } }); }); } diff --git a/tensorflow/tensorboard/components/vz_projector/vz-projector.html b/tensorflow/tensorboard/components/vz_projector/vz-projector.html index efaa8dfdc6aa0c..a43fd29857dfad 100644 --- a/tensorflow/tensorboard/components/vz_projector/vz-projector.html +++ b/tensorflow/tensorboard/components/vz_projector/vz-projector.html @@ -122,7 +122,6 @@ align-items: center; display: flex; justify-content: center; - width: 300px; } #notify-msgs {