Skip to content

Commit 71dffde

Browse files
tkislanArtmanncoderabbitai[bot]jamesbhobbs
authored
feat: Add commands to create Deepnote block cells (#75)
* 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: Display input block type in notebook cell status bar Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Fix spell check in test Signed-off-by: Tomas Kislan <tomas@kislan.sk> * chore: Add error logger Signed-off-by: Tomas Kislan <tomas@kislan.sk> * refactor: Improve error handling in Deepnote notebook command listener - Removed unused imports and copyright headers. - Enhanced error handling for cell insertion operations by logging errors instead of using a no-operation function. - Updated regex for variable name matching to ensure proper prefix handling. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat: Add new input block types to command mapping - Introduced new command mappings for various input blocks including text, textarea, select, slider, checkbox, date, date range, file, and button blocks. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Enhance variable name parsing in Deepnote notebook command listener - Updated the variable name extraction logic to use zod for safer parsing, ensuring that only valid strings are returned. - Improved error handling during JSON parsing to log errors effectively. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * feat: Enhance Deepnote notebook functionality with SQL metadata support - Added a new schema for Deepnote SQL metadata to facilitate better handling of SQL-related input blocks. - Updated the Deepnote notebook command listener to utilize the new SQL metadata, improving variable name management and default metadata setup for new cells. - Enhanced the cell insertion logic to ensure proper selection and editing of newly created cells. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Fix test Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Update default SQL integration ID in Deepnote notebook command listener - Changed the default value of `sql_integration_id` to 'deepnote-dataframe-sql' to ensure proper integration with SQL functionalities. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * refactor: Update src/notebooks/deepnote/deepnoteNotebookCommandListener.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * feat: Refactor Deepnote notebook command listener to support async operations and improve error handling - Changed private methods to public async methods for adding SQL, big number chart, and input blocks, enhancing the ability to handle asynchronous operations. - Improved error handling by throwing errors when no active notebook editor is found or when cell insertion fails. - Updated the logic for cell insertion to ensure proper selection and editing of newly created cells. - Enhanced unit tests to cover new async behavior and error scenarios. Signed-off-by: Tomas Kislan <tomas@kislan.sk> * Update spell check config Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Fix tests mocks Signed-off-by: Tomas Kislan <tomas@kislan.sk> * fix: Improve error messages in Deepnote notebook command listener - Updated error handling in the DeepnoteNotebookCommandListener to use localized messages for better user experience. - Adjusted logic for variable name suffix checks to ensure correct prefix usage. Signed-off-by: Tomas Kislan <tomas@kislan.sk> --------- 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: James Hobbs <15235276+jamesbhobbs@users.noreply.github.com>
1 parent 08a3719 commit 71dffde

File tree

13 files changed

+1442
-1
lines changed

13 files changed

+1442
-1
lines changed

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"blockgroup",
2525
"channeldef",
2626
"dataframe",
27+
"datascience",
2728
"deepnote",
2829
"deepnoteserver",
2930
"dntk",

package.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,72 @@
109109
"category": "Deepnote",
110110
"icon": "$(notebook)"
111111
},
112+
{
113+
"command": "deepnote.addSqlBlock",
114+
"title": "%deepnote.commands.addSqlBlock.title%",
115+
"category": "Deepnote",
116+
"icon": "$(database)"
117+
},
118+
{
119+
"command": "deepnote.addBigNumberChartBlock",
120+
"title": "%deepnote.commands.addBigNumberChartBlock.title%",
121+
"category": "Deepnote",
122+
"icon": "$(graph)"
123+
},
124+
{
125+
"command": "deepnote.addInputTextBlock",
126+
"title": "%deepnote.commands.addInputTextBlock.title%",
127+
"category": "Deepnote",
128+
"icon": "$(symbol-text)"
129+
},
130+
{
131+
"command": "deepnote.addInputTextareaBlock",
132+
"title": "%deepnote.commands.addInputTextareaBlock.title%",
133+
"category": "Deepnote",
134+
"icon": "$(note)"
135+
},
136+
{
137+
"command": "deepnote.addInputSelectBlock",
138+
"title": "%deepnote.commands.addInputSelectBlock.title%",
139+
"category": "Deepnote",
140+
"icon": "$(list-selection)"
141+
},
142+
{
143+
"command": "deepnote.addInputSliderBlock",
144+
"title": "%deepnote.commands.addInputSliderBlock.title%",
145+
"category": "Deepnote",
146+
"icon": "$(settings-more-action)"
147+
},
148+
{
149+
"command": "deepnote.addInputCheckboxBlock",
150+
"title": "%deepnote.commands.addInputCheckboxBlock.title%",
151+
"category": "Deepnote",
152+
"icon": "$(check)"
153+
},
154+
{
155+
"command": "deepnote.addInputDateBlock",
156+
"title": "%deepnote.commands.addInputDateBlock.title%",
157+
"category": "Deepnote",
158+
"icon": "$(calendar)"
159+
},
160+
{
161+
"command": "deepnote.addInputDateRangeBlock",
162+
"title": "%deepnote.commands.addInputDateRangeBlock.title%",
163+
"category": "Deepnote",
164+
"icon": "$(calendar)"
165+
},
166+
{
167+
"command": "deepnote.addInputFileBlock",
168+
"title": "%deepnote.commands.addInputFileBlock.title%",
169+
"category": "Deepnote",
170+
"icon": "$(file)"
171+
},
172+
{
173+
"command": "deepnote.addButtonBlock",
174+
"title": "%deepnote.commands.addButtonBlock.title%",
175+
"category": "Deepnote",
176+
"icon": "$(add)"
177+
},
112178
{
113179
"command": "dataScience.ClearCache",
114180
"title": "%jupyter.command.dataScience.clearCache.title%",
@@ -736,6 +802,11 @@
736802
"group": "navigation@0",
737803
"when": "notebookType == 'deepnote'"
738804
},
805+
{
806+
"command": "deepnote.addSqlBlock",
807+
"group": "navigation@1",
808+
"when": "notebookType == 'deepnote'"
809+
},
739810
{
740811
"command": "jupyter.restartkernel",
741812
"group": "navigation/execute@5",

package.nls.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,17 @@
253253
"deepnote.commands.newProject.title": "New Project",
254254
"deepnote.commands.importNotebook.title": "Import Notebook",
255255
"deepnote.commands.importJupyterNotebook.title": "Import Jupyter Notebook",
256+
"deepnote.commands.addSqlBlock.title": "Add SQL Block",
257+
"deepnote.commands.addBigNumberChartBlock.title": "Add Big Number Chart Block",
258+
"deepnote.commands.addInputTextBlock.title": "Add Input Text Block",
259+
"deepnote.commands.addInputTextareaBlock.title": "Add Input Textarea Block",
260+
"deepnote.commands.addInputSelectBlock.title": "Add Input Select Block",
261+
"deepnote.commands.addInputSliderBlock.title": "Add Input Slider Block",
262+
"deepnote.commands.addInputCheckboxBlock.title": "Add Input Checkbox Block",
263+
"deepnote.commands.addInputDateBlock.title": "Add Input Date Block",
264+
"deepnote.commands.addInputDateRangeBlock.title": "Add Input Date Range Block",
265+
"deepnote.commands.addInputFileBlock.title": "Add Input File Block",
266+
"deepnote.commands.addButtonBlock.title": "Add Button Block",
256267
"deepnote.views.explorer.name": "Explorer",
257268
"deepnote.views.explorer.welcome": "No Deepnote notebooks found in this workspace.",
258269
"deepnote.command.selectNotebook.title": "Select Notebook"

src/commands.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,15 @@ export interface ICommandNameArgumentTypeMapping {
185185
[DSCommands.InstallPythonExtensionViaKernelPicker]: [];
186186
[DSCommands.InstallPythonViaKernelPicker]: [];
187187
[DSCommands.ContinueEditSessionInCodespace]: [];
188+
[DSCommands.AddSqlBlock]: [];
189+
[DSCommands.AddBigNumberChartBlock]: [];
190+
[DSCommands.AddInputTextBlock]: [];
191+
[DSCommands.AddInputTextareaBlock]: [];
192+
[DSCommands.AddInputSelectBlock]: [];
193+
[DSCommands.AddInputSliderBlock]: [];
194+
[DSCommands.AddInputCheckboxBlock]: [];
195+
[DSCommands.AddInputDateBlock]: [];
196+
[DSCommands.AddInputDateRangeBlock]: [];
197+
[DSCommands.AddInputFileBlock]: [];
198+
[DSCommands.AddButtonBlock]: [];
188199
}

0 commit comments

Comments
 (0)