-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree view enhancement #6588
Tree view enhancement #6588
Changes from 13 commits
d1355a5
ab9afa0
85d0849
aa2861f
219ff2c
0d0a0e0
f2fb9aa
af53ab2
7c68346
441b957
2524344
2bd478d
d46a28d
87458c4
c16cfe2
f9ab05a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,8 @@ import { | |
SidePanelPalette | ||
} from '@jupyter-notebook/application'; | ||
|
||
import { CommandIDs as filebrowserCommandIDs } from '@jupyter-notebook/tree'; | ||
|
||
import { jupyterIcon } from '@jupyter-notebook/ui-components'; | ||
|
||
import { PromiseDelegate } from '@lumino/coreutils'; | ||
|
@@ -242,6 +244,11 @@ const menuSpacer: JupyterFrontEndPlugin<void> = { | |
|
||
/** | ||
* Add commands to open the tree and running pages. | ||
* | ||
* ## NOTES: | ||
* The optional token IFileBrowserCommands is useful to ensure the corresponding | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also this comment can probably be removed now. |
||
* plugin has been activated. Otherwise this plugin can be activated before the commands | ||
* 'toggle-main' has been added, which create a duplicated entry. | ||
*/ | ||
const pages: JupyterFrontEndPlugin<void> = { | ||
id: '@jupyter-notebook/application-extension:pages', | ||
|
@@ -262,18 +269,22 @@ const pages: JupyterFrontEndPlugin<void> = { | |
window.open(`${baseUrl}lab`); | ||
} | ||
}); | ||
const page = PageConfig.getOption('notebookPage'); | ||
|
||
app.commands.addCommand(CommandIDs.openTree, { | ||
label: trans.__('Open Files'), | ||
label: trans.__('File Browser'), | ||
execute: () => { | ||
window.open(`${baseUrl}tree`); | ||
if (page === 'tree') { | ||
app.commands.execute(filebrowserCommandIDs.activate); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid bringing a dependency on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example this is what is done in the JupyterLab There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, perhaps we should do the same in EDIT: just saw the comment below. |
||
} else { | ||
window.open(`${baseUrl}tree`); | ||
} | ||
} | ||
}); | ||
|
||
if (palette) { | ||
[CommandIDs.openLab, CommandIDs.openTree].forEach(command => { | ||
palette.addItem({ command, category: 'View' }); | ||
}); | ||
palette.addItem({ command: CommandIDs.openLab, category: 'View' }); | ||
palette.addItem({ command: CommandIDs.openTree, category: 'View' }); | ||
} | ||
} | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ import { TabPanel } from '@lumino/widgets'; | |
|
||
import { INotebookTree } from './token'; | ||
|
||
/** | ||
* The namespace for command IDs. | ||
*/ | ||
export namespace CommandIDs { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With https://github.com/jupyter/notebook/pull/6588/files#r1067176298 above, these |
||
// The command to activate the filebrowser widget in tree view. | ||
export const activate = 'filebrowser:activate'; | ||
} | ||
|
||
/** | ||
* The widget added in main area of the tree view. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this dependency still needed after the last commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks