Merge pull request #868 from dbeaver/fix/rm-script-naming

fix(plugin-resource-manager): CB-2087 allow parentheses
This commit is contained in:
Alexey
2022-05-27 18:23:15 +03:00
committed by GitHub
6 changed files with 9 additions and 10 deletions
@@ -32,7 +32,7 @@ interface State {
submit: () => Promise<void>;
}
const regex = /^(?!\.)[\p{L}\w\-$.\s]+$/u;
const regex = /^(?!\.)[\p{L}\w\-$.\s()]+$/u;
export const SaveScriptDialog: DialogComponent<Payload, string> = observer(function SaveScriptDialog({
payload,
@@ -14,5 +14,5 @@ export default [
['plugin_resource_manager_sync_script_error', "Failed to sync editor's query"],
['plugin_resource_manager_script_not_found_title', 'Failed to find the associated script'],
['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$." and can\'t start with a dot'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()" and can\'t start with a dot'],
];
@@ -14,5 +14,5 @@ export default [
['plugin_resource_manager_sync_script_error', "Failed to sync editor's query"],
['plugin_resource_manager_script_not_found_title', 'Failed to find the associated script'],
['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$." and can\'t start with a dot'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()" and can\'t start with a dot'],
];
@@ -14,5 +14,5 @@ export default [
['plugin_resource_manager_sync_script_error', 'Не удалось синхронизировать данные редактора'],
['plugin_resource_manager_script_not_found_title', 'Не удалось найти привязанный скрипт'],
['plugin_resource_manager_script_not_found_message', 'Возможно скрипт был удален или переименован. Будет использовано последнее известное значение'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Имя скрипта может содержать следующие символы "_-$." и не может начинаться с точки'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Имя скрипта может содержать следующие символы "_-$.()" и не может начинаться с точки'],
];
@@ -14,5 +14,5 @@ export default [
['plugin_resource_manager_sync_script_error', '同步查询失败'],
['plugin_resource_manager_script_not_found_title', '找不到关联的脚本'],
['plugin_resource_manager_script_not_found_message', '脚本可能被删除或重命名,将使用最后的有效值'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$." and can\'t start with a dot'],
['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()" and can\'t start with a dot'],
];
@@ -14,8 +14,8 @@ import { SessionExpireService } from '@cloudbeaver/core-root';
import { createPath } from '@cloudbeaver/core-utils';
import { ActionService, ACTION_SAVE, DATA_CONTEXT_MENU, MenuService } from '@cloudbeaver/core-view';
import { NavResourceNodeService, RESOURCE_NODE_TYPE, SaveScriptDialog, ResourceManagerService, ProjectsResource, RESOURCES_NODE_PATH } from '@cloudbeaver/plugin-resource-manager';
import { DATA_CONTEXT_SQL_EDITOR_STATE, SqlEditorService, SQL_EDITOR_ACTIONS_MENU } from '@cloudbeaver/plugin-sql-editor';
import { SqlEditorNavigatorService, SqlEditorTabService } from '@cloudbeaver/plugin-sql-editor-navigation-tab';
import { DATA_CONTEXT_SQL_EDITOR_STATE, getSqlEditorName, SqlEditorService, SQL_EDITOR_ACTIONS_MENU } from '@cloudbeaver/plugin-sql-editor';
import { SqlEditorNavigatorService } from '@cloudbeaver/plugin-sql-editor-navigation-tab';
import { isScript } from './isScript';
import { SCRIPT_EXTENSION } from './SCRIPT_EXTENSION';
@@ -27,7 +27,6 @@ export class PluginBootstrap extends Bootstrap {
private readonly navNodeManagerService: NavNodeManagerService,
private readonly navTreeResource: NavTreeResource,
private readonly navResourceNodeService: NavResourceNodeService,
private readonly sqlEditorTabService: SqlEditorTabService,
private readonly sqlEditorService: SqlEditorService,
private readonly navNodeInfoResource: NavNodeInfoResource,
private readonly navigationTabsService: NavigationTabsService,
@@ -64,9 +63,9 @@ export class PluginBootstrap extends Bootstrap {
const tab = this.navigationTabsService.currentTab;
if (action === ACTION_SAVE) {
const tabName = this.sqlEditorTabService.getName(state);
const name = getSqlEditorName(state);
const result = await this.commonDialogService.open(SaveScriptDialog, {
defaultScriptName: tabName,
defaultScriptName: name,
});
if (result !== DialogueStateResult.Rejected && result !== DialogueStateResult.Resolved) {