diff --git a/config/sample-databases/DefaultConfiguration/cloudbeaver.conf b/config/sample-databases/DefaultConfiguration/cloudbeaver.conf index e063bf739b..8f6ec86e77 100644 --- a/config/sample-databases/DefaultConfiguration/cloudbeaver.conf +++ b/config/sample-databases/DefaultConfiguration/cloudbeaver.conf @@ -21,9 +21,7 @@ plugin.sql-editor.maxFileSize: 10240, plugin.log-viewer.disabled: false, plugin.log-viewer.logBatchSize: 1000, - plugin.log-viewer.maxFailedRequests: 3, plugin.log-viewer.maxLogRecords: 2000, - plugin.log-viewer.refreshTimeout: 3000, sql.proposals.insert.table.alias: PLAIN }, diff --git a/config/sample-databases/SQLiteConfiguration/cloudbeaver.conf b/config/sample-databases/SQLiteConfiguration/cloudbeaver.conf index 3c96c0389e..da744d4914 100644 --- a/config/sample-databases/SQLiteConfiguration/cloudbeaver.conf +++ b/config/sample-databases/SQLiteConfiguration/cloudbeaver.conf @@ -19,9 +19,7 @@ plugin.sql-editor.maxFileSize: 10240, plugin.log-viewer.disabled: false, plugin.log-viewer.logBatchSize: 1000, - plugin.log-viewer.maxFailedRequests: 3, plugin.log-viewer.maxLogRecords: 2000, - plugin.log-viewer.refreshTimeout: 3000, sql.proposals.insert.table.alias: PLAIN }, diff --git a/webapp/packages/core-app/src/Body.tsx b/webapp/packages/core-app/src/Body.tsx index 76c1d0472a..03fcc3698b 100644 --- a/webapp/packages/core-app/src/Body.tsx +++ b/webapp/packages/core-app/src/Body.tsx @@ -50,7 +50,17 @@ export const Body = observer(function Body() { return ( -
+
{Screen && } diff --git a/webapp/packages/core-authentication/package.json b/webapp/packages/core-authentication/package.json index 297487e1dd..2cfe0dce7e 100644 --- a/webapp/packages/core-authentication/package.json +++ b/webapp/packages/core-authentication/package.json @@ -42,7 +42,7 @@ "@cloudbeaver/core-settings": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "msw": "^2", "typescript": "^5" } diff --git a/webapp/packages/core-authentication/src/AuthSettingsService.ts b/webapp/packages/core-authentication/src/AuthSettingsService.ts index eab876a6cf..97a365d3ae 100644 --- a/webapp/packages/core-authentication/src/AuthSettingsService.ts +++ b/webapp/packages/core-authentication/src/AuthSettingsService.ts @@ -34,7 +34,10 @@ export class AuthSettingsService { private registerSettings() { this.settingsManagerService.registerSettings(this.settings, () => [ // { - // key: 'disableAnonymousAccess', + // key: 'core.authentication.disableAnonymousAccess', + // access: { + // scope: ['server'], + // }, // type: ESettingsValueType.Checkbox, // name: 'settings_authentication_disable_anonymous_access_name', // description: 'settings_authentication_disable_anonymous_access_description', diff --git a/webapp/packages/core-blocks/package.json b/webapp/packages/core-blocks/package.json index 1f49900c14..8e274afb71 100644 --- a/webapp/packages/core-blocks/package.json +++ b/webapp/packages/core-blocks/package.json @@ -49,8 +49,8 @@ "@cloudbeaver/core-utils": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", "@testing-library/react": "^16", + "@types/jest": "^29", "@types/react": "^18", "mobx": "^6", "react": "^18", diff --git a/webapp/packages/core-blocks/src/localization/useTranslate.ts b/webapp/packages/core-blocks/src/localization/useTranslate.ts index 94a2f72989..1d7ece44e9 100644 --- a/webapp/packages/core-blocks/src/localization/useTranslate.ts +++ b/webapp/packages/core-blocks/src/localization/useTranslate.ts @@ -6,9 +6,9 @@ * you may not use this file except in compliance with the License. */ import { useService } from '@cloudbeaver/core-di'; -import { LocalizationService, type TLocalizationToken } from '@cloudbeaver/core-localization'; +import { LocalizationService, type TranslateFn } from '@cloudbeaver/core-localization'; -export function useTranslate(): (token: T, fallback?: T, args?: Record) => T { +export function useTranslate(): TranslateFn { const localizationService = useService(LocalizationService); return localizationService.translate; diff --git a/webapp/packages/core-browser-settings/package.json b/webapp/packages/core-browser-settings/package.json index d090d8d6b9..1a630abe73 100644 --- a/webapp/packages/core-browser-settings/package.json +++ b/webapp/packages/core-browser-settings/package.json @@ -34,7 +34,7 @@ "@cloudbeaver/core-settings": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/core-connections/src/ConnectionsSettingsService.ts b/webapp/packages/core-connections/src/ConnectionsSettingsService.ts index 42610067d7..8c583b6332 100644 --- a/webapp/packages/core-connections/src/ConnectionsSettingsService.ts +++ b/webapp/packages/core-connections/src/ConnectionsSettingsService.ts @@ -32,13 +32,17 @@ export class ConnectionsSettingsService extends Dependency { } private registerSettings() { - this.settingsManagerService.registerSettings(this.settings, () => [ - // { - // group: CONNECTIONS_SETTINGS_GROUP, - // key: 'disabled', - // name: 'Disable', - // type: ESettingsValueType.Checkbox, - // }, - ]); + // this.settingsManagerService.registerSettings(this.settings, () => [ + // { + // group: CONNECTIONS_SETTINGS_GROUP, + // key: 'core.connections.disabled', + // access: { + // scope: ['server'], + // }, + // name: 'core_connections_settings_disable', + // description: 'core_connections_settings_disable_description', + // type: ESettingsValueType.Checkbox, + // }, + // ]); } } diff --git a/webapp/packages/core-connections/src/locales/de.ts b/webapp/packages/core-connections/src/locales/de.ts index 18f2c534bb..c92b054ac0 100644 --- a/webapp/packages/core-connections/src/locales/de.ts +++ b/webapp/packages/core-connections/src/locales/de.ts @@ -55,4 +55,7 @@ export default [ ['connections_network_handler_ssh_tunnel_advanced_settings', 'Erweiterte Einstellungen'], ['connections_not_found', 'Es wurden keine Datenbankverbindungen gefunden'], ['connections_connection_autocommit', 'Auto commit'], + + ['core_connections_settings_disable', 'Disable'], + ['core_connections_settings_disable_description', 'Disable the ability to create new connections'], ]; diff --git a/webapp/packages/core-connections/src/locales/en.ts b/webapp/packages/core-connections/src/locales/en.ts index ec5ed27da8..ca44fcca48 100644 --- a/webapp/packages/core-connections/src/locales/en.ts +++ b/webapp/packages/core-connections/src/locales/en.ts @@ -99,4 +99,7 @@ export default [ 'cloud_connections_access_placeholder', 'Cloud connections are visible to all users. Access management can be configured in "AWS Management Console".', ], + + ['core_connections_settings_disable', 'Disable'], + ['core_connections_settings_disable_description', 'Disable the ability to create new connections'], ]; diff --git a/webapp/packages/core-connections/src/locales/fr.ts b/webapp/packages/core-connections/src/locales/fr.ts index 7cb705fa07..c38d142279 100644 --- a/webapp/packages/core-connections/src/locales/fr.ts +++ b/webapp/packages/core-connections/src/locales/fr.ts @@ -108,4 +108,7 @@ export default [ 'cloud_connections_access_placeholder', 'Les connexions cloud sont visibles par tous les utilisateurs. La gestion des accès peut être configurée dans la "AWS Management Console".', ], + + ['core_connections_settings_disable', 'Disable'], + ['core_connections_settings_disable_description', 'Disable the ability to create new connections'], ]; diff --git a/webapp/packages/core-connections/src/locales/it.ts b/webapp/packages/core-connections/src/locales/it.ts index 1d2dd96482..3d3002693b 100644 --- a/webapp/packages/core-connections/src/locales/it.ts +++ b/webapp/packages/core-connections/src/locales/it.ts @@ -97,4 +97,7 @@ export default [ 'cloud_connections_access_placeholder', 'Connessioni Cloud sono visibili a tutti gli utenti. Il gestore degli accessi può essere configurato in "AWS Management Console".', ], + + ['core_connections_settings_disable', 'Disable'], + ['core_connections_settings_disable_description', 'Disable the ability to create new connections'], ]; diff --git a/webapp/packages/core-connections/src/locales/ru.ts b/webapp/packages/core-connections/src/locales/ru.ts index 76ad21656b..ae8dfeae11 100644 --- a/webapp/packages/core-connections/src/locales/ru.ts +++ b/webapp/packages/core-connections/src/locales/ru.ts @@ -100,4 +100,7 @@ export default [ ['connections_not_found', 'Подключения к базам данных не найдены'], ['cloud_connections_access_placeholder', 'Облачные подключения видны всем пользователям. Вы можете настроить доступ в "Консоль Управления AWS".'], + + ['core_connections_settings_disable', 'Отключить'], + ['core_connections_settings_disable_description', 'Отключить возможность создания новых подключений'], ]; diff --git a/webapp/packages/core-connections/src/locales/zh.ts b/webapp/packages/core-connections/src/locales/zh.ts index a92afdd2f8..57f7bfbb5b 100644 --- a/webapp/packages/core-connections/src/locales/zh.ts +++ b/webapp/packages/core-connections/src/locales/zh.ts @@ -92,4 +92,7 @@ export default [ ['connections_not_found', '未找到数据库连接'], ['cloud_connections_access_placeholder', '云连接对所有用户可见。可以在“AWS管理控制台”中配置访问管理。'], + + ['core_connections_settings_disable', 'Disable'], + ['core_connections_settings_disable_description', 'Disable the ability to create new connections'], ]; diff --git a/webapp/packages/core-di/package.json b/webapp/packages/core-di/package.json index 5634ee3d45..8ec6bba0dd 100644 --- a/webapp/packages/core-di/package.json +++ b/webapp/packages/core-di/package.json @@ -27,6 +27,7 @@ "peerDependencies": {}, "devDependencies": { "@jest/globals": "^29", + "@types/jest": "^29", "@types/react": "^18", "typescript": "^5" } diff --git a/webapp/packages/core-events/package.json b/webapp/packages/core-events/package.json index b83e7ab89d..14e5c64400 100644 --- a/webapp/packages/core-events/package.json +++ b/webapp/packages/core-events/package.json @@ -21,6 +21,7 @@ "dependencies": { "@cloudbeaver/core-di": "^0", "@cloudbeaver/core-executor": "^0", + "@cloudbeaver/core-localization": "^0", "@cloudbeaver/core-sdk": "^0", "@cloudbeaver/core-settings": "^0", "@cloudbeaver/core-utils": "^0", @@ -35,7 +36,7 @@ "@cloudbeaver/core-settings": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/core-events/src/EventsSettingsService.ts b/webapp/packages/core-events/src/EventsSettingsService.ts index 22f0869920..f43f830977 100644 --- a/webapp/packages/core-events/src/EventsSettingsService.ts +++ b/webapp/packages/core-events/src/EventsSettingsService.ts @@ -56,14 +56,21 @@ export class EventsSettingsService extends Dependency { this.settingsManagerService.registerSettings(this.settings, () => [ // { // group: NOTIFICATIONS_SETTINGS_GROUP, - // key: 'maxPersistentAllow', + // key: 'plugin.notifications.maxPersistentAllow', + // access: { + // scope: ['client'], + // }, // name: 'Max persistent notifications count', // type: ESettingsValueType.Input, // }, // { // group: NOTIFICATIONS_SETTINGS_GROUP, - // key: 'notificationsPool', - // name: 'Max notifications count', + // key: 'plugin.notifications.notificationsPool', + // access: { + // scope: ['client'], + // }, + // name: 'core_events_notifications_settings_pool_size', + // description: 'core_events_notifications_settings_pool_size_description', // type: ESettingsValueType.Input, // }, ]); diff --git a/webapp/packages/core-events/src/LocaleService.ts b/webapp/packages/core-events/src/LocaleService.ts new file mode 100644 index 0000000000..a55cfec20e --- /dev/null +++ b/webapp/packages/core-events/src/LocaleService.ts @@ -0,0 +1,35 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 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 { Bootstrap, injectable } from '@cloudbeaver/core-di'; +import { LocalizationService } from '@cloudbeaver/core-localization'; + +@injectable() +export class LocaleService extends Bootstrap { + constructor(private readonly localizationService: LocalizationService) { + super(); + } + + override register(): void { + this.localizationService.addProvider(this.provider.bind(this)); + } + + private async provider(locale: string) { + switch (locale) { + case 'ru': + return (await import('./locales/ru.js')).default; + case 'it': + return (await import('./locales/it.js')).default; + case 'zh': + return (await import('./locales/zh.js')).default; + case 'fr': + return (await import('./locales/fr.js')).default; + default: + return (await import('./locales/en.js')).default; + } + } +} diff --git a/webapp/packages/core-events/src/NOTIFICATIONS_SETTINGS_GROUP.ts b/webapp/packages/core-events/src/NOTIFICATIONS_SETTINGS_GROUP.ts index 31f5768609..b780721949 100644 --- a/webapp/packages/core-events/src/NOTIFICATIONS_SETTINGS_GROUP.ts +++ b/webapp/packages/core-events/src/NOTIFICATIONS_SETTINGS_GROUP.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { ROOT_SETTINGS_GROUP } from '@cloudbeaver/core-settings'; +import { INTERFACE_SETTINGS_GROUP } from '@cloudbeaver/core-settings'; -export const NOTIFICATIONS_SETTINGS_GROUP = ROOT_SETTINGS_GROUP.createSubGroup('core_events_notifications_settings_group'); +export const NOTIFICATIONS_SETTINGS_GROUP = INTERFACE_SETTINGS_GROUP.createSubGroup('core_events_notifications_settings_group'); diff --git a/webapp/packages/core-events/src/locales/en.ts b/webapp/packages/core-events/src/locales/en.ts new file mode 100644 index 0000000000..7e898f0954 --- /dev/null +++ b/webapp/packages/core-events/src/locales/en.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_events_notifications_settings_group', 'Notifications'], + ['core_events_notifications_settings_pool_size', 'Max notifications count'], + ['core_events_notifications_settings_pool_size_description', 'Exceeding this amount, the oldest notifications will be deleted'], +]; diff --git a/webapp/packages/core-events/src/locales/fr.ts b/webapp/packages/core-events/src/locales/fr.ts new file mode 100644 index 0000000000..7e898f0954 --- /dev/null +++ b/webapp/packages/core-events/src/locales/fr.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_events_notifications_settings_group', 'Notifications'], + ['core_events_notifications_settings_pool_size', 'Max notifications count'], + ['core_events_notifications_settings_pool_size_description', 'Exceeding this amount, the oldest notifications will be deleted'], +]; diff --git a/webapp/packages/core-events/src/locales/it.ts b/webapp/packages/core-events/src/locales/it.ts new file mode 100644 index 0000000000..7e898f0954 --- /dev/null +++ b/webapp/packages/core-events/src/locales/it.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_events_notifications_settings_group', 'Notifications'], + ['core_events_notifications_settings_pool_size', 'Max notifications count'], + ['core_events_notifications_settings_pool_size_description', 'Exceeding this amount, the oldest notifications will be deleted'], +]; diff --git a/webapp/packages/core-events/src/locales/ru.ts b/webapp/packages/core-events/src/locales/ru.ts new file mode 100644 index 0000000000..483800f654 --- /dev/null +++ b/webapp/packages/core-events/src/locales/ru.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_events_notifications_settings_group', 'Уведомления'], + ['core_events_notifications_settings_pool_size', 'Максимальное количество уведомлений'], + ['core_events_notifications_settings_pool_size_description', 'Превышение этого количества приведет к удалению самых старых уведомлений'], +]; diff --git a/webapp/packages/core-events/src/locales/zh.ts b/webapp/packages/core-events/src/locales/zh.ts new file mode 100644 index 0000000000..7e898f0954 --- /dev/null +++ b/webapp/packages/core-events/src/locales/zh.ts @@ -0,0 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_events_notifications_settings_group', 'Notifications'], + ['core_events_notifications_settings_pool_size', 'Max notifications count'], + ['core_events_notifications_settings_pool_size_description', 'Exceeding this amount, the oldest notifications will be deleted'], +]; diff --git a/webapp/packages/core-events/src/manifest.ts b/webapp/packages/core-events/src/manifest.ts index 6c2c59dfb2..f625c33850 100644 --- a/webapp/packages/core-events/src/manifest.ts +++ b/webapp/packages/core-events/src/manifest.ts @@ -16,5 +16,6 @@ export const coreEventsManifest: PluginManifest = { () => import('./NotificationService.js').then(m => m.NotificationService), () => import('./ExceptionsCatcherService.js').then(m => m.ExceptionsCatcherService), () => import('./EventsSettingsService.js').then(m => m.EventsSettingsService), + () => import('./LocaleService.js').then(m => m.LocaleService), ], }; diff --git a/webapp/packages/core-events/tsconfig.json b/webapp/packages/core-events/tsconfig.json index 6093c6b809..639e649425 100644 --- a/webapp/packages/core-events/tsconfig.json +++ b/webapp/packages/core-events/tsconfig.json @@ -18,6 +18,9 @@ { "path": "../core-localization/tsconfig.json" }, + { + "path": "../core-localization/tsconfig.json" + }, { "path": "../core-root/tsconfig.json" }, diff --git a/webapp/packages/core-localization/src/TranslateFn.ts b/webapp/packages/core-localization/src/TranslateFn.ts new file mode 100644 index 0000000000..d4010526b9 --- /dev/null +++ b/webapp/packages/core-localization/src/TranslateFn.ts @@ -0,0 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 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 type { TLocalizationToken } from './TLocalizationToken.js'; + +export type TranslateFn = (token: T, fallback?: T, args?: Record) => T; diff --git a/webapp/packages/core-localization/src/index.ts b/webapp/packages/core-localization/src/index.ts index 802ca40f47..bb08cf4b91 100644 --- a/webapp/packages/core-localization/src/index.ts +++ b/webapp/packages/core-localization/src/index.ts @@ -10,3 +10,4 @@ export * from './LocalizationService.js'; export * from './Locale.js'; export * from './TLocalizationToken.js'; export * from './DEFAULT_LOCALE.js'; +export * from './TranslateFn.js'; diff --git a/webapp/packages/core-navigation-tree/package.json b/webapp/packages/core-navigation-tree/package.json index 282a7d2880..d0724af0bd 100644 --- a/webapp/packages/core-navigation-tree/package.json +++ b/webapp/packages/core-navigation-tree/package.json @@ -51,7 +51,7 @@ "@cloudbeaver/core-view": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.ts b/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.ts index 829dbf7a7a..33b3096d6f 100644 --- a/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.ts +++ b/webapp/packages/core-navigation-tree/src/NavTreeSettingsService.ts @@ -60,28 +60,37 @@ export class NavTreeSettingsService extends Dependency { } private registerSettings() { - this.settingsManagerService.registerSettings(this.settings, () => [ - // { - // key: 'childrenLimit', - // access: { - // accessor: ['server'], - // }, - // group: NAVIGATION_TREE_SETTINGS_GROUP, - // name: 'Children limit', - // type: ESettingsValueType.Input, - // }, - // { - // group: NAVIGATION_TREE_SETTINGS_GROUP, - // key: 'editing', - // name: 'Editing', - // type: ESettingsValueType.Checkbox, - // }, - // { - // group: NAVIGATION_TREE_SETTINGS_GROUP, - // key: 'deleting', - // name: 'Deleting', - // type: ESettingsValueType.Checkbox, - // }, - ]); + // this.settingsManagerService.registerSettings(this.settings, () => [ + // { + // key: 'core.navigation-tree.childrenLimit', + // access: { + // scope: ['server'], + // }, + // group: NAVIGATION_TREE_SETTINGS_GROUP, + // name: 'core_navigation_tree_settings_children_limit', + // description: 'core_navigation_tree_settings_children_limit_description', + // type: ESettingsValueType.Input, + // }, + // { + // group: NAVIGATION_TREE_SETTINGS_GROUP, + // key: 'core.navigation-tree.editing', + // access: { + // scope: ['server'], + // }, + // name: 'core_navigation_tree_settings_editing', + // description: 'core_navigation_tree_settings_editing_description', + // type: ESettingsValueType.Checkbox, + // }, + // { + // group: NAVIGATION_TREE_SETTINGS_GROUP, + // key: 'core.navigation-tree.deleting', + // access: { + // scope: ['server'], + // }, + // name: 'core_navigation_tree_settings_deleting', + // description: 'core_navigation_tree_settings_deleting_description', + // type: ESettingsValueType.Checkbox, + // }, + // ]); } } diff --git a/webapp/packages/core-navigation-tree/src/locales/en.ts b/webapp/packages/core-navigation-tree/src/locales/en.ts index a5841152eb..7619462963 100644 --- a/webapp/packages/core-navigation-tree/src/locales/en.ts +++ b/webapp/packages/core-navigation-tree/src/locales/en.ts @@ -1 +1,16 @@ -export default [['core_navigation_tree_navigation_tree_settings_group', 'Navigation Tree']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_navigation_tree_navigation_tree_settings_group', 'Navigation Tree'], + ['core_navigation_tree_settings_children_limit', 'Amount of nodes to load'], + ['core_navigation_tree_settings_children_limit_description', 'Amount of nodes to load in a single request'], + ['core_navigation_tree_settings_editing', 'Editing'], + ['core_navigation_tree_settings_editing_description', 'Allow editing nodes such as renaming'], + ['core_navigation_tree_settings_deleting', 'Deleting'], + ['core_navigation_tree_settings_deleting_description', 'Allow deleting nodes'], +]; diff --git a/webapp/packages/core-navigation-tree/src/locales/fr.ts b/webapp/packages/core-navigation-tree/src/locales/fr.ts index 57ba0d4c28..fab896a76f 100644 --- a/webapp/packages/core-navigation-tree/src/locales/fr.ts +++ b/webapp/packages/core-navigation-tree/src/locales/fr.ts @@ -5,4 +5,12 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -export default [['core_navigation_tree_navigation_tree_settings_group', 'Arborescence de navigation']]; +export default [ + ['core_navigation_tree_navigation_tree_settings_group', 'Arborescence de navigation'], + ['core_navigation_tree_settings_children_limit', 'Amount of nodes to load'], + ['core_navigation_tree_settings_children_limit_description', 'Amount of nodes to load in a single request'], + ['core_navigation_tree_settings_editing', 'Editing'], + ['core_navigation_tree_settings_editing_description', 'Allow editing nodes such as renaming'], + ['core_navigation_tree_settings_deleting', 'Deleting'], + ['core_navigation_tree_settings_deleting_description', 'Allow deleting nodes'], +]; diff --git a/webapp/packages/core-navigation-tree/src/locales/it.ts b/webapp/packages/core-navigation-tree/src/locales/it.ts index a5841152eb..7619462963 100644 --- a/webapp/packages/core-navigation-tree/src/locales/it.ts +++ b/webapp/packages/core-navigation-tree/src/locales/it.ts @@ -1 +1,16 @@ -export default [['core_navigation_tree_navigation_tree_settings_group', 'Navigation Tree']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_navigation_tree_navigation_tree_settings_group', 'Navigation Tree'], + ['core_navigation_tree_settings_children_limit', 'Amount of nodes to load'], + ['core_navigation_tree_settings_children_limit_description', 'Amount of nodes to load in a single request'], + ['core_navigation_tree_settings_editing', 'Editing'], + ['core_navigation_tree_settings_editing_description', 'Allow editing nodes such as renaming'], + ['core_navigation_tree_settings_deleting', 'Deleting'], + ['core_navigation_tree_settings_deleting_description', 'Allow deleting nodes'], +]; diff --git a/webapp/packages/core-navigation-tree/src/locales/ru.ts b/webapp/packages/core-navigation-tree/src/locales/ru.ts index 5463ca5f15..b723d18794 100644 --- a/webapp/packages/core-navigation-tree/src/locales/ru.ts +++ b/webapp/packages/core-navigation-tree/src/locales/ru.ts @@ -1 +1,16 @@ -export default [['core_navigation_tree_navigation_tree_settings_group', 'Дерево навигации']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['core_navigation_tree_navigation_tree_settings_group', 'Дерево навигации'], + ['core_navigation_tree_settings_children_limit', 'Количество загружаемых дочерних элементов'], + ['core_navigation_tree_settings_children_limit_description', 'Количество загружаемых дочерних элементов за один запрос'], + ['core_navigation_tree_settings_editing', 'Редактирование'], + ['core_navigation_tree_settings_editing_description', 'Разрешить редактирование узлов, такое как переименование'], + ['core_navigation_tree_settings_deleting', 'Удаление'], + ['core_navigation_tree_settings_deleting_description', 'Разрешить удаление узлов'], +]; diff --git a/webapp/packages/core-navigation-tree/src/locales/zh.ts b/webapp/packages/core-navigation-tree/src/locales/zh.ts index c3c4f9e116..290388ff22 100644 --- a/webapp/packages/core-navigation-tree/src/locales/zh.ts +++ b/webapp/packages/core-navigation-tree/src/locales/zh.ts @@ -5,4 +5,12 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -export default [['core_navigation_tree_navigation_tree_settings_group', '导航树']]; +export default [ + ['core_navigation_tree_navigation_tree_settings_group', '导航树'], + ['core_navigation_tree_settings_children_limit', 'Amount of nodes to load'], + ['core_navigation_tree_settings_children_limit_description', 'Amount of nodes to load in a single request'], + ['core_navigation_tree_settings_editing', 'Editing'], + ['core_navigation_tree_settings_editing_description', 'Allow editing nodes such as renaming'], + ['core_navigation_tree_settings_deleting', 'Deleting'], + ['core_navigation_tree_settings_deleting_description', 'Allow deleting nodes'], +]; diff --git a/webapp/packages/core-resource/package.json b/webapp/packages/core-resource/package.json index eeb742f417..40519062f6 100644 --- a/webapp/packages/core-resource/package.json +++ b/webapp/packages/core-resource/package.json @@ -26,6 +26,7 @@ }, "devDependencies": { "@jest/globals": "^29", + "@types/jest": "^29", "mobx": "^6", "typescript": "^5" }, diff --git a/webapp/packages/core-root/package.json b/webapp/packages/core-root/package.json index 26541696b3..d4951f0386 100644 --- a/webapp/packages/core-root/package.json +++ b/webapp/packages/core-root/package.json @@ -35,6 +35,8 @@ "@cloudbeaver/core-sdk": "^0", "@cloudbeaver/core-website": "^0", "@cloudbeaver/tests-runner": "^0", + "@jest/globals": "^29", + "@types/jest": "^29", "msw": "^2", "typescript": "^5" } diff --git a/webapp/packages/core-root/src/ServerConfigResource.ts b/webapp/packages/core-root/src/ServerConfigResource.ts index 0f65d8234e..ec8e86c09f 100644 --- a/webapp/packages/core-root/src/ServerConfigResource.ts +++ b/webapp/packages/core-root/src/ServerConfigResource.ts @@ -8,7 +8,6 @@ import { injectable } from '@cloudbeaver/core-di'; import { CachedDataResource } from '@cloudbeaver/core-resource'; import { GraphQLService, type ServerConfigFragment, type ServerConfigInput } from '@cloudbeaver/core-sdk'; -import { isArraysEqual } from '@cloudbeaver/core-utils'; import { DataSynchronizationQueue } from './DataSynchronization/DataSynchronizationQueue.js'; import { DataSynchronizationService } from './DataSynchronization/DataSynchronizationService.js'; diff --git a/webapp/packages/core-settings-localization/package.json b/webapp/packages/core-settings-localization/package.json index 19ff3146f0..d7a985444e 100644 --- a/webapp/packages/core-settings-localization/package.json +++ b/webapp/packages/core-settings-localization/package.json @@ -34,7 +34,7 @@ "@cloudbeaver/core-settings": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/core-settings/package.json b/webapp/packages/core-settings/package.json index 86d37bf3a0..56b414d111 100644 --- a/webapp/packages/core-settings/package.json +++ b/webapp/packages/core-settings/package.json @@ -30,7 +30,7 @@ "@cloudbeaver/core-executor": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/core-theming/package.json b/webapp/packages/core-theming/package.json index 302b061864..ac1f2f0656 100644 --- a/webapp/packages/core-theming/package.json +++ b/webapp/packages/core-theming/package.json @@ -47,7 +47,7 @@ "@material/switch": "^4", "@material/theme": "^4", "@material/typography": "^4", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5", "typescript-plugin-css-modules": "^5" } diff --git a/webapp/packages/core-utils/package.json b/webapp/packages/core-utils/package.json index d213a42b05..440ed3301a 100644 --- a/webapp/packages/core-utils/package.json +++ b/webapp/packages/core-utils/package.json @@ -35,6 +35,7 @@ "peerDependencies": {}, "devDependencies": { "@jest/globals": "^29", + "@types/jest": "^29", "@types/md5": "^2", "@types/underscore": "^1", "@types/uuid": "^10", diff --git a/webapp/packages/plugin-connection-search/src/ConnectionSearchSettingsService.ts b/webapp/packages/plugin-connection-search/src/ConnectionSearchSettingsService.ts index 5fb8ef495f..9346a8cfa7 100644 --- a/webapp/packages/plugin-connection-search/src/ConnectionSearchSettingsService.ts +++ b/webapp/packages/plugin-connection-search/src/ConnectionSearchSettingsService.ts @@ -5,8 +5,9 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { CONNECTIONS_SETTINGS_GROUP } from '@cloudbeaver/core-connections'; import { Dependency, injectable } from '@cloudbeaver/core-di'; -import { SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; +import { ESettingsValueType, SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; import { schema, schemaExtra } from '@cloudbeaver/core-utils'; const settings = schema.object({ @@ -32,12 +33,16 @@ export class ConnectionSearchSettingsService extends Dependency { private registerSettings() { this.settingsManagerService.registerSettings(this.settings, () => [ - // { - // group: CONNECTIONS_SETTINGS_GROUP, - // key: 'disabled', - // type: ESettingsValueType.Checkbox, - // name: 'Disable connection search', - // }, + { + group: CONNECTIONS_SETTINGS_GROUP, + key: 'plugin.connection-search.disabled', + access: { + scope: ['server'], + }, + type: ESettingsValueType.Checkbox, + name: 'plugin_connection_search_settings_disable', + description: 'plugin_connection_search_settings_disable_description', + }, ]); } } diff --git a/webapp/packages/plugin-connection-search/src/locales/en.ts b/webapp/packages/plugin-connection-search/src/locales/en.ts index 50ae687c7f..d99b5104c5 100644 --- a/webapp/packages/plugin-connection-search/src/locales/en.ts +++ b/webapp/packages/plugin-connection-search/src/locales/en.ts @@ -1 +1,12 @@ -export default [['plugin_connection_search_action_search_label', 'Find Local Database']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['plugin_connection_search_action_search_label', 'Find Local Database'], + ['plugin_connection_search_settings_disable', 'Disable "{alias:plugin_connection_search_action_search_label}"'], + ['plugin_connection_search_settings_disable_description', 'Disable the ability to search connections on a specific address'], +]; diff --git a/webapp/packages/plugin-connection-search/src/locales/fr.ts b/webapp/packages/plugin-connection-search/src/locales/fr.ts index 7598c9cb1e..a371fbcb02 100644 --- a/webapp/packages/plugin-connection-search/src/locales/fr.ts +++ b/webapp/packages/plugin-connection-search/src/locales/fr.ts @@ -5,4 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -export default [['plugin_connection_search_action_search_label', 'Trouver une base de données locale']]; +export default [ + ['plugin_connection_search_action_search_label', 'Trouver une base de données locale'], + ['plugin_connection_search_settings_disable', 'Disable "{alias:plugin_connection_search_action_search_label}"'], + ['plugin_connection_search_settings_disable_description', 'Disable the ability to search connections on a specific address'], +]; diff --git a/webapp/packages/plugin-connection-search/src/locales/it.ts b/webapp/packages/plugin-connection-search/src/locales/it.ts index 50ae687c7f..d99b5104c5 100644 --- a/webapp/packages/plugin-connection-search/src/locales/it.ts +++ b/webapp/packages/plugin-connection-search/src/locales/it.ts @@ -1 +1,12 @@ -export default [['plugin_connection_search_action_search_label', 'Find Local Database']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['plugin_connection_search_action_search_label', 'Find Local Database'], + ['plugin_connection_search_settings_disable', 'Disable "{alias:plugin_connection_search_action_search_label}"'], + ['plugin_connection_search_settings_disable_description', 'Disable the ability to search connections on a specific address'], +]; diff --git a/webapp/packages/plugin-connection-search/src/locales/ru.ts b/webapp/packages/plugin-connection-search/src/locales/ru.ts index dfde2fdaf0..4730465083 100644 --- a/webapp/packages/plugin-connection-search/src/locales/ru.ts +++ b/webapp/packages/plugin-connection-search/src/locales/ru.ts @@ -1 +1,12 @@ -export default [['plugin_connection_search_action_search_label', 'Найти локальную базу данных']]; +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +export default [ + ['plugin_connection_search_action_search_label', 'Найти локальную базу данных'], + ['plugin_connection_search_settings_disable', 'Отключить "{alias:plugin_connection_search_action_search_label}"'], + ['plugin_connection_search_settings_disable_description', 'Отключить возможность поиска подключений по заданному адресу'], +]; diff --git a/webapp/packages/plugin-connection-search/src/locales/zh.ts b/webapp/packages/plugin-connection-search/src/locales/zh.ts index 11e6f384da..fd82a90802 100644 --- a/webapp/packages/plugin-connection-search/src/locales/zh.ts +++ b/webapp/packages/plugin-connection-search/src/locales/zh.ts @@ -5,4 +5,8 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -export default [['plugin_connection_search_action_search_label', '查找本地数据库']]; +export default [ + ['plugin_connection_search_action_search_label', '查找本地数据库'], + ['plugin_connection_search_settings_disable', 'Disable "{alias:plugin_connection_search_action_search_label}"'], + ['plugin_connection_search_settings_disable_description', 'Disable the ability to search connections on a specific address'], +]; diff --git a/webapp/packages/plugin-connections/src/PluginConnectionsSettingsService.ts b/webapp/packages/plugin-connections/src/PluginConnectionsSettingsService.ts index 2ea00ee24b..d9ef4cec64 100644 --- a/webapp/packages/plugin-connections/src/PluginConnectionsSettingsService.ts +++ b/webapp/packages/plugin-connections/src/PluginConnectionsSettingsService.ts @@ -33,14 +33,18 @@ export class PluginConnectionsSettingsService extends Dependency { } private registerSettings() { - this.settingsManagerService.registerSettings(this.settings, () => [ - // { - // key: 'hideConnectionViewForUsers', - // type: ESettingsValueType.Checkbox, - // name: 'settings_connections_hide_connections_view_name', - // description: 'settings_connections_hide_connections_view_description', - // group: CONNECTIONS_SETTINGS_GROUP, - // }, - ]); + // todo: probably not working as a separate setting + // this.settingsManagerService.registerSettings(this.settings, () => [ + // { + // key: 'plugin.connections.hideConnectionViewForUsers', + // type: ESettingsValueType.Checkbox, + // access: { + // scope: ['server'], + // }, + // name: 'settings_connections_hide_connections_view_name', + // description: 'settings_connections_hide_connections_view_description', + // group: CONNECTIONS_SETTINGS_GROUP, + // }, + // ]); } } diff --git a/webapp/packages/plugin-connections/src/locales/en.ts b/webapp/packages/plugin-connections/src/locales/en.ts index a3d798c17f..3935d3b310 100644 --- a/webapp/packages/plugin-connections/src/locales/en.ts +++ b/webapp/packages/plugin-connections/src/locales/en.ts @@ -23,8 +23,8 @@ export default [ ['plugin_connections_menu_connections_label', 'Connection'], ['plugin_connections_action_disconnect_all_label', 'Disconnect All'], ['settings_connections', 'Connections'], - ['settings_connections_hide_connections_view_name', 'Show connections to admins only'], - ['settings_connections_hide_connections_view_description', 'Show connections to admins only'], + ['settings_connections_hide_connections_view_name', 'Hide connections'], + ['settings_connections_hide_connections_view_description', 'Connections will be hidden for all users except administrators'], ['connections_public_connection_ssl_enable', 'Enable SSL'], diff --git a/webapp/packages/plugin-connections/src/locales/fr.ts b/webapp/packages/plugin-connections/src/locales/fr.ts index fce351a57b..517a392ba6 100644 --- a/webapp/packages/plugin-connections/src/locales/fr.ts +++ b/webapp/packages/plugin-connections/src/locales/fr.ts @@ -7,28 +7,40 @@ */ export default [ ['connections_public_connection_edit_menu_item_title', 'Modifier la connexion'], - ['connections_public_connection_edit_cancel_title', 'Confirmation d\'annulation'], - ['connections_public_connection_edit_cancel_message', 'Vous allez annuler les modifications de la connexion. Les modifications non enregistrées seront perdues. Êtes-vous sûr ?'], + ['connections_public_connection_edit_cancel_title', "Confirmation d'annulation"], + [ + 'connections_public_connection_edit_cancel_message', + 'Vous allez annuler les modifications de la connexion. Les modifications non enregistrées seront perdues. Êtes-vous sûr ?', + ], ['connections_public_connection_edit_reconnect_title', 'Connexion mise à jour'], ['connections_public_connection_edit_reconnect_message', 'La connexion a été mise à jour. Voulez-vous vous reconnecter ?'], ['connections_public_connection_edit_reconnect_failed', 'Échec de la reconnexion'], ['connections_public_connection_folder_move_failed', 'Échec du déplacement vers le dossier'], - ['connections_public_connection_folder_move_duplication', 'Le dossier cible ou les dossiers sélectionnés contiennent un dossier portant le même nom ({arg:name})'], - ['connections_public_connection_cloud_auth_required', 'Vous devez vous connecter avec les identifiants "{arg:providerLabel}" pour travailler avec cette connexion.'], - ['plugin_connections_connection_form_project_invalid', 'Vous n\'avez pas accès à la création de connexions dans le projet sélectionné'], - ['plugin_connections_connection_form_host_configuration_invalid', 'La configuration de l\'hôte n\'est pas supportée'], + [ + 'connections_public_connection_folder_move_duplication', + 'Le dossier cible ou les dossiers sélectionnés contiennent un dossier portant le même nom ({arg:name})', + ], + [ + 'connections_public_connection_cloud_auth_required', + 'Vous devez vous connecter avec les identifiants "{arg:providerLabel}" pour travailler avec cette connexion.', + ], + ['plugin_connections_connection_form_project_invalid', "Vous n'avez pas accès à la création de connexions dans le projet sélectionné"], + ['plugin_connections_connection_form_host_configuration_invalid', "La configuration de l'hôte n'est pas supportée"], ['plugin_connections_connection_form_name_invalid', 'Le champ "Nom de la connexion" ne peut pas être vide'], ['plugin_connections_connection_form_host_invalid', 'Le champ "Hôte" ne peut pas être vide'], - ['connections_public_connection_folder_delete_confirmation', 'Vous allez supprimer "{arg:name}". Les connexions ne seront pas supprimées. Êtes-vous sûr ?'], + [ + 'connections_public_connection_folder_delete_confirmation', + 'Vous allez supprimer "{arg:name}". Les connexions ne seront pas supprimées. Êtes-vous sûr ?', + ], ['plugin_connections_menu_connections_label', 'Connexion'], ['plugin_connections_action_disconnect_all_label', 'Déconnecter tout'], ['settings_connections', 'Connexions'], - ['settings_connections_hide_connections_view_name', 'Afficher les connexions uniquement aux administrateurs'], - ['settings_connections_hide_connections_view_description', 'Afficher les connexions uniquement aux administrateurs'], + ['settings_connections_hide_connections_view_name', 'Hide connections'], + ['settings_connections_hide_connections_view_description', 'Connections will be hidden for all users except administrators'], ['connections_public_connection_ssl_enable', 'Activer SSL'], - ['plugin_connections_connection_form_shared_credentials_manage_info', 'Vous pouvez gérer les identifiants dans l\'onglet '], + ['plugin_connections_connection_form_shared_credentials_manage_info', "Vous pouvez gérer les identifiants dans l'onglet "], ['plugin_connections_connection_form_shared_credentials_manage_info_tab_link', 'Onglet Identifiants'], ['plugin_connections_connection_auth_secret_description', 'Veuillez sélectionner les identifiants fournis par une de vos équipes'], ]; diff --git a/webapp/packages/plugin-connections/src/locales/it.ts b/webapp/packages/plugin-connections/src/locales/it.ts index eeebf2ec13..aab2d88d4e 100644 --- a/webapp/packages/plugin-connections/src/locales/it.ts +++ b/webapp/packages/plugin-connections/src/locales/it.ts @@ -1,3 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ ['connections_public_connection_edit_menu_item_title', 'Modifica Connessione'], ['connections_public_connection_edit_cancel_title', "Conferma l'annullamento"], @@ -18,8 +25,8 @@ export default [ ['plugin_connections_menu_connections_label', 'Connessione'], ['plugin_connections_action_disconnect_all_label', 'Scollegati da tutto'], ['settings_connections', 'Connections'], - ['settings_connections_hide_connections_view_name', 'Show connections to admins only'], - ['settings_connections_hide_connections_view_description', 'Show connections to admins only'], + ['settings_connections_hide_connections_view_name', 'Hide connections'], + ['settings_connections_hide_connections_view_description', 'Connections will be hidden for all users except administrators'], ['connections_public_connection_ssl_enable', 'Enable SSL'], diff --git a/webapp/packages/plugin-connections/src/locales/ru.ts b/webapp/packages/plugin-connections/src/locales/ru.ts index fcadb4f931..0e420e9687 100644 --- a/webapp/packages/plugin-connections/src/locales/ru.ts +++ b/webapp/packages/plugin-connections/src/locales/ru.ts @@ -23,8 +23,8 @@ export default [ ['plugin_connections_menu_connections_label', 'Подключение'], ['plugin_connections_action_disconnect_all_label', 'Отключить все'], ['settings_connections', 'Подключения'], - ['settings_connections_hide_connections_view_name', 'Показывать подключения только администраторам'], - ['settings_connections_hide_connections_view_description', 'Показывать подключения только администраторам'], + ['settings_connections_hide_connections_view_name', 'Скрыть подключения'], + ['settings_connections_hide_connections_view_description', 'Подключения будут скрыты для всех пользователей, кроме администраторов'], ['connections_public_connection_ssl_enable', 'Включить SSL'], diff --git a/webapp/packages/plugin-connections/src/locales/zh.ts b/webapp/packages/plugin-connections/src/locales/zh.ts index 77889926b8..4d77c92380 100644 --- a/webapp/packages/plugin-connections/src/locales/zh.ts +++ b/webapp/packages/plugin-connections/src/locales/zh.ts @@ -22,15 +22,12 @@ export default [ ['plugin_connections_menu_connections_label', '连接'], ['plugin_connections_action_disconnect_all_label', '断开所有连接'], ['settings_connections', '连接'], - ['settings_connections_hide_connections_view_name', '仅对管理员显示连接'], - ['settings_connections_hide_connections_view_description', '仅对管理员显示连接'], + ['settings_connections_hide_connections_view_name', 'Hide connections'], + ['settings_connections_hide_connections_view_description', 'Connections will be hidden for all users except administrators'], ['connections_public_connection_ssl_enable', '启用 SSL'], ['plugin_connections_connection_form_shared_credentials_manage_info', '您可在此管理凭证 '], ['plugin_connections_connection_form_shared_credentials_manage_info_tab_link', '凭证页签'], - [ - 'plugin_connections_connection_auth_secret_description', - '有多个凭证可用于身份验证.\n请选择您要使用的凭证。', - ], + ['plugin_connections_connection_auth_secret_description', '有多个凭证可用于身份验证.\n请选择您要使用的凭证。'], ]; diff --git a/webapp/packages/plugin-data-spreadsheet-new/package.json b/webapp/packages/plugin-data-spreadsheet-new/package.json index 17c897ab45..a5a3732ee2 100644 --- a/webapp/packages/plugin-data-spreadsheet-new/package.json +++ b/webapp/packages/plugin-data-spreadsheet-new/package.json @@ -68,7 +68,7 @@ "@cloudbeaver/plugin-object-viewer": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "@types/react": "^18", "typescript": "^5", "typescript-plugin-css-modules": "^5" diff --git a/webapp/packages/plugin-data-viewer/package.json b/webapp/packages/plugin-data-viewer/package.json index 5e89e2be5b..ef1112a9c0 100644 --- a/webapp/packages/plugin-data-viewer/package.json +++ b/webapp/packages/plugin-data-viewer/package.json @@ -70,7 +70,7 @@ "@cloudbeaver/plugin-object-viewer": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "@types/react": "^18", "typescript": "^5", "typescript-plugin-css-modules": "^5" diff --git a/webapp/packages/plugin-devtools/src/DevToolsService.ts b/webapp/packages/plugin-devtools/src/DevToolsService.ts index 0012672614..ae29b2b58d 100644 --- a/webapp/packages/plugin-devtools/src/DevToolsService.ts +++ b/webapp/packages/plugin-devtools/src/DevToolsService.ts @@ -13,8 +13,9 @@ import { StorageService } from '@cloudbeaver/core-storage'; interface IDevToolsSettings { enabled: boolean; - distributed: boolean; - configuration: boolean; + override: boolean; + distributed: boolean | null; + configuration: boolean | null; } const DEVTOOLS = 'devtools'; @@ -25,12 +26,23 @@ export class DevToolsService { return this.settings.enabled; } + get isOverride(): boolean { + return this.settings.override; + } + get isDistributed(): boolean { - return this.settings.distributed; + if (!this.isOverride) { + return this.serverConfigResource.data?.distributed ?? false; + } + + return this.settings.distributed ?? this.serverConfigResource.data?.distributed ?? false; } get isConfiguration(): boolean { - return this.settings.configuration; + if (!this.isOverride) { + return this.serverConfigResource.data?.configurationMode ?? false; + } + return this.settings.configuration ?? this.serverConfigResource.data?.configurationMode ?? false; } private readonly settings: IDevToolsSettings; @@ -53,6 +65,11 @@ export class DevToolsService { this.syncSettingsOverride(); } + setOverride(override: boolean) { + this.settings.override = override; + this.syncSettingsOverride(); + } + setDistributedMode(distributed: boolean) { this.settings.distributed = distributed; this.syncSettingsOverride(); @@ -64,10 +81,14 @@ export class DevToolsService { } private syncSettingsOverride() { - if (this.isEnabled) { + if (this.isOverride && this.isEnabled) { if (this.serverConfigResource.data) { - this.serverConfigResource.data.distributed = this.isDistributed; - this.serverConfigResource.data.configurationMode = this.isConfiguration; + if (this.settings.distributed !== null) { + this.serverConfigResource.data.distributed = this.isDistributed; + } + if (this.settings.configuration !== null) { + this.serverConfigResource.data.configurationMode = this.isConfiguration; + } } } } @@ -76,7 +97,8 @@ export class DevToolsService { function getDefaultDevToolsSettings(): IDevToolsSettings { return { enabled: process.env['NODE_ENV'] === 'development', - distributed: false, - configuration: false, + override: false, + distributed: null, + configuration: null, }; } diff --git a/webapp/packages/plugin-devtools/src/PluginBootstrap.ts b/webapp/packages/plugin-devtools/src/PluginBootstrap.ts index ce7cfb8ed1..d5ecff41f5 100644 --- a/webapp/packages/plugin-devtools/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-devtools/src/PluginBootstrap.ts @@ -15,6 +15,7 @@ import { MENU_USER_PROFILE } from '@cloudbeaver/plugin-user-profile'; import { ACTION_DEVTOOLS } from './actions/ACTION_DEVTOOLS.js'; import { ACTION_DEVTOOLS_MODE_CONFIGURATION } from './actions/ACTION_DEVTOOLS_MODE_CONFIGURATION.js'; import { ACTION_DEVTOOLS_MODE_DISTRIBUTED } from './actions/ACTION_DEVTOOLS_MODE_DISTRIBUTED.js'; +import { ACTION_DEVTOOLS_OVERRIDE } from './actions/ACTION_DEVTOOLS_OVERRIDE.js'; import { DATA_CONTEXT_MENU_SEARCH } from './ContextMenu/DATA_CONTEXT_MENU_SEARCH.js'; import { SearchResourceMenuItem } from './ContextMenu/SearchResourceMenuItem.js'; import { DevToolsService } from './DevToolsService.js'; @@ -89,7 +90,14 @@ export class PluginBootstrap extends Bootstrap { ]; } - return [new SearchResourceMenuItem(), ACTION_DEVTOOLS_MODE_DISTRIBUTED, ACTION_DEVTOOLS_MODE_CONFIGURATION, MENU_PLUGINS, ...items]; + return [ + new SearchResourceMenuItem(), + ACTION_DEVTOOLS_OVERRIDE, + ACTION_DEVTOOLS_MODE_DISTRIBUTED, + ACTION_DEVTOOLS_MODE_CONFIGURATION, + MENU_PLUGINS, + ...items, + ]; }, }); @@ -97,6 +105,7 @@ export class PluginBootstrap extends Bootstrap { id: 'devtools-mode-configuration', actions: [ACTION_DEVTOOLS_MODE_CONFIGURATION], isChecked: () => this.devToolsService.isConfiguration, + isDisabled: () => !this.devToolsService.isOverride, handler: () => { this.devToolsService.setConfigurationMode(!this.devToolsService.isConfiguration); }, @@ -106,11 +115,21 @@ export class PluginBootstrap extends Bootstrap { id: 'devtools-mode-distributed', actions: [ACTION_DEVTOOLS_MODE_DISTRIBUTED], isChecked: () => this.devToolsService.isDistributed, + isDisabled: () => !this.devToolsService.isOverride, handler: () => { this.devToolsService.setDistributedMode(!this.devToolsService.isDistributed); }, }); + this.actionService.addHandler({ + id: 'devtools-override', + actions: [ACTION_DEVTOOLS_OVERRIDE], + isChecked: () => this.devToolsService.isOverride, + handler: () => { + this.devToolsService.setOverride(!this.devToolsService.isOverride); + }, + }); + this.menuService.addCreator({ menus: [MENU_PLUGINS], getItems: (context, items) => [ diff --git a/webapp/packages/plugin-devtools/src/actions/ACTION_DEVTOOLS_OVERRIDE.ts b/webapp/packages/plugin-devtools/src/actions/ACTION_DEVTOOLS_OVERRIDE.ts new file mode 100644 index 0000000000..ed89d2946a --- /dev/null +++ b/webapp/packages/plugin-devtools/src/actions/ACTION_DEVTOOLS_OVERRIDE.ts @@ -0,0 +1,14 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 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 '@cloudbeaver/core-view'; + +export const ACTION_DEVTOOLS_OVERRIDE = createAction('devtools-override', { + type: 'checkbox', + label: 'Override', + tooltip: 'Override server settings', +}); diff --git a/webapp/packages/plugin-log-viewer/package.json b/webapp/packages/plugin-log-viewer/package.json index edda5124df..a7c1cbdd02 100644 --- a/webapp/packages/plugin-log-viewer/package.json +++ b/webapp/packages/plugin-log-viewer/package.json @@ -50,7 +50,7 @@ "@cloudbeaver/plugin-tools-panel": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "@types/react": "^18", "typescript": "^5", "typescript-plugin-css-modules": "^5" diff --git a/webapp/packages/plugin-log-viewer/src/LogViewer/LOG_VIEWER_SETTINGS_GROUP.ts b/webapp/packages/plugin-log-viewer/src/LogViewer/LOG_VIEWER_SETTINGS_GROUP.ts index ecf989c917..97ec356b58 100644 --- a/webapp/packages/plugin-log-viewer/src/LogViewer/LOG_VIEWER_SETTINGS_GROUP.ts +++ b/webapp/packages/plugin-log-viewer/src/LogViewer/LOG_VIEWER_SETTINGS_GROUP.ts @@ -5,6 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { ROOT_SETTINGS_GROUP } from '@cloudbeaver/core-settings'; +import { TOOLS_PANEL_SETTINGS_GROUP } from '@cloudbeaver/plugin-tools-panel'; -export const LOG_VIEWER_SETTINGS_GROUP = ROOT_SETTINGS_GROUP.createSubGroup('plugin_log_viewer_log_viewer_settings_group'); +export const LOG_VIEWER_SETTINGS_GROUP = TOOLS_PANEL_SETTINGS_GROUP.createSubGroup('plugin_log_viewer_log_viewer_settings_group'); diff --git a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts index 9a0f3d7aa5..ebfc00f2ef 100644 --- a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts +++ b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.test.ts @@ -53,19 +53,15 @@ const app = createApp( ); const deprecatedSettings = { - 'core.app.logViewer.refreshTimeout': 1, 'core.app.logViewer.maxLogRecords': 2, 'core.app.logViewer.logBatchSize': 3, - 'core.app.logViewer.maxFailedRequests': 4, 'core.app.logViewer.disabled': true, }; const newSettings = { ...deprecatedSettings, - 'plugin.log-viewer.refreshTimeout': 5, 'plugin.log-viewer.maxLogRecords': 6, 'plugin.log-viewer.logBatchSize': 7, - 'plugin.log-viewer.maxFailedRequests': 8, 'plugin.log-viewer.disabled': false, }; @@ -77,10 +73,8 @@ test('New settings override deprecated settings', async () => { await config.refresh(); - expect(settings.refreshTimeout).toBe(5); expect(settings.maxLogRecords).toBe(6); expect(settings.logBatchSize).toBe(7); - expect(settings.maxFailedRequests).toBe(8); expect(settings.disabled).toBe(false); expectNoDeprecatedSettingMessage(); }); @@ -93,10 +87,8 @@ test('Deprecated settings are used if new settings are not defined', async () => await config.refresh(); - expect(settings.refreshTimeout).toBe(1); expect(settings.maxLogRecords).toBe(2); expect(settings.logBatchSize).toBe(3); - expect(settings.maxFailedRequests).toBe(4); expect(settings.disabled).toBe(true); expectDeprecatedSettingMessage(); }); diff --git a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.ts b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.ts index 12ab2267d3..858385771c 100644 --- a/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.ts +++ b/webapp/packages/plugin-log-viewer/src/LogViewer/LogViewerSettingsService.ts @@ -8,6 +8,7 @@ import { Dependency, injectable } from '@cloudbeaver/core-di'; import { createSettingsAliasResolver, + ESettingsValueType, ROOT_SETTINGS_LAYER, SettingsManagerService, SettingsProvider, @@ -15,12 +16,11 @@ import { SettingsResolverService, } from '@cloudbeaver/core-settings'; import { schema, schemaExtra } from '@cloudbeaver/core-utils'; +import { TOOLS_PANEL_SETTINGS_GROUP } from '@cloudbeaver/plugin-tools-panel'; const defaultSettings = schema.object({ - 'plugin.log-viewer.refreshTimeout': schema.coerce.number().default(3000), 'plugin.log-viewer.maxLogRecords': schema.coerce.number().default(1000), 'plugin.log-viewer.logBatchSize': schema.coerce.number().default(2000), - 'plugin.log-viewer.maxFailedRequests': schema.coerce.number().default(3), 'plugin.log-viewer.disabled': schemaExtra.stringedBoolean().default(false), }); @@ -32,10 +32,6 @@ export class LogViewerSettingsService extends Dependency { return this.settings.getValue('plugin.log-viewer.disabled'); } - get refreshTimeout(): number { - return this.settings.getValue('plugin.log-viewer.refreshTimeout'); - } - get maxLogRecords(): number { return this.settings.getValue('plugin.log-viewer.maxLogRecords'); } @@ -44,10 +40,6 @@ export class LogViewerSettingsService extends Dependency { return this.settings.getValue('plugin.log-viewer.logBatchSize'); } - get maxFailedRequests(): number { - return this.settings.getValue('plugin.log-viewer.maxFailedRequests'); - } - readonly settings: SettingsProvider; constructor( @@ -63,9 +55,7 @@ export class LogViewerSettingsService extends Dependency { createSettingsAliasResolver(this.settingsResolverService, this.settings, { 'plugin.log-viewer.disabled': 'core.app.logViewer.disabled', 'plugin.log-viewer.logBatchSize': 'core.app.logViewer.logBatchSize', - 'plugin.log-viewer.maxFailedRequests': 'core.app.logViewer.maxFailedRequests', 'plugin.log-viewer.maxLogRecords': 'core.app.logViewer.maxLogRecords', - 'plugin.log-viewer.refreshTimeout': 'core.app.logViewer.refreshTimeout', }), ); @@ -76,42 +66,34 @@ export class LogViewerSettingsService extends Dependency { this.settingsManagerService.registerSettings(this.settings, () => [ // { // group: LOG_VIEWER_SETTINGS_GROUP, - // key: 'refreshTimeout', - // type: ESettingsValueType.Input, - // name: 'Refresh timeout', - // description: 'Refresh timeout in milliseconds', - // }, - // { - // group: LOG_VIEWER_SETTINGS_GROUP, - // key: 'maxLogRecords', - // type: ESettingsValueType.Input, - // name: 'Max log records', - // description: 'Max log records', - // }, - // { - // group: LOG_VIEWER_SETTINGS_GROUP, - // key: 'logBatchSize', + // key: 'plugin.log-viewer.maxLogRecords', + // access: { + // scope: ['client'], + // }, // type: ESettingsValueType.Input, - // name: 'Log batch size', - // description: 'Log batch size', + // name: 'plugin_log_viewer_settings_max_log_records', + // description: 'plugin_log_viewer_settings_max_log_records_description', // }, // { // group: LOG_VIEWER_SETTINGS_GROUP, - // key: 'maxFailedRequests', - // type: ESettingsValueType.Input, - // name: 'Max failed requests', - // description: 'Max failed requests', - // }, - // { - // key: 'plugin.log-viewer.disabled', + // key: 'plugin.log-viewer.logBatchSize', // access: { - // scope: ['server', 'client'], + // scope: ['client'], // }, - // group: LOG_VIEWER_SETTINGS_GROUP, - // type: ESettingsValueType.Checkbox, - // name: 'Disable log viewer', - // description: 'Disable log viewer', + // type: ESettingsValueType.Input, + // name: 'plugin_log_viewer_settings_log_batch_size', + // description: 'plugin_log_viewer_settings_log_batch_size_description', // }, + { + key: 'plugin.log-viewer.disabled', + access: { + scope: ['server'], + }, + group: TOOLS_PANEL_SETTINGS_GROUP, + type: ESettingsValueType.Checkbox, + name: 'plugin_log_viewer_settings_disable', + description: 'plugin_log_viewer_settings_disable_description', + }, ]); } } diff --git a/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts b/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts index 06d8b6b611..78df3d5866 100644 --- a/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts +++ b/webapp/packages/plugin-log-viewer/src/SessionLogsResource.ts @@ -53,10 +53,11 @@ export class SessionLogsResource extends CachedDataResource { } protected async loader(): Promise { - const maxLogEntries = this.logViewerSettingsService.logBatchSize; + const maxLogRecords = this.logViewerSettingsService.maxLogRecords; + const batchSize = this.logViewerSettingsService.logBatchSize; const { log } = await this.graphQLService.sdk.readSessionLog({ - maxEntries: maxLogEntries, + maxEntries: batchSize, clearEntries: true, }); @@ -68,8 +69,8 @@ export class SessionLogsResource extends CachedDataResource { runInAction(() => { this.data.unshift(...logs.reverse()); - if (this.data.length > maxLogEntries) { - this.data.splice(maxLogEntries, this.data.length - maxLogEntries); + if (this.data.length > maxLogRecords) { + this.data.splice(maxLogRecords, this.data.length - maxLogRecords); } }); diff --git a/webapp/packages/plugin-log-viewer/src/locales/en.ts b/webapp/packages/plugin-log-viewer/src/locales/en.ts index cb9a856d72..0376df1e39 100644 --- a/webapp/packages/plugin-log-viewer/src/locales/en.ts +++ b/webapp/packages/plugin-log-viewer/src/locales/en.ts @@ -1,3 +1,11 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + export default [ ['plugin_log_viewer_log_viewer_settings_group', 'Log viewer'], ['plugin_log_viewer_action_enable_label', 'Log viewer'], @@ -7,4 +15,10 @@ export default [ ['plugin_log_viewer_entry_timestamp', 'Time'], ['plugin_log_viewer_entry_message', 'Message'], ['plugin_log_viewer_entry_details', 'Details'], + ['plugin_log_viewer_settings_disable', 'Disable log viewer'], + ['plugin_log_viewer_settings_disable_description', 'Disable the ability to view logs for all users'], + ['plugin_log_viewer_settings_max_log_records', 'Max log records'], + ['plugin_log_viewer_settings_max_log_records_description', 'Max log records to store in the log viewer, older records will be deleted'], + ['plugin_log_viewer_settings_log_batch_size', 'Amount of log records to load'], + ['plugin_log_viewer_settings_log_batch_size_description', 'Amount of log records to load in a single request'], ]; diff --git a/webapp/packages/plugin-log-viewer/src/locales/fr.ts b/webapp/packages/plugin-log-viewer/src/locales/fr.ts index 7ae53d80eb..f4c95476c7 100644 --- a/webapp/packages/plugin-log-viewer/src/locales/fr.ts +++ b/webapp/packages/plugin-log-viewer/src/locales/fr.ts @@ -14,4 +14,10 @@ export default [ ['plugin_log_viewer_entry_timestamp', 'Heure'], ['plugin_log_viewer_entry_message', 'Message'], ['plugin_log_viewer_entry_details', 'Détails'], + ['plugin_log_viewer_settings_disable', 'Disable log viewer'], + ['plugin_log_viewer_settings_disable_description', 'Disable the ability to view logs for all users'], + ['plugin_log_viewer_settings_max_log_records', 'Max log records'], + ['plugin_log_viewer_settings_max_log_records_description', 'Max log records to store in the log viewer, older records will be deleted'], + ['plugin_log_viewer_settings_log_batch_size', 'Amount of log records to load'], + ['plugin_log_viewer_settings_log_batch_size_description', 'Amount of log records to load in a single request'], ]; diff --git a/webapp/packages/plugin-log-viewer/src/locales/it.ts b/webapp/packages/plugin-log-viewer/src/locales/it.ts index 564b4d5764..551c565e73 100644 --- a/webapp/packages/plugin-log-viewer/src/locales/it.ts +++ b/webapp/packages/plugin-log-viewer/src/locales/it.ts @@ -1,3 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ ['plugin_log_viewer_log_viewer_settings_group', 'Log viewer'], ['plugin_log_viewer_action_enable_label', 'Visualizzatore del log'], @@ -7,4 +14,10 @@ export default [ ['plugin_log_viewer_entry_timestamp', 'Time'], ['plugin_log_viewer_entry_message', 'Messaggio'], ['plugin_log_viewer_entry_details', 'Dettagli'], + ['plugin_log_viewer_settings_disable', 'Disable log viewer'], + ['plugin_log_viewer_settings_disable_description', 'Disable the ability to view logs for all users'], + ['plugin_log_viewer_settings_max_log_records', 'Max log records'], + ['plugin_log_viewer_settings_max_log_records_description', 'Max log records to store in the log viewer, older records will be deleted'], + ['plugin_log_viewer_settings_log_batch_size', 'Amount of log records to load'], + ['plugin_log_viewer_settings_log_batch_size_description', 'Amount of log records to load in a single request'], ]; diff --git a/webapp/packages/plugin-log-viewer/src/locales/ru.ts b/webapp/packages/plugin-log-viewer/src/locales/ru.ts index 34adee8b51..9433fb37fd 100644 --- a/webapp/packages/plugin-log-viewer/src/locales/ru.ts +++ b/webapp/packages/plugin-log-viewer/src/locales/ru.ts @@ -1,5 +1,12 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ - ['plugin_log_viewer_log_viewer_settings_group', 'Log viewer'], + ['plugin_log_viewer_log_viewer_settings_group', 'Просмотр логов'], ['plugin_log_viewer_action_enable_label', 'Просмотр логов'], ['plugin_log_viewer_placeholder', 'Просмотр логов неактивен'], ['plugin_log_viewer_clear_log', 'Очистить лог'], @@ -7,4 +14,10 @@ export default [ ['plugin_log_viewer_entry_timestamp', 'Время'], ['plugin_log_viewer_entry_message', 'Сообщение'], ['plugin_log_viewer_entry_details', 'Детали'], + ['plugin_log_viewer_settings_disable', 'Отключить просмотр логов'], + ['plugin_log_viewer_settings_disable_description', 'Отключить возможность просмотра логов для всех пользователей'], + ['plugin_log_viewer_settings_max_log_records', 'Максимальное количество записей'], + ['plugin_log_viewer_settings_max_log_records_description', 'Максимальное количество записей для хранения, старые записи будут удалены'], + ['plugin_log_viewer_settings_log_batch_size', 'Количество записей для загрузки'], + ['plugin_log_viewer_settings_log_batch_size_description', 'Количество записей для загрузки за один запрос'], ]; diff --git a/webapp/packages/plugin-log-viewer/src/locales/zh.ts b/webapp/packages/plugin-log-viewer/src/locales/zh.ts index f603cda99f..b55186c015 100644 --- a/webapp/packages/plugin-log-viewer/src/locales/zh.ts +++ b/webapp/packages/plugin-log-viewer/src/locales/zh.ts @@ -14,4 +14,10 @@ export default [ ['plugin_log_viewer_entry_timestamp', '时间戳'], ['plugin_log_viewer_entry_message', '消息'], ['plugin_log_viewer_entry_details', '详情'], + ['plugin_log_viewer_settings_disable', 'Disable log viewer'], + ['plugin_log_viewer_settings_disable_description', 'Disable the ability to view logs for all users'], + ['plugin_log_viewer_settings_max_log_records', 'Max log records'], + ['plugin_log_viewer_settings_max_log_records_description', 'Max log records to store in the log viewer, older records will be deleted'], + ['plugin_log_viewer_settings_log_batch_size', 'Amount of log records to load'], + ['plugin_log_viewer_settings_log_batch_size_description', 'Amount of log records to load in a single request'], ]; diff --git a/webapp/packages/plugin-navigation-tree/package.json b/webapp/packages/plugin-navigation-tree/package.json index a5cf66bed3..c8c44d9bfd 100644 --- a/webapp/packages/plugin-navigation-tree/package.json +++ b/webapp/packages/plugin-navigation-tree/package.json @@ -66,7 +66,7 @@ "@cloudbeaver/plugin-navigation-tabs": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "@types/react": "^18", "typescript": "^5", "typescript-plugin-css-modules": "^5" diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeBootstrap.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeBootstrap.ts index 5e04975bd8..fcd2755edd 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeBootstrap.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTree/NavigationTreeBootstrap.ts @@ -5,12 +5,14 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import { importLazyComponent } from '@cloudbeaver/core-blocks'; import { Bootstrap, injectable } from '@cloudbeaver/core-di'; import { LeftBarPanelService } from '@cloudbeaver/core-ui'; import { NavigationTreeSettingsService } from '../NavigationTreeSettingsService.js'; import { ElementsTreeToolsMenuService } from './ElementsTree/ElementsTreeTools/ElementsTreeToolsMenuService.js'; -import { NavigationTreePanel } from './NavigationTreePanel.js'; + +const NavigationTreePanel = importLazyComponent(() => import('./NavigationTreePanel.js').then(m => m.NavigationTreePanel)); @injectable() export class NavigationTreeBootstrap extends Bootstrap { @@ -22,7 +24,7 @@ export class NavigationTreeBootstrap extends Bootstrap { super(); } - override register(): void | Promise { + override register(): void { this.elementsTreeToolsMenuService.register(); this.leftBarPanelService.tabsContainer.add({ key: 'navigation-tree-tab', @@ -32,6 +34,4 @@ export class NavigationTreeBootstrap extends Bootstrap { panel: () => NavigationTreePanel, }); } - - override async load(): Promise {} } diff --git a/webapp/packages/plugin-navigation-tree/src/NavigationTreeSettingsService.ts b/webapp/packages/plugin-navigation-tree/src/NavigationTreeSettingsService.ts index 5b1ec11ff6..01f414c060 100644 --- a/webapp/packages/plugin-navigation-tree/src/NavigationTreeSettingsService.ts +++ b/webapp/packages/plugin-navigation-tree/src/NavigationTreeSettingsService.ts @@ -8,7 +8,8 @@ import { computed, makeObservable } from 'mobx'; import { Dependency, injectable } from '@cloudbeaver/core-di'; -import { SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; +import { NAVIGATION_TREE_SETTINGS_GROUP } from '@cloudbeaver/core-navigation-tree'; +import { ESettingsValueType, SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; import { schema, schemaExtra } from '@cloudbeaver/core-utils'; const defaultSettings = schema.object({ @@ -43,9 +44,13 @@ export class NavigationTreeSettingsService extends Dependency { this.settingsManagerService.registerSettings(this.settings, () => [ // { // group: NAVIGATION_TREE_SETTINGS_GROUP, - // key: 'disabled', + // key: 'plugin.navigation-tree.disabled', + // access: { + // scope: ['server'], + // }, // type: ESettingsValueType.Checkbox, - // name: 'Disable navigation tree', + // name: 'plugin_navigation_tree_settings_disable', + // description: 'plugin_navigation_tree_settings_disable_description', // }, ]); } diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/TreeDataTransformer.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/TreeDataTransformer.ts index e5a4c64782..1c1688a8e3 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/TreeDataTransformer.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/TreeDataTransformer.ts @@ -5,5 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { ITreeData } from '../ITreeData.js'; -export type TreeDataTransformer = (nodeId: string, data: T) => T; +export type TreeDataTransformer = (treeData: ITreeData, nodeId: string, data: T) => T; diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/applyTransforms.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/applyTransforms.ts index 9607662614..385dd0081e 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/applyTransforms.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/applyTransforms.ts @@ -5,15 +5,16 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ +import type { ITreeData } from '../ITreeData.js'; import type { TreeDataTransformer } from './TreeDataTransformer.js'; -export function applyTransforms(id: string, data: T, transformers?: TreeDataTransformer[]) { +export function applyTransforms(treeData: ITreeData, id: string, data: T, transformers?: TreeDataTransformer[]) { if (!transformers) { return data; } for (const transformer of transformers) { - data = transformer(id, data); + data = transformer(treeData, id, data); } return data; diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/rootTransformers.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/rootTransformers.ts index 241d2586f9..78fbf2fd56 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/rootTransformers.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/DataTransformers/rootTransformers.ts @@ -10,7 +10,7 @@ import type { INodeState } from '../INodeState.js'; import type { TreeDataTransformer } from './TreeDataTransformer.js'; export function rootNodeStateTransformer(root: string): TreeDataTransformer { - return function rootNodeStateTransformer(nodeId, data) { + return function rootNodeStateTransformer(treeData, nodeId, data) { if (nodeId === root) { return { ...data, @@ -23,7 +23,7 @@ export function rootNodeStateTransformer(root: string): TreeDataTransformer { - return function rootNodeTransformer(nodeId, data) { + return function rootNodeTransformer(treeData, nodeId, data) { if (nodeId === root) { return { ...data, diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/ITreeData.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/ITreeData.ts new file mode 100644 index 0000000000..638c35a5af --- /dev/null +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/ITreeData.ts @@ -0,0 +1,22 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 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 type { INode } from './INode.js'; +import type { INodeState } from './INodeState.js'; + +export interface ITreeData { + rootId: string; + + getNode(id: string): INode; + getChildren: (node: string) => string[]; + getState(id: string): Readonly; + + updateAllState(state: Partial): void; + updateState(id: string, state: Partial): void; + load(nodeId: string, manual: boolean): Promise; + update(): Promise; +} diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeChildren.tsx b/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeChildren.tsx index d4c0bb9a58..721c39ab5f 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeChildren.tsx +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeChildren.tsx @@ -13,10 +13,12 @@ import { getComputed, TreeNodeNested } from '@cloudbeaver/core-blocks'; import { NodeSizeCacheContext } from './contexts/NodeSizeCacheContext.js'; import { TreeDataContext } from './contexts/TreeDataContext.js'; import { TreeVirtualizationContext } from './contexts/TreeVirtualizationContext.js'; +import type { NodeEmptyPlaceholderComponent } from './NodeEmptyPlaceholderComponent.js'; import { NodeRenderer } from './NodeRenderer.js'; interface Props { nodeId: string; + emptyPlaceholder?: NodeEmptyPlaceholderComponent; offsetHeight: number; root?: boolean; } @@ -31,7 +33,7 @@ function getPositionWithOverscan(position: number, forward: boolean) { return position - (position % OVERSCAN); } -const NodeChildrenObserved = observer(function NodeChildren({ nodeId, offsetHeight, root }) { +const NodeChildrenObserved = observer(function NodeChildren({ nodeId, emptyPlaceholder, offsetHeight, root }) { const data = useContext(TreeDataContext)!; const optimization = useContext(TreeVirtualizationContext)!; const sizeCache = useContext(NodeSizeCacheContext)!; @@ -70,6 +72,11 @@ const NodeChildrenObserved = observer(function NodeChildren({ nodeId, off elements.push(
); } + if (elements.length === 0 && emptyPlaceholder) { + const EmptyPlaceholder = emptyPlaceholder; + elements.push(); + } + return elements; } diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeEmptyPlaceholderComponent.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeEmptyPlaceholderComponent.ts new file mode 100644 index 0000000000..c28f958588 --- /dev/null +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/NodeEmptyPlaceholderComponent.ts @@ -0,0 +1,11 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +export type NodeEmptyPlaceholderComponent = React.FC<{ + root?: boolean; +}>; diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/Tree.tsx b/webapp/packages/plugin-navigation-tree/src/TreeNew/Tree.tsx index fee6114ca6..a72e854e20 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/Tree.tsx +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/Tree.tsx @@ -15,16 +15,18 @@ import { TreeDataContext } from './contexts/TreeDataContext.js'; import { TreeDnDContext } from './contexts/TreeDnDContext.js'; import { TreeVirtualizationContext } from './contexts/TreeVirtualizationContext.js'; import type { INodeRenderer } from './INodeRenderer.js'; +import type { ITreeData } from './ITreeData.js'; import { NodeChildren } from './NodeChildren.js'; +import type { NodeEmptyPlaceholderComponent } from './NodeEmptyPlaceholderComponent.js'; import { useNodeSizeCache } from './useNodeSizeCache.js'; import { useTree } from './useTree.js'; -import type { ITreeData } from './useTreeData.js'; import { useTreeDnD } from './useTreeDnD.js'; import { useTreeVirtualization } from './useTreeVirtualization.js'; export interface NavigationTreeNewProps { data: ITreeData; nodeRenderers?: INodeRenderer[]; + emptyPlaceholder?: NodeEmptyPlaceholderComponent; onNodeClick?(id: string): void | Promise; onNodeDoubleClick?(id: string): void | Promise; getNodeDnDContext?(id: string, context: IDataContext): void; @@ -34,6 +36,7 @@ export interface NavigationTreeNewProps { export const Tree = observer(function Tree({ data, nodeRenderers, + emptyPlaceholder, onNodeClick, onNodeDoubleClick, getNodeDnDContext, @@ -59,7 +62,7 @@ export const Tree = observer(function Tree({ - + diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/contexts/TreeDataContext.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/contexts/TreeDataContext.ts index 32107ea0c8..0e14b6c11f 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/contexts/TreeDataContext.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/contexts/TreeDataContext.ts @@ -7,6 +7,6 @@ */ import { createContext } from 'react'; -import type { ITreeData } from '../useTreeData.js'; +import type { ITreeData } from '../ITreeData.js'; export const TreeDataContext = createContext(undefined); diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/useNodeSizeCache.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/useNodeSizeCache.ts index 24546fde00..98383fceda 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/useNodeSizeCache.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/useNodeSizeCache.ts @@ -11,8 +11,8 @@ import { useState } from 'react'; import { useObjectRef } from '@cloudbeaver/core-blocks'; import { MetadataMap } from '@cloudbeaver/core-utils'; +import type { ITreeData } from './ITreeData.js'; import type { ITree } from './useTree.js'; -import type { ITreeData } from './useTreeData.js'; export interface INodeSizeCache { getSize(id: string): number; diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/useTree.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTree.ts index 92abcbe6cf..1d0188982b 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/useTree.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTree.ts @@ -10,7 +10,7 @@ import { observable } from 'mobx'; import { useObservableRef } from '@cloudbeaver/core-blocks'; import type { INodeRenderer, NodeComponent } from './INodeRenderer.js'; -import type { ITreeData } from './useTreeData.js'; +import type { ITreeData } from './ITreeData.js'; interface IOptions { data: ITreeData; diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeData.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeData.ts index b6d2449c46..8a60bd0cce 100644 --- a/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeData.ts +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeData.ts @@ -16,6 +16,7 @@ import { rootNodeStateTransformer, rootNodeTransformer } from './DataTransformer import type { TreeDataTransformer } from './DataTransformers/TreeDataTransformer.js'; import type { INode } from './INode.js'; import type { INodeState } from './INodeState.js'; +import type { ITreeData } from './ITreeData.js'; import type { TreeState } from './TreeState.js'; import { useTreeState } from './useTreeState.js'; @@ -31,19 +32,6 @@ interface IOptions { stateTransformers?: TreeDataTransformer[]; } -export interface ITreeData { - rootId: string; - - getNode(id: string): INode; - getChildren: (node: string) => string[]; - getState(id: string): Readonly; - - updateAllState(state: Partial): void; - updateState(id: string, state: Partial): void; - load(nodeId: string, manual: boolean): Promise; - update(): Promise; -} - export function useTreeData(options: IOptions): ITreeData { options = useObservableRef( { @@ -67,19 +55,23 @@ export function useTreeData(options: IOptions): ITreeData { const [nodeCache] = useState( () => new MetadataMap>(id => - computed(() => applyTransforms(id, options.getNode(id), [rootNodeTransformer(options.rootId), ...(options.nodeTransformers || [])])), + computed(() => + applyTransforms(treeData, id, options.getNode(id), [rootNodeTransformer(options.rootId), ...(options.nodeTransformers || [])]), + ), ), ); const [childrenCache] = useState( () => new MetadataMap>(id => - computed(() => applyTransforms(id, options.getChildren(id), options.childrenTransformers)), + computed(() => applyTransforms(treeData, id, options.getChildren(id), options.childrenTransformers)), ), ); const [stateCache] = useState( () => new MetadataMap>(id => - computed(() => applyTransforms(id, state.getState(id), [rootNodeStateTransformer(options.rootId), ...(options.stateTransformers || [])])), + computed(() => + applyTransforms(treeData, id, state.getState(id), [rootNodeStateTransformer(options.rootId), ...(options.stateTransformers || [])]), + ), ), ); diff --git a/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeFilter.ts b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeFilter.ts new file mode 100644 index 0000000000..81a0bdb3fe --- /dev/null +++ b/webapp/packages/plugin-navigation-tree/src/TreeNew/useTreeFilter.ts @@ -0,0 +1,58 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 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 { observable } from 'mobx'; + +import { useObjectRef, useObservableRef } from '@cloudbeaver/core-blocks'; + +import type { TreeDataTransformer } from './DataTransformers/TreeDataTransformer.js'; +import type { ITreeData } from './ITreeData.js'; + +export interface ITreeFilterOptions { + isNodeMatched?: (nodeId: string, filter: string, isMatched: boolean) => boolean; +} + +export interface ITreeFilter { + filter: string; + isNodeMatched(treeData: ITreeData, nodeId: string): boolean; + transformer: TreeDataTransformer; + setFilter(filter: string): void; +} + +export function useTreeFilter(options: ITreeFilterOptions = {}): Readonly { + options = useObjectRef(options); + return useObservableRef( + () => ({ + filter: '', + isNodeMatched(treeData: ITreeData, nodeId: string): boolean { + const filter = this.filter.trim(); + if (!filter) { + return true; + } + + let isNodeMatched = treeData.getNode(nodeId).name.toLowerCase().includes(filter); + + if (options?.isNodeMatched) { + isNodeMatched = options.isNodeMatched(nodeId, filter, isNodeMatched); + } + + return isNodeMatched || treeData.getChildren(nodeId).length > 0; + }, + transformer(treeData: ITreeData, nodeId: string, children: string[]): string[] { + return children.filter(child => this.isNodeMatched(treeData, child)); + }, + setFilter(filter: string): void { + this.filter = filter; + }, + }), + { + filter: observable.ref, + }, + false, + ['setFilter', 'isNodeMatched', 'transformer'], + ); +} diff --git a/webapp/packages/plugin-navigation-tree/src/index.ts b/webapp/packages/plugin-navigation-tree/src/index.ts index 78f7f8bcde..3f84713274 100644 --- a/webapp/packages/plugin-navigation-tree/src/index.ts +++ b/webapp/packages/plugin-navigation-tree/src/index.ts @@ -50,7 +50,10 @@ export * from './TreeNew/contexts/TreeContext.js'; export * from './TreeNew/contexts/TreeDataContext.js'; export * from './TreeNew/NodeControlLazy.js'; export * from './TreeNew/useTreeData.js'; +export * from './TreeNew/ITreeData.js'; +export * from './TreeNew/useTreeFilter.js'; export * from './TreeNew/INode.js'; +export * from './TreeNew/NodeEmptyPlaceholderComponent.js'; export * from './NavigationTree/getNavigationTreeUserSettingsId.js'; export * from './NodesManager/NavNodeView/IFolderTransform.js'; diff --git a/webapp/packages/plugin-navigation-tree/src/locales/en.ts b/webapp/packages/plugin-navigation-tree/src/locales/en.ts index dcea312219..c29ccb8baa 100644 --- a/webapp/packages/plugin-navigation-tree/src/locales/en.ts +++ b/webapp/packages/plugin-navigation-tree/src/locales/en.ts @@ -1,3 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ ['plugin_navigation_tree_explorer_tab_title', 'Explorer'], ['app_navigationTree_openNodeTab', 'Open'], @@ -36,4 +43,6 @@ export default [ ['app_navigationTree_drop_here', 'Drop here...'], ['plugin_navigation_tree_settings_projects_description', 'Displays elements under project groups'], ['plugin_navigation_tree_settings_projects_title', 'Group by Project'], + ['plugin_navigation_tree_settings_disable', 'Disable'], + ['plugin_navigation_tree_settings_disable_description', 'Disable navigation tree for all users'], ]; diff --git a/webapp/packages/plugin-navigation-tree/src/locales/fr.ts b/webapp/packages/plugin-navigation-tree/src/locales/fr.ts index bd940bd383..f8f14c4060 100644 --- a/webapp/packages/plugin-navigation-tree/src/locales/fr.ts +++ b/webapp/packages/plugin-navigation-tree/src/locales/fr.ts @@ -42,4 +42,6 @@ export default [ ['app_navigationTree_drop_here', 'Déposer ici...'], ['plugin_navigation_tree_settings_projects_description', 'Affiche les éléments sous les groupes de projets'], ['plugin_navigation_tree_settings_projects_title', 'Grouper par projet'], + ['plugin_navigation_tree_settings_disable', 'Disable'], + ['plugin_navigation_tree_settings_disable_description', 'Disable navigation tree for all users'], ]; diff --git a/webapp/packages/plugin-navigation-tree/src/locales/it.ts b/webapp/packages/plugin-navigation-tree/src/locales/it.ts index 90ce90cc6a..f5ee281364 100644 --- a/webapp/packages/plugin-navigation-tree/src/locales/it.ts +++ b/webapp/packages/plugin-navigation-tree/src/locales/it.ts @@ -1,3 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ ['plugin_navigation_tree_explorer_tab_title', 'Explorer'], ['app_navigationTree_openNodeTab', 'Apri'], @@ -33,4 +40,6 @@ export default [ ['app_navigationTree_drop_here', 'Drop here...'], ['plugin_navigation_tree_settings_projects_description', 'Displays elements under project groups'], ['plugin_navigation_tree_settings_projects_title', 'Group by Project'], + ['plugin_navigation_tree_settings_disable', 'Disable'], + ['plugin_navigation_tree_settings_disable_description', 'Disable navigation tree for all users'], ]; diff --git a/webapp/packages/plugin-navigation-tree/src/locales/ru.ts b/webapp/packages/plugin-navigation-tree/src/locales/ru.ts index b95a11b5fe..565cc04503 100644 --- a/webapp/packages/plugin-navigation-tree/src/locales/ru.ts +++ b/webapp/packages/plugin-navigation-tree/src/locales/ru.ts @@ -1,3 +1,10 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ export default [ ['plugin_navigation_tree_explorer_tab_title', 'Проводник'], ['app_navigationTree_openNodeTab', 'Открыть'], @@ -39,4 +46,6 @@ export default [ ['app_navigationTree_drop_here', 'Drop here...'], ['plugin_navigation_tree_settings_projects_description', 'Группировать элементы по проектам'], ['plugin_navigation_tree_settings_projects_title', 'Группировать по проектам'], + ['plugin_navigation_tree_settings_disable', 'Отключить'], + ['plugin_navigation_tree_settings_disable_description', 'Отключить дерево навигации для всех пользователей'], ]; diff --git a/webapp/packages/plugin-navigation-tree/src/locales/zh.ts b/webapp/packages/plugin-navigation-tree/src/locales/zh.ts index 93ef70a7b5..bf573f317d 100644 --- a/webapp/packages/plugin-navigation-tree/src/locales/zh.ts +++ b/webapp/packages/plugin-navigation-tree/src/locales/zh.ts @@ -42,4 +42,6 @@ export default [ ['app_navigationTree_drop_here', '拖动至此...'], ['plugin_navigation_tree_settings_projects_description', '在项目分组下显示'], ['plugin_navigation_tree_settings_projects_title', '项目分组'], + ['plugin_navigation_tree_settings_disable', 'Disable'], + ['plugin_navigation_tree_settings_disable_description', 'Disable navigation tree for all users'], ]; diff --git a/webapp/packages/plugin-product-information-administration/package.json b/webapp/packages/plugin-product-information-administration/package.json index 89216ef4e3..d0bb1d8eaa 100644 --- a/webapp/packages/plugin-product-information-administration/package.json +++ b/webapp/packages/plugin-product-information-administration/package.json @@ -23,10 +23,10 @@ "@cloudbeaver/core-di": "^0", "@cloudbeaver/core-localization": "^0", "@cloudbeaver/core-resource": "^0", + "@cloudbeaver/core-root": "^0", "@cloudbeaver/core-ui": "^0", "@cloudbeaver/core-version": "^0", "@cloudbeaver/core-version-update": "^0", - "mobx": "^6", "mobx-react-lite": "^4", "react": "^18" }, diff --git a/webapp/packages/plugin-product-information-administration/tsconfig.json b/webapp/packages/plugin-product-information-administration/tsconfig.json index cd83fd684b..ae98b253df 100644 --- a/webapp/packages/plugin-product-information-administration/tsconfig.json +++ b/webapp/packages/plugin-product-information-administration/tsconfig.json @@ -21,6 +21,9 @@ { "path": "../core-resource/tsconfig.json" }, + { + "path": "../core-root/tsconfig.json" + }, { "path": "../core-ui/tsconfig.json" }, diff --git a/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScriptsSettingsService.ts b/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScriptsSettingsService.ts index 622de0c426..9aa42668c6 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScriptsSettingsService.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/ResourceManagerScriptsSettingsService.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ import { Dependency, injectable } from '@cloudbeaver/core-di'; -import { SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; +import { RESOURCE_MANAGER_SETTINGS_GROUP } from '@cloudbeaver/core-resource-manager'; +import { ESettingsValueType, SettingsManagerService, SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings'; import { schema, schemaExtra } from '@cloudbeaver/core-utils'; const settingsSchema = schema.object({ @@ -37,9 +38,13 @@ export class ResourceManagerScriptsSettingsService extends Dependency { this.settingsManagerService.registerSettings(this.settings, () => [ // { // group: RESOURCE_MANAGER_SETTINGS_GROUP, - // key: 'disabled', + // key: 'plugin.resource-manager-scripts.disabled', + // access: { + // scope: ['server'], + // }, // type: ESettingsValueType.Checkbox, - // name: 'Disable resource manager scripts', + // name: 'plugin_resource_manager_scripts_disable', + // description: 'plugin_resource_manager_scripts_disable_description', // }, ]); } diff --git a/webapp/packages/plugin-resource-manager-scripts/src/locales/en.ts b/webapp/packages/plugin-resource-manager-scripts/src/locales/en.ts index 53daab31a8..8548250450 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/locales/en.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/locales/en.ts @@ -18,4 +18,6 @@ export default [ 'plugin_resource_manager_scripts_save_script_project_restriction_descripion', "The script's project can't be different from the connection's project", ], + ['plugin_resource_manager_scripts_disable', 'Disable scripts'], + ['plugin_resource_manager_scripts_disable_description', 'Disable scripts explorer for all users'], ]; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/locales/fr.ts b/webapp/packages/plugin-resource-manager-scripts/src/locales/fr.ts index b7c4cfaa50..787dcdc7ad 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/locales/fr.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/locales/fr.ts @@ -18,4 +18,6 @@ export default [ 'plugin_resource_manager_scripts_save_script_project_restriction_description', 'Le projet du script ne peut pas être différent de celui de la connexion', ], + ['plugin_resource_manager_scripts_disable', 'Disable scripts'], + ['plugin_resource_manager_scripts_disable_description', 'Disable scripts explorer for all users'], ]; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/locales/it.ts b/webapp/packages/plugin-resource-manager-scripts/src/locales/it.ts index 53daab31a8..8548250450 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/locales/it.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/locales/it.ts @@ -18,4 +18,6 @@ export default [ 'plugin_resource_manager_scripts_save_script_project_restriction_descripion', "The script's project can't be different from the connection's project", ], + ['plugin_resource_manager_scripts_disable', 'Disable scripts'], + ['plugin_resource_manager_scripts_disable_description', 'Disable scripts explorer for all users'], ]; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/locales/ru.ts b/webapp/packages/plugin-resource-manager-scripts/src/locales/ru.ts index 1c72effe44..47c563d176 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/locales/ru.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/locales/ru.ts @@ -15,4 +15,6 @@ export default [ 'Имя скрипта не может содержать следующие символы / : " \\ \' <> | ? * и не может начинаться с точки', ], ['plugin_resource_manager_scripts_save_script_project_restriction_descripion', 'Проект скрипта не может отличаться от проекта подключения'], + ['plugin_resource_manager_scripts_disable', 'Отключить скрипты'], + ['plugin_resource_manager_scripts_disable_description', 'Отключить проводник скриптов для всех пользователей'], ]; diff --git a/webapp/packages/plugin-resource-manager-scripts/src/locales/zh.ts b/webapp/packages/plugin-resource-manager-scripts/src/locales/zh.ts index 6ebab3be6e..53a8a2678c 100644 --- a/webapp/packages/plugin-resource-manager-scripts/src/locales/zh.ts +++ b/webapp/packages/plugin-resource-manager-scripts/src/locales/zh.ts @@ -18,4 +18,6 @@ export default [ 'plugin_resource_manager_scripts_save_script_project_restriction_descripion', "脚本对应项目须与连接项目一致", ], + ['plugin_resource_manager_scripts_disable', 'Disable scripts'], + ['plugin_resource_manager_scripts_disable_description', 'Disable scripts explorer for all users'], ]; diff --git a/webapp/packages/plugin-resource-manager/package.json b/webapp/packages/plugin-resource-manager/package.json index 6871e7274a..4de3c39bbb 100644 --- a/webapp/packages/plugin-resource-manager/package.json +++ b/webapp/packages/plugin-resource-manager/package.json @@ -40,7 +40,7 @@ "@cloudbeaver/core-settings": "^0", "@cloudbeaver/tests-runner": "^0", "@jest/globals": "^29", - "@testing-library/jest-dom": "^6", + "@types/jest": "^29", "typescript": "^5" } } diff --git a/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.ts b/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.ts index fe35dda4ee..191c2811a2 100644 --- a/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.ts +++ b/webapp/packages/plugin-resource-manager/src/ResourceManagerSettingsService.ts @@ -9,7 +9,6 @@ import { Dependency, injectable } from '@cloudbeaver/core-di'; import { createSettingsAliasResolver, ROOT_SETTINGS_LAYER, - SettingsManagerService, SettingsProvider, SettingsProviderService, SettingsResolverService, @@ -31,7 +30,6 @@ export class ResourceManagerSettingsService extends Dependency { constructor( private readonly settingsProviderService: SettingsProviderService, - private readonly settingsManagerService: SettingsManagerService, private readonly settingsResolverService: SettingsResolverService, ) { super(); @@ -43,19 +41,5 @@ export class ResourceManagerSettingsService extends Dependency { 'plugin.resource-manager.disabled': 'plugin_resource_manager.disabled', }), ); - - this.registerSettings(); - } - - private registerSettings() { - this.settingsManagerService.registerSettings(this.settings, () => [ - // { - // group: RESOURCE_MANAGER_SETTINGS_GROUP, - // key: 'disabled', - // type: ESettingsValueType.Checkbox, - // name: 'Disable resource manager', - // description: 'use resourceManagerEnabled in server config instead', - // }, - ]); } } diff --git a/webapp/packages/plugin-settings-administration/src/SettingsAdministration.tsx b/webapp/packages/plugin-settings-administration/src/SettingsAdministration.tsx index 1c6df19e3c..3f41689fbd 100644 --- a/webapp/packages/plugin-settings-administration/src/SettingsAdministration.tsx +++ b/webapp/packages/plugin-settings-administration/src/SettingsAdministration.tsx @@ -8,21 +8,18 @@ import { observer } from 'mobx-react-lite'; import type { AdministrationItemContentProps } from '@cloudbeaver/core-administration'; -import { ColoredContainer, Form, Group, s, ToolsAction, ToolsPanel, useForm, useS, useTranslate } from '@cloudbeaver/core-blocks'; +import { ColoredContainer, Form, Group, ToolsAction, ToolsPanel, useForm, useS, useTranslate } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; import { NotificationService } from '@cloudbeaver/core-events'; import { ServerSettingsService } from '@cloudbeaver/core-root'; import { Settings } from '@cloudbeaver/plugin-settings-panel'; -import style from './SettingsAdministration.module.css'; - const clientScope = ['server']; export const SettingsAdministration = observer(function SettingsAdministration() { const translate = useTranslate(); const serverSettingsService = useService(ServerSettingsService); const notificationService = useService(NotificationService); - const styles = useS(style); const changed = serverSettingsService.isEdited(); async function handleSave() { @@ -49,7 +46,7 @@ export const SettingsAdministration = observer(f return (
- + form.submit()}> diff --git a/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.module.css b/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.module.css new file mode 100644 index 0000000000..cb6b737d1b --- /dev/null +++ b/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.module.css @@ -0,0 +1,16 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2024 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ + +.settingsGroups { + width: 240px; +} + +.settingsGroups, +.settingsContainer { + height: 100%; +} diff --git a/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.tsx b/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.tsx index 9b3c2223f4..001690ad69 100644 --- a/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.tsx +++ b/webapp/packages/plugin-settings-panel/src/SettingsPanel/Settings.tsx @@ -6,13 +6,14 @@ * you may not use this file except in compliance with the License. */ import { observer } from 'mobx-react-lite'; -import React from 'react'; -import { Container, Group, TextPlaceholder, useTranslate } from '@cloudbeaver/core-blocks'; -import { type ISettingsSource, ROOT_SETTINGS_GROUP } from '@cloudbeaver/core-settings'; -import { useTreeData } from '@cloudbeaver/plugin-navigation-tree'; +import { Container, Filter, Group, s, TextPlaceholder, useTranslate } from '@cloudbeaver/core-blocks'; +import { type ISettingsSource, ROOT_SETTINGS_GROUP, SettingsGroup } from '@cloudbeaver/core-settings'; +import { useTreeData, useTreeFilter } from '@cloudbeaver/plugin-navigation-tree'; import { getSettingGroupId } from './getSettingGroupId.js'; +import classes from './Settings.module.css'; +import { settingsFilter } from './settingsFilter.js'; import { SettingsGroups } from './SettingsGroups/SettingsGroups.js'; import { SettingsList } from './SettingsList.js'; import { useSettings } from './useSettings.js'; @@ -26,21 +27,36 @@ export const Settings = observer(function Settings({ source, acc const translate = useTranslate(); const settings = useSettings(accessor); + function filterExistsGroups(group: SettingsGroup) { + return settings.groups.has(group); + } + + const treeFilter = useTreeFilter({ + isNodeMatched(nodeId, filter) { + const group = ROOT_SETTINGS_GROUP.get(nodeId)!; + const groupSettings = settings.settings.get(group); + + if (!groupSettings) { + return false; + } + + return groupSettings.some(settingsFilter(translate, filter)); + }, + }); + const treeData = useTreeData({ rootId: ROOT_SETTINGS_GROUP.id, + childrenTransformers: [treeFilter.transformer], getNode(id) { const group = ROOT_SETTINGS_GROUP.get(id); return { name: translate(group!.name), - leaf: !group?.subGroups.length, + leaf: !group?.subGroups.filter(filterExistsGroups).length, }; }, getChildren(id) { - return (ROOT_SETTINGS_GROUP.get(id)?.subGroups || []) - .filter(group => settings.groups.has(group)) - .sort((a, b) => a.name.localeCompare(b.name)) - .map(group => group.id); + return (ROOT_SETTINGS_GROUP.get(id)?.subGroups || []).filter(filterExistsGroups).map(group => group.id); }, load() { return Promise.resolve(); @@ -57,11 +73,21 @@ export const Settings = observer(function Settings({ source, acc return ( -