Merge branch 'devel' into feat/value-panel-quotas

This commit is contained in:
Naumov Alexey
2022-04-15 14:27:55 +02:00
24 changed files with 132 additions and 55 deletions
@@ -882,6 +882,7 @@ public class WebSession extends AbstractSessionPersistent implements SMSession,
public synchronized void resetAuthToken() {
this.sessionPermissions = null;
this.smAuthToken = null;
this.user = null;
}
public synchronized void updateSMAuthInfo(SMAuthInfo smAuthInfo) throws DBCException {
@@ -119,7 +119,7 @@ export const ElementsTreeTools = observer<Props>(function ElementsTreeTools({
{tree.settings?.configurable && (
<IconButton
name='/icons/settings_cog_sm.svg'
title={translate('app_navigationTree_settings_title')}
title={translate('ui_settings')}
style={toolsStyles}
img
onClick={() => setOpen(!opened)}
@@ -49,7 +49,7 @@ export const NavigationTreeSettings = observer<Props>(function NavigationTreeSet
return styled(styles)(
<settings className={className}>
<Group keepSize form gap dense>
<GroupTitle>{translate('app_navigationTree_settings_title')}</GroupTitle>
<GroupTitle>{translate('ui_settings')}</GroupTitle>
<Switch
id={`${root}.filter`}
name="filter"
@@ -15,7 +15,6 @@ export default [
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_title', 'Settings'],
['app_navigationTree_settings_filter_title', 'Filter'],
['app_navigationTree_settings_filter_description', 'Show filtering field'],
['app_navigationTree_settings_filter_all_title', 'Show collapsed'],
@@ -15,7 +15,6 @@ export default [
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_title', 'Settings'],
['app_navigationTree_settings_filter_title', 'Filter'],
['app_navigationTree_settings_filter_description', 'Show filtering field'],
['app_navigationTree_settings_filter_all_title', 'Show collapsed'],
@@ -20,7 +20,6 @@ export default [
['app_navigationTree_action_link_with_editor', 'Синхронизовать с редактором'],
['app_navigationTree_action_collapse_all', 'Свернуть все элементы'],
['app_navigationTree_settings_title', 'Настройки'],
['app_navigationTree_settings_filter_title', 'Фильтр'],
['app_navigationTree_settings_filter_description', 'Показывать фильтр'],
['app_navigationTree_settings_filter_all_title', 'Фильтровать скрытые элементы'],
@@ -14,7 +14,6 @@ export default [
['app_navigationTree_limited', 'Elements are limited to {args.limit} items'],
['app_navigationTree_action_link_with_editor', 'Link with editor'],
['app_navigationTree_action_collapse_all', 'Collapse all'],
['app_navigationTree_settings_title', 'Settings'],
['app_navigationTree_settings_filter_title', 'Filter'],
['app_navigationTree_settings_filter_description', 'Show filtering field'],
['app_navigationTree_settings_filter_all_title', 'Show collapsed'],
@@ -14,7 +14,7 @@ import { useService } from '@cloudbeaver/core-di';
export function useUserData<T>(
key: string,
defaultValue: () => T,
onUpdate: (data: T) => void,
onUpdate?: (data: T) => void,
validate?: (data: T) => boolean
): T {
const userDataService = useService(UserDataService);
@@ -25,7 +25,7 @@ export function useUserData<T>(
useEffect(() => {
if (previous !== data) {
onUpdate(data);
onUpdate?.(data);
}
});
@@ -26,7 +26,6 @@ export default [
['connections_connection_credentials_provisioning', 'Authentication credentials'],
['connections_connection_credentials_provisioning_description', 'You need to fill in or confirm the credentials to test this connection'],
['connections_connection_edit_authentication', 'Authentication'],
['connections_connection_edit_settings', 'Settings'],
['connections_connection_edit_access', 'Access'],
['connections_connection_edit_access_load_failed', 'Fail to get connection access'],
['connections_connection_edit_access_role', 'Role'],
@@ -25,7 +25,6 @@ export default [
['connections_connection_credentials_provisioning', 'Credenziali di autenticazione'],
['connections_connection_credentials_provisioning_description', 'Devi compilare o confermare le credenziali per provare questa connessione'],
['connections_connection_edit_authentication', 'Autenticazione'],
['connections_connection_edit_settings', 'Impostazioni'],
['connections_connection_edit_access', 'Accesso'],
['connections_connection_edit_access_load_failed', 'Errore al recupero dell\'accesso alla connessione'],
['connections_connection_edit_access_role', 'Ruolo'],
@@ -23,7 +23,6 @@ export default [
['connections_connection_credentials_provisioning', 'Аутентификационные данные'],
['connections_connection_credentials_provisioning_description', 'Чтобы проверить подключение, необходимо заполнить или подтвердить данные доступа'],
['connections_connection_edit_authentication', 'Авторизация'],
['connections_connection_edit_settings', 'Настройки'],
['connections_connection_edit_access', 'Доступ'],
['connections_connection_edit_access_load_failed', 'Не удалось загрузить информацию доступа'],
['connections_connection_edit_access_role', 'Роль'],
@@ -26,7 +26,6 @@ export default [
['connections_connection_credentials_provisioning', '认证凭据'],
['connections_connection_credentials_provisioning_description', '您却要填写或确认凭据以测试此连接。'],
['connections_connection_edit_authentication', '认证'],
['connections_connection_edit_settings', '设置'],
['connections_connection_edit_access', '权限'],
['connections_connection_edit_access_load_failed', '无法获取连接访问权限'],
['connections_connection_edit_access_role', '角色'],
@@ -41,7 +41,7 @@ export const defaultITLocale = [
['ui_no_items_placeholder', 'Non ci sono ancora elementi.'],
['ui_search_no_result_placeholder', 'Nessun risultato trovato.'],
['ui_save_reminder', 'Ci sono modifiche non salvate.'],
['ui_settings', 'Settings'],
['ui_settings', 'Impostazioni'],
['ui_expand', 'Expand'],
['ui_close_all', 'Close all'],
['ui_close_others', 'Close others'],
@@ -62,7 +62,7 @@ export const defaultZHLocale = [
['ui_changes_will_be_lost', '您的更改将丢失'],
['ui_continue', '继续'],
['ui_authentication', '认证'],
['ui_settings', 'Settings'],
['ui_settings', '设置'],
['ui_expand', 'Expand'],
['ui_close_all', 'Close all'],
['ui_close_others', 'Close others'],
@@ -0,0 +1,15 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { createAction } from '../createAction';
export const ACTION_SETTINGS = createAction('settings', {
label: 'ui_settings',
tooltip: 'ui_settings',
icon: '/icons/settings_cog_m.svg',
});
+1
View File
@@ -8,6 +8,7 @@ export * from './Action/Actions/ACTION_OPEN';
export * from './Action/Actions/ACTION_REFRESH';
export * from './Action/Actions/ACTION_RENAME';
export * from './Action/Actions/ACTION_SAVE';
export * from './Action/Actions/ACTION_SETTINGS';
export * from './Action/Actions/ACTION_ZOOM_IN';
export * from './Action/Actions/ACTION_ZOOM_OUT';
export * from './Action/KeyBinding/Bindings/KEY_BINDING_OPEN_IN_TAB';
@@ -287,7 +287,7 @@ export const Options: TabContainerPanelComponent<IConnectionFormProps> = observe
)}
{driverMap.isLoaded() && driver?.providerProperties && driver.providerProperties.length > 0 && (
<Group form gap>
<GroupTitle>{translate('connections_connection_edit_settings')}</GroupTitle>
<GroupTitle>{translate('ui_settings')}</GroupTitle>
{booleanProviderProperties && booleanProviderProperties.length > 0 && (
<Container gap wrap>
<ObjectPropertyInfoForm
@@ -6,6 +6,8 @@
* you may not use this file except in compliance with the License.
*/
import { action, computed, makeObservable, observable } from 'mobx';
import type { SqlDialectInfo } from '@cloudbeaver/core-sdk';
type RequireOne<T, K extends keyof T> = {
@@ -100,6 +102,33 @@ export class SQLParser {
this.lines = [];
this.customScriptDelimiters = [];
this.customQuotes = [["'", "'"]];
makeObservable<this, 'dialect' | '_scripts' | 'script' | 'parsedScript' | 'lines' | 'customScriptDelimiters' | 'update' | 'customQuotes'>(this, {
scriptDelimiters: computed,
quoteStrings: computed,
singleLineComments: computed,
multiLineComments: computed,
actualScript: computed,
dialect: observable.ref,
_scripts: observable.shallow,
script: observable.ref,
parsedScript: observable.ref,
lines: observable.shallow,
customScriptDelimiters: observable.ref,
customQuotes: observable.ref,
getScriptSegment: action,
getSegment: action,
getQueryAtPos: action,
getLineAtPos: action,
getScriptLineAtPos: action,
setScript: action,
setDialect: action,
setCustomDelimiters: action,
parse: action,
setQueries: action,
isEndsWithDelimiter: action,
update: action,
});
}
getScriptSegment(): ISQLScriptSegment {
@@ -0,0 +1,14 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2022 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { createDataContext } from '@cloudbeaver/core-view';
import type { ISQLEditorData } from './ISQLEditorData';
export const DATA_CONTEXT_SQL_EDITOR_DATA = createDataContext<ISQLEditorData>('sql-editor-data');
@@ -0,0 +1,58 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2019-2022 DBeaver Corp
*
* All Rights Reserved
*
* NOTICE: All information contained herein is, and remains
* the property of DBeaver Corp and its suppliers, if any.
* The intellectual and technical concepts contained
* herein are proprietary to DBeaver Corp and its suppliers
* and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from DBeaver Corp.
*/
import type { ISyncExecutor } from '@cloudbeaver/core-executor';
import type { SqlDialectInfo } from '@cloudbeaver/core-sdk';
import type { SQLProposal } from '../SqlEditorService';
import type { SQLParser, ISQLScriptSegment } from '../SQLParser';
export interface ISegmentExecutionData {
segment: ISQLScriptSegment;
type: 'start' | 'end' | 'error';
}
export interface ISQLEditorData {
readonly parser: SQLParser;
readonly dialect: SqlDialectInfo | undefined;
readonly activeSegment: ISQLScriptSegment | undefined;
readonly cursorSegment: ISQLScriptSegment | undefined;
readonly readonly: boolean;
readonly isLineScriptEmpty: boolean;
readonly isScriptEmpty: boolean;
readonly isDisabled: boolean;
readonly value: string;
readonly onExecute: ISyncExecutor<boolean>;
readonly onSegmentExecute: ISyncExecutor<ISegmentExecutionData>;
readonly onUpdate: ISyncExecutor;
updateParserScriptsThrottle(): Promise<void>;
setQuery(query: string): void;
init(): void;
destruct(): void;
setCursor(begin: number, end?: number): void;
formatScript(): Promise<void>;
executeQuery (): Promise<void>;
executeQueryNewTab(): Promise<void>;
showExecutionPlan(): Promise<void>;
executeScript(): Promise<void>;
getHintProposals(position: number, simple: boolean): Promise<SQLProposal[]>;
executeQueryAction<T>(
segment: ISQLScriptSegment | undefined,
action: (query: ISQLScriptSegment) => Promise<T>,
passEmpty?: boolean
): Promise<T | undefined>;
}
@@ -20,8 +20,8 @@ import type { IControlledCodeMirror } from 'react-codemirror2';
import { useExecutor, useObservableRef } from '@cloudbeaver/core-blocks';
import type { SqlCompletionProposal } from '@cloudbeaver/core-sdk';
import type { ISQLEditorData } from '../ISQLEditorData';
import type { SQLCodeEditorController } from '../SQLCodeEditor/SQLCodeEditorController';
import type { ISQLEditorData } from '../useSqlEditor';
interface ISQLCodeEditorPanelData {
proposalsWordFrom: Position | null;
@@ -13,59 +13,24 @@ import { useObservableRef } from '@cloudbeaver/core-blocks';
import { ConnectionExecutionContextService } from '@cloudbeaver/core-connections';
import { useService } from '@cloudbeaver/core-di';
import { CommonDialogService, ConfirmationDialog, DialogueStateResult } from '@cloudbeaver/core-dialogs';
import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor';
import { SyncExecutor } from '@cloudbeaver/core-executor';
import type { SqlDialectInfo } from '@cloudbeaver/core-sdk';
import { throttleAsync } from '@cloudbeaver/core-utils';
import type { ISqlEditorTabState } from '../ISqlEditorTabState';
import { SqlDialectInfoService } from '../SqlDialectInfoService';
import { SqlEditorService, SQLProposal } from '../SqlEditorService';
import { SqlEditorService } from '../SqlEditorService';
import { ISQLScriptSegment, SQLParser } from '../SQLParser';
import { SqlExecutionPlanService } from '../SqlResultTabs/ExecutionPlan/SqlExecutionPlanService';
import { SqlQueryService } from '../SqlResultTabs/SqlQueryService';
import { SqlResultTabsService } from '../SqlResultTabs/SqlResultTabsService';
import type { ISQLEditorData } from './ISQLEditorData';
interface ICursor {
begin: number;
end: number;
}
interface ISegmentExecutionData {
segment: ISQLScriptSegment;
type: 'start' | 'end' | 'error';
}
export interface ISQLEditorData {
readonly parser: SQLParser;
readonly dialect: SqlDialectInfo | undefined;
readonly activeSegment: ISQLScriptSegment | undefined;
readonly cursorSegment: ISQLScriptSegment | undefined;
readonly readonly: boolean;
readonly isLineScriptEmpty: boolean;
readonly isScriptEmpty: boolean;
readonly isDisabled: boolean;
readonly value: string;
readonly onExecute: ISyncExecutor<boolean>;
readonly onSegmentExecute: ISyncExecutor<ISegmentExecutionData>;
readonly onUpdate: ISyncExecutor;
updateParserScriptsThrottle(): Promise<void>;
setQuery(query: string): void;
init(): void;
destruct(): void;
setCursor(begin: number, end?: number): void;
formatScript(): Promise<void>;
executeQuery (): Promise<void>;
executeQueryNewTab(): Promise<void>;
showExecutionPlan(): Promise<void>;
executeScript(): Promise<void>;
getHintProposals(position: number, simple: boolean): Promise<SQLProposal[]>;
executeQueryAction<T>(
segment: ISQLScriptSegment | undefined,
action: (query: ISQLScriptSegment) => Promise<T>,
passEmpty?: boolean
): Promise<T | undefined>;
}
interface ISQLEditorDataPrivate extends ISQLEditorData {
readonly sqlDialectInfoService: SqlDialectInfoService;
readonly connectionExecutionContextService: ConnectionExecutionContextService;
@@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di';
import { TabsContainer } from '@cloudbeaver/core-ui';
import type { ISqlEditorTabState } from '@cloudbeaver/plugin-sql-editor';
import type { ISQLEditorData } from './SqlEditor/useSqlEditor';
import type { ISQLEditorData } from './SqlEditor/ISQLEditorData';
export interface ISqlEditorModeProps {
state: ISqlEditorTabState;
@@ -1,5 +1,7 @@
import { sqlEditorPluginManifest } from './manifest';
export * from './SqlEditor/SQLCodeEditor/SQLCodeEditorLoader';
export * from './SqlEditor/ISQLEditorData';
export * from './SqlEditor/DATA_CONTEXT_SQL_EDITOR_DATA';
export * from './SqlResultTabs/DATA_CONTEXT_SQL_EDITOR_RESULT_ID';
export * from './SqlResultTabs/SqlResultTabsService';
export * from './DATA_CONTEXT_SQL_EDITOR_STATE';