Skip to content

Conversation

@sergeyteleshev
Copy link
Contributor

@sergeyteleshev sergeyteleshev marked this pull request as ready for review February 6, 2026 12:16
@SychevAndrey SychevAndrey requested a review from Copilot February 9, 2026 09:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the front-end integration for SQL query generation, wiring a new SQL generation dialog into existing UI flows (SQL generators menu + data grid context menu) and introducing supporting SDK/query and utility plumbing.

Changes:

  • Add result-set SQL generation support via a new GraphQL query and a SqlGeneratorsResource.generateResultSetSql method.
  • Introduce a “Generate SQL” data grid context menu (INSERT/UPDATE/DELETE/SELECT/SELECT IN) that opens the shared generated-SQL dialog.
  • Add a core-utils helper (executeAsyncSilently) with tests and adopt it in SQL generation entry points.

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
webapp/yarn.lock Adds workspace dependencies for the new plugin usage and core-utils reference.
webapp/packages/plugin-sql-generator/tsconfig.json Adds core-utils project reference for new imports.
webapp/packages/plugin-sql-generator/src/index.ts Exports GeneratedSqlDialog for reuse by other plugins.
webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsResource.ts Adds generateResultSetSql calling the new SDK query.
webapp/packages/plugin-sql-generator/src/SqlGenerators/SqlGeneratorsBootstrap.ts Switches to prefetching SQL + passing query/exception into the dialog.
webapp/packages/plugin-sql-generator/src/SqlGenerators/GeneratedSqlDialog.tsx Refactors dialog to accept { query, exception, nodeId } payload and removes internal loading/fetch logic.
webapp/packages/plugin-sql-generator/package.json Adds @cloudbeaver/core-utils dependency.
webapp/packages/plugin-data-viewer/src/ContainerDataSource.ts Updates copyright year.
webapp/packages/plugin-data-spreadsheet-new/tsconfig.json Adds project reference to plugin-sql-generator.
webapp/packages/plugin-data-spreadsheet-new/src/module.ts Registers DataGridContextMenuGenerateSqlService.
webapp/packages/plugin-data-spreadsheet-new/src/locales/zh.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/vi.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/ru.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/it.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/fr.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/en.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/locales/de.ts Adds “Generate SQL” menu/dialog/error translations.
webapp/packages/plugin-data-spreadsheet-new/src/SpreadsheetBootstrap.ts Wires DataGridContextMenuGenerateSqlService into bootstrap registration.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/GenerateSQL/MENU_DATA_GRID_GENERATE_SQL.ts Introduces the top-level “Generate SQL” context menu.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuGenerateSqlService.ts Implements menu/actions handler and invokes result-set SQL generation + dialog opening.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Actions/GenerateSQL/ACTION_DATA_GRID_GENERATE_SQL_UPDATE.ts Adds UPDATE action definition.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Actions/GenerateSQL/ACTION_DATA_GRID_GENERATE_SQL_SELECT_MANY.ts Adds SELECT (IN) action definition.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Actions/GenerateSQL/ACTION_DATA_GRID_GENERATE_SQL_SELECT.ts Adds SELECT action definition.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Actions/GenerateSQL/ACTION_DATA_GRID_GENERATE_SQL_INSERT.ts Adds INSERT action definition.
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/Actions/GenerateSQL/ACTION_DATA_GRID_GENERATE_SQL_DELETE.ts Adds DELETE action definition.
webapp/packages/plugin-data-spreadsheet-new/package.json Adds dependency on @cloudbeaver/plugin-sql-generator.
webapp/packages/plugin-data-import/src/DataImportBootstrap.ts Updates copyright year.
webapp/packages/core-utils/src/index.ts Exports the new executeAsyncSilently helper.
webapp/packages/core-utils/src/executeAsyncSilently.ts Adds executeAsyncSilently helper for capturing { result, error }.
webapp/packages/core-utils/src/executeAsyncSilently.test.ts Adds Vitest coverage for the new helper.
webapp/packages/core-sdk/src/queries/sqlGenerateResultSetQuery.gql Adds GraphQL query for generating SQL from a result set selection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


return isResultSetDataModel(model) && !model.source.isReadonly(resultIndex);
},
getItems: (context, items) => [...items, MENU_DATA_GRID_GENERATE_SQL],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we let to generate selects for readony?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause we decided we don't want this feature for the Grouping panel and Session Manager
We want this feature for: data editor, SQL result sets, and datasets

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hard to understand from code, that model.source.isReadonly(resultIndex) is about excluding Grouping panel and Session Manager

Copy link
Member

@devnaumov devnaumov Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use helpers such as isDatabaseSessionManagerDataSource that is already exist to exclude specific data sources

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what we already do:

return isResultSetDataSource(model.source) && !model.isDisabled(resultIndex) && !model.isReadonly(resultIndex);


return isResultSetDataModel(model) && !model.source.isReadonly(resultIndex);
},
getItems: (context, items) => [...items, MENU_DATA_GRID_GENERATE_SQL],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hard to understand from code, that model.source.isReadonly(resultIndex) is about excluding Grouping panel and Session Manager

Comment on lines 89 to 96
isActionApplicable: (context, action) =>
[
ACTION_DATA_GRID_GENERATE_SQL_INSERT,
ACTION_DATA_GRID_GENERATE_SQL_UPDATE,
ACTION_DATA_GRID_GENERATE_SQL_DELETE,
ACTION_DATA_GRID_GENERATE_SQL_SELECT,
ACTION_DATA_GRID_GENERATE_SQL_SELECT_MANY,
].includes(action),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just specify:

actions:  [
          ACTION_DATA_GRID_GENERATE_SQL_INSERT,
          ACTION_DATA_GRID_GENERATE_SQL_UPDATE,
          ACTION_DATA_GRID_GENERATE_SQL_DELETE,
          ACTION_DATA_GRID_GENERATE_SQL_SELECT,
          ACTION_DATA_GRID_GENERATE_SQL_SELECT_MANY,
        ]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main purpose of the IAction is to provide additional behaviour such as shortcuts or reusability in different contexts, IAction is some of kind standarterized action in the application that can be used in different contexts (menus, menu bars), you don't need to create action for every item in the menu, sometimes it's more convenient to use MenuBaseItem

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 41 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants