Skip to content

Commit 2cf42fd

Browse files
tkislanArtmanncoderabbitai[bot]saltenasl
authored
feat: Add support for project notebook management (create, rename, delete) (#88)
* feat: Set up a custom renderer for data frames. * wip * feat: Implement deepnote big number chart support and renderer * refactor: Clean up debug logs and improve big number block conversion handling * feat: Pass block metadata to cell outputs for renderer to access * feat: Set up a custom renderer for data frames. * wip * add the table state. * page size handling * add page navigation * Generate Python code before executing the cell. * clean up * pr feedback. * Update build/esbuild/build.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: Support Deepnote input blocks * feat: Move DEEPNOTE_VSCODE_RAW_CONTENT_KEY into constants file * feedback * feat: Add Deepnote input blocks converters * refactor: Remove debug logs and refine metadata parsing in Deepnote converters * feat: Add chart big number converter tests * Reformat test code * Refactor ChartBigNumberBlockConverter tests to use deepStrictEqual for assertions * Remove debug console.log * docs and metadata changes. * fix: Spread operator object fallback * Merge remote-tracking branch 'origin/chris/display-data-frames' into tomaskislan/grn-4762-support-big-number-blocks * use the latest blocks package. * add the packages permission * simplify execution flow. * remove copyright header * clean up the code * revert controller changes * pr feedback * pr feedback * fix the tests * guard metadata spread against undefined. * fix: Merge cleanup * More merge cleanup * Fix test * feat: Add big number chart json config execution support * feat: Add commands to add Deepnote SQL block and big number chart * fix: Enhance error handling for big number metadata parsing and improve chart big number renderer logic * refactor: Simplify chart big number renderer by directly rendering to the element and improve cleanup logic for unmounting components * Fix import * fix: Change deepnote_big_number_comparison_type to string type for better flexibility * fix: Remove constants, accidentaly added to wrong branch * Update package.json * feat: Add new commands for SQL and Big Number Chart blocks * feat: Update command titles and add SQL block functionality * Fix imports * fix: Fix imports * fix: Remove unused code * feat: Add support for new input blocks in Deepnote, including text, textarea, select, slider, checkbox, date, date range, file, and button blocks * feat(big-number): Integrate react-error-boundary for error handling and enhance big number output rendering * Update test snapshots * feat: Update input create default values to match those in deepnote app Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat: Add support for project notebook management (create, rename, delete) Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat: Localize commands, extract notebook creation logic to reuse in methods Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat: Extract command ids into separate config files Signed-off-by: Tomas Kislan <tomas@kislan.sk> * refactor: Improve notebook renaming logic in DeepnoteExplorerView Signed-off-by: Tomas Kislan <tomas@kislan.sk> * refactor: Remove lowercase logic from notebook names checks Signed-off-by: Tomas Kislan <tomas@kislan.sk> * test: Implement DeepnoteExplorerView tests Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Fix spell check Signed-off-by: Tomas Kislan <tomas@kislan.sk> * test: Change assertion Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Revert "fix: Fix spell check" This reverts commit 8becf4e. * Revert "test: Change assertion" This reverts commit fe81891. * fix: Fix spellcheck Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Fix test yaml Signed-off-by: Tomas Kislan <tomas@kislan.sk> * test: Update assertions Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Change version assertion from string to number * fix: Fix version type in deepnote project unit test * refactor: Reuse promptForNotebookName in rename command, simplify createAndAddNotebookToProject function Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Exclude current name from validation when renaming notebook Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Sort imports Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat(open-in-deepnote): button in toolbar (#153) * feat(open-in-deepnote): button in toolbar * chore: fix tests * fix(warn-on-startup): move `jupyterViewVariables` view into the existing deepnote container (#148) * feat: Order projects and notebooks alphabetically. * fix: Don't recreate the tree. * fix test * fix dumb tests. * coderabbit feedback * more feedback --------- Signed-off-by: Tomas Kislan <tomas@kislan.sk> Co-authored-by: Christoffer Artmann <artgaard@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lukas Šaltėnas <lukas.saltenas@gmail.com>
1 parent 53be9e5 commit 2cf42fd

12 files changed

+2264
-64
lines changed

package.json

Lines changed: 87 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,48 @@
195195
"category": "Deepnote",
196196
"icon": "$(add)"
197197
},
198+
{
199+
"command": "deepnote.newNotebook",
200+
"title": "%deepnote.commands.newNotebook.title%",
201+
"category": "Deepnote",
202+
"icon": "$(notebook)"
203+
},
204+
{
205+
"command": "deepnote.renameProject",
206+
"title": "%deepnote.commands.renameProject.title%",
207+
"category": "Deepnote",
208+
"icon": "$(edit)"
209+
},
210+
{
211+
"command": "deepnote.deleteProject",
212+
"title": "%deepnote.commands.deleteProject.title%",
213+
"category": "Deepnote",
214+
"icon": "$(trash)"
215+
},
216+
{
217+
"command": "deepnote.renameNotebook",
218+
"title": "%deepnote.commands.renameNotebook.title%",
219+
"category": "Deepnote",
220+
"icon": "$(edit)"
221+
},
222+
{
223+
"command": "deepnote.deleteNotebook",
224+
"title": "%deepnote.commands.deleteNotebook.title%",
225+
"category": "Deepnote",
226+
"icon": "$(trash)"
227+
},
228+
{
229+
"command": "deepnote.duplicateNotebook",
230+
"title": "%deepnote.commands.duplicateNotebook.title%",
231+
"category": "Deepnote",
232+
"icon": "$(copy)"
233+
},
234+
{
235+
"command": "deepnote.addNotebookToProject",
236+
"title": "%deepnote.commands.addNotebookToProject.title%",
237+
"category": "Deepnote",
238+
"icon": "$(add)"
239+
},
198240
{
199241
"command": "dataScience.ClearCache",
200242
"title": "%jupyter.command.dataScience.clearCache.title%",
@@ -868,55 +910,60 @@
868910
"when": "notebookType == 'deepnote'"
869911
},
870912
{
871-
"command": "deepnote.addSqlBlock",
913+
"command": "deepnote.newNotebook",
872914
"group": "navigation@1",
873915
"when": "notebookType == 'deepnote'"
874916
},
875917
{
876-
"command": "deepnote.addChartBlock",
918+
"command": "deepnote.addSqlBlock",
877919
"group": "navigation@2",
878920
"when": "notebookType == 'deepnote'"
879921
},
880922
{
881-
"command": "deepnote.addBigNumberChartBlock",
923+
"command": "deepnote.addChartBlock",
882924
"group": "navigation@3",
883925
"when": "notebookType == 'deepnote'"
884926
},
885927
{
886-
"command": "deepnote.addInputTextBlock",
928+
"command": "deepnote.addBigNumberChartBlock",
887929
"group": "navigation@4",
888930
"when": "notebookType == 'deepnote'"
889931
},
890932
{
891-
"command": "deepnote.addInputTextareaBlock",
933+
"command": "deepnote.addInputTextBlock",
892934
"group": "navigation@5",
893935
"when": "notebookType == 'deepnote'"
894936
},
895937
{
896-
"command": "deepnote.addInputSelectBlock",
938+
"command": "deepnote.addInputTextareaBlock",
897939
"group": "navigation@6",
898940
"when": "notebookType == 'deepnote'"
899941
},
900942
{
901-
"command": "deepnote.addInputSliderBlock",
943+
"command": "deepnote.addInputSelectBlock",
902944
"group": "navigation@7",
903945
"when": "notebookType == 'deepnote'"
904946
},
905947
{
906-
"command": "deepnote.addInputCheckboxBlock",
948+
"command": "deepnote.addInputSliderBlock",
907949
"group": "navigation@8",
908950
"when": "notebookType == 'deepnote'"
909951
},
910952
{
911-
"command": "deepnote.addInputDateBlock",
953+
"command": "deepnote.addInputCheckboxBlock",
912954
"group": "navigation@9",
913955
"when": "notebookType == 'deepnote'"
914956
},
915957
{
916-
"command": "deepnote.addInputDateRangeBlock",
958+
"command": "deepnote.addInputDateBlock",
917959
"group": "navigation@10",
918960
"when": "notebookType == 'deepnote'"
919961
},
962+
{
963+
"command": "deepnote.addInputDateRangeBlock",
964+
"group": "navigation@11",
965+
"when": "notebookType == 'deepnote'"
966+
},
920967
{
921968
"command": "jupyter.restartkernel",
922969
"group": "navigation/execute@5",
@@ -1446,6 +1493,36 @@
14461493
"command": "deepnote.revealInExplorer",
14471494
"when": "view == deepnoteExplorer && viewItem != loading",
14481495
"group": "inline@2"
1496+
},
1497+
{
1498+
"command": "deepnote.addNotebookToProject",
1499+
"when": "view == deepnoteExplorer && viewItem == projectFile",
1500+
"group": "1_project@1"
1501+
},
1502+
{
1503+
"command": "deepnote.renameProject",
1504+
"when": "view == deepnoteExplorer && viewItem == projectFile",
1505+
"group": "2_edit@1"
1506+
},
1507+
{
1508+
"command": "deepnote.deleteProject",
1509+
"when": "view == deepnoteExplorer && viewItem == projectFile",
1510+
"group": "3_delete@1"
1511+
},
1512+
{
1513+
"command": "deepnote.renameNotebook",
1514+
"when": "view == deepnoteExplorer && viewItem == notebook",
1515+
"group": "2_edit@1"
1516+
},
1517+
{
1518+
"command": "deepnote.duplicateNotebook",
1519+
"when": "view == deepnoteExplorer && viewItem == notebook",
1520+
"group": "2_edit@2"
1521+
},
1522+
{
1523+
"command": "deepnote.deleteNotebook",
1524+
"when": "view == deepnoteExplorer && viewItem == notebook",
1525+
"group": "3_delete@1"
14491526
}
14501527
]
14511528
},

