Skip to content

Commit

Permalink
CB-4548 adds ACTION_TAB_CLOSE_SQL_RESULT_GROUP to the end of the tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyteleshev committed Mar 28, 2024
1 parent e47420e commit e9e95fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { DATA_CONTEXT_TABS_CONTEXT, MENU_TAB } from '@cloudbeaver/core-ui';
import { ActionService, DATA_CONTEXT_MENU, MenuService } from '@cloudbeaver/core-view';
import { ActionService, DATA_CONTEXT_MENU, menuExtractItems, MenuService } from '@cloudbeaver/core-view';

import { ACTION_TAB_CLOSE_SQL_RESULT_GROUP } from './ACTION_TAB_CLOSE_SQL_RESULT_GROUP';
import { DATA_CONTEXT_SQL_EDITOR_STATE } from './DATA_CONTEXT_SQL_EDITOR_STATE';
Expand All @@ -26,6 +26,15 @@ export class SqlEditorGroupTabsBootstrap extends Bootstrap {
return !!tab && !!state?.enabledBaseActions && menu;
},
getItems: (context, items) => [...items, ACTION_TAB_CLOSE_SQL_RESULT_GROUP],
orderItems: (context, items) => {
const actions = menuExtractItems(items, [ACTION_TAB_CLOSE_SQL_RESULT_GROUP]);

if (actions.length > 0) {
items.push(...actions);
}

return items;
},
});
this.actionService.addHandler({
id: 'result-tabs-group-base-handler',
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/plugin-sql-editor/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ export default [
['sql_editor_close_result_tabs_dialog_title', 'Confirm closing tabs'],
['plugin_sql_editor_action_overlay_title', 'Action required'],
['plugin_sql_editor_action_overlay_description', 'Please reopen editor to continue working.'],
['plugin_sql_editor_action_close_group', 'Close all of the same group'],
['plugin_sql_editor_action_close_group', 'Close all of the same query'],
];
2 changes: 1 addition & 1 deletion webapp/packages/plugin-sql-editor/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ export default [
['sql_editor_close_result_tabs_dialog_title', 'Confirm closing tabs'],
['plugin_sql_editor_action_overlay_title', 'Action required'],
['plugin_sql_editor_action_overlay_description', 'Please reopen editor to continue working.'],
['plugin_sql_editor_action_close_group', 'Close all of the same group'],
['plugin_sql_editor_action_close_group', 'Close all of the same query'],
];
2 changes: 1 addition & 1 deletion webapp/packages/plugin-sql-editor/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export default [
['sql_editor_close_result_tabs_dialog_title', 'Подтвердить закрытие вкладок'],
['plugin_sql_editor_action_overlay_title', 'Требуется действие'],
['plugin_sql_editor_action_overlay_description', 'Пожалуйста, перезапустите редактор для продолжения работы.'],
['plugin_sql_editor_action_close_group', 'Закрыть все из группы'],
['plugin_sql_editor_action_close_group', 'Закрыть все из этого запроса'],
];
2 changes: 1 addition & 1 deletion webapp/packages/plugin-sql-editor/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export default [
['sql_editor_close_result_tabs_dialog_title', 'Confirm closing tabs'],
['plugin_sql_editor_action_overlay_title', 'Action required'],
['plugin_sql_editor_action_overlay_description', 'Please reopen editor to continue working.'],
['plugin_sql_editor_action_close_group', 'Close all of the same group'],
['plugin_sql_editor_action_close_group', 'Close all of the same query'],
];

0 comments on commit e9e95fb

Please sign in to comment.