Skip to content
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

Added Edit Notebook Metadata Option (#6402) #7099

Merged
merged 21 commits into from
Feb 7, 2024
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a4077bb
Added Edit Notebook Metadata Option (#6402)
Dilip-Jain Oct 9, 2023
b2e380a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 9, 2023
c597c36
Added Edit Notebook Metadata Option (#6402)
Dilip-Jain Oct 9, 2023
0691f87
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 9, 2023
1fd2872
Merge branch 'jupyter:main' into edit-notebook-metadata
Dilip-Jain Oct 14, 2023
657313c
Prettier Code for passing Test Lint check
Dilip-Jain Oct 14, 2023
ab1fd64
Prettier Code for passing Test Lint check
Dilip-Jain Oct 14, 2023
e6600a9
Merge branch 'main' into edit-notebook-metadata
jtpio Dec 22, 2023
ac9beab
Merge branch 'main' into edit-notebook-metadata
jtpio Jan 2, 2024
d7061c2
Merge branch 'jupyter:main' into edit-notebook-metadata
Dilip-Jain Feb 4, 2024
5916885
adding the edit-notebook-metadata entry via schema
Dilip-Jain Feb 4, 2024
a5519f3
adding the edit-notebook-metadata entry via schema
Dilip-Jain Feb 4, 2024
4efdd7d
adding the edit-notebook-metadata entry via schema
Dilip-Jain Feb 4, 2024
a2b8be8
adding the edit-notebook-metadata entry via schema
Dilip-Jain Feb 4, 2024
73188df
adding the edit-notebook-metadata entry via schema
Dilip-Jain Feb 4, 2024
f9091c5
Merge branch 'main' into edit-notebook-metadata
jtpio Feb 7, 2024
dcbc9ad
fix menu item
jtpio Feb 7, 2024
7a3db32
Add to the command palette
jtpio Feb 7, 2024
405b732
Update Playwright Snapshots
github-actions[bot] Feb 7, 2024
e73e9a4
Update Playwright Snapshots
github-actions[bot] Feb 7, 2024
b699a33
fix snapshots
jtpio Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions packages/notebook-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,12 +478,65 @@
},
};

/**
* Add a command to open right sidebar for Editing Notebook Metadata when clicking on "Edit Notebook Metadata" under Edit menu
*/
const editNotebookMetadata: JupyterFrontEndPlugin<void> = {
id: '@jupyter-notebook/notebook-extension:edit-notebook-metadata',
Dilip-Jain marked this conversation as resolved.
Show resolved Hide resolved
autoStart: true,
requires: [IMainMenu],
optional: [ITranslator, INotebookTools],
activate: (
app: JupyterFrontEnd,
menu: IMainMenu,
translator: ITranslator | null,
notebookTools: INotebookTools | null
) => {
const { commands } = app;
translator = translator ?? nullTranslator;
const trans = translator.load('notebook');

const id = 'notebook:edit-metadata';
commands.addCommand(id, {
label: trans.__('Edit Notebook Metadata'),
execute: async () => {
const command = 'application:toggle-panel';
const args = {
side: 'right',
title: 'Show Notebook Tools',
id: 'notebook-tools',
};

// Check if Show Notebook Tools (Right Sidebar) is open (expanded)
if (!commands.isToggled(command, args)) {
await commands.execute(command, args).then((_) => {

Check failure on line 513 in packages/notebook-extension/src/index.ts

View workflow job for this annotation

GitHub Actions / Test Lint

Delete `⏎`
// For expanding the 'Advanced Tools' section (default: collapsed)
if (notebookTools) {
const tools = (notebookTools?.layout as any).widgets;
tools.forEach((tool: any) => {
if ( tool.widget.title.label === 'Advanced Tools' && tool.collapsed ){

Check failure on line 518 in packages/notebook-extension/src/index.ts

View workflow job for this annotation

GitHub Actions / Test Lint

Replace `·tool.widget.title.label·===·'Advanced·Tools'·&&·tool.collapsed·)` with `⏎··················tool.widget.title.label·===·'Advanced·Tools'·&&⏎··················tool.collapsed⏎················)·`
tool.toggle();
}
});
}
});
}
},
});

// Add `Edit Notebook Metadata` option to Edit menu
menu.editMenu.addItem({ type: 'command', command: id, rank: 40 })

Check failure on line 529 in packages/notebook-extension/src/index.ts

View workflow job for this annotation

GitHub Actions / Test Lint

Insert `;`
},
};

/**
* Export the plugins as default.
*/
const plugins: JupyterFrontEndPlugin<any>[] = [
checkpoints,
closeTab,
editNotebookMetadata,
kernelLogo,
kernelStatus,
notebookToolsWidget,
Expand Down
Loading