package.nls.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@
266266
"deepnote.commands.addInputDateRangeBlock.title": "Add Input Date Range Block",
267267
"deepnote.commands.addInputFileBlock.title": "Add Input File Block",
268268
"deepnote.commands.addButtonBlock.title": "Add Button Block",
269+
"deepnote.commands.newNotebook.title": "New Notebook",
270+
"deepnote.commands.renameProject.title": "Rename Project",
271+
"deepnote.commands.deleteProject.title": "Delete Project",
272+
"deepnote.commands.renameNotebook.title": "Rename Notebook",
273+
"deepnote.commands.deleteNotebook.title": "Delete Notebook",
274+
"deepnote.commands.duplicateNotebook.title": "Duplicate Notebook",
275+
"deepnote.commands.addNotebookToProject.title": "Add Notebook",
269276
"deepnote.views.explorer.name": "Explorer",
270277
"deepnote.views.explorer.welcome": "No Deepnote notebooks found in this workspace.",
271278
"deepnote.command.selectNotebook.title": "Select Notebook"

src/commands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export interface ICommandNameArgumentTypeMapping {
186186
[DSCommands.InstallPythonExtensionViaKernelPicker]: [];
187187
[DSCommands.InstallPythonViaKernelPicker]: [];
188188
[DSCommands.ContinueEditSessionInCodespace]: [];
189+
[DSCommands.NewNotebook]: [];
189190
[DSCommands.AddSqlBlock]: [];
190191
[DSCommands.AddBigNumberChartBlock]: [];
191192
[DSCommands.AddChartBlock]: [];
@@ -198,5 +199,14 @@ export interface ICommandNameArgumentTypeMapping {
198199
[DSCommands.AddInputDateRangeBlock]: [];
199200
[DSCommands.AddInputFileBlock]: [];
200201
[DSCommands.AddButtonBlock]: [];
202+
[DSCommands.NewProject]: [];
203+
[DSCommands.ImportNotebook]: [];
204+
[DSCommands.ImportJupyterNotebook]: [];
205+
[DSCommands.RenameProject]: [];
206+
[DSCommands.DeleteProject]: [];
207+
[DSCommands.RenameNotebook]: [];
208+
[DSCommands.DeleteNotebook]: [];
209+
[DSCommands.DuplicateNotebook]: [];
210+
[DSCommands.AddNotebookToProject]: [];
201211
[DSCommands.OpenInDeepnote]: [];
202212
}

src/notebooks/deepnote/deepnoteActivationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class DeepnoteActivationService implements IExtensionSyncActivationServic
3838
*/
3939
public activate() {
4040
this.serializer = new DeepnoteNotebookSerializer(this.notebookManager);
41-
this.explorerView = new DeepnoteExplorerView(this.extensionContext, this.notebookManager);
41+
this.explorerView = new DeepnoteExplorerView(this.extensionContext, this.notebookManager, this.logger);
4242
this.editProtection = new DeepnoteInputBlockEditProtection(this.logger);
4343

4444
this.extensionContext.subscriptions.push(workspace.registerNotebookSerializer('deepnote', this.serializer));

0 commit comments

Comments
 (0)