Skip to content

Commit

Permalink
Allow to read logdir remotely
Browse files Browse the repository at this point in the history
  • Loading branch information
manuzhang committed Feb 12, 2019
1 parent 94eac3b commit 8fd7301
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function activate(app: JupyterLab, restorer: ILayoutRestorer, palette: ICommandP
*/
export
function addCommands(app: JupyterLab, manager: TensorboardManager, tracker: InstanceTracker<TensorboardTab>, launcher: ILauncher | null) {
let { commands, serviceManager } = app;
let commands = app.commands;

commands.addCommand(CommandIDs.open, {
execute: args => {
Expand Down Expand Up @@ -157,20 +157,11 @@ function addCommands(app: JupyterLab, manager: TensorboardManager, tracker: Inst
iconClass: args => (args['isPalette'] ? '' : TENSORBOARD_ICON_CLASS),
execute: args => {
const logdir = typeof args['logdir'] === 'undefined' ? args['cwd'] as string : args['logdir'] as string;
return serviceManager.contents.get(logdir, { type: 'directory'}).then(dir => {
return manager.startNew(dir.path).then(tb => {
return manager.startNew(logdir).then(tb => {
return app.commands.execute(CommandIDs.open, { tb: tb.model});
});
}, () => {
// no such directory.
return showDialog({
title: 'Cannot create tensorboard.',
body: 'Directory not found',
buttons: [Dialog.okButton()]
});
});
},
});
}
});

if (launcher) {
launcher.add({
Expand Down

0 comments on commit 8fd7301

Please sign in to comment.