Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ public DBNBrowseSettings getNavigatorSettings() {
return dataSourceContainer.getNavigatorSettings();
}

@Property
@NotNull
public DBNBrowseSettings getOriginalNavigatorSettings() {
return dataSourceContainer.getNavigatorSettings().getOriginalSettings();
}

@Property
@NotNull
public List<WebDataFormat> getSupportedDataFormats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ type ConnectionInfo {
"Supported features (provided etc)"
features: [ String! ]!
navigatorSettings: NavigatorSettings!
"Original navigator settings from the configuration file"
originalNavigatorSettings: NavigatorSettings! @since(version: "25.3.3")
Copy link
Member

Choose a reason for hiding this comment

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

actually you can add optional argument for the navigatorSettings field, something like:

navigatorSettings(datasourceSettings: Boolean): NavigatorSettings!

Copy link
Member

Choose a reason for hiding this comment

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

userSettings should be removed from the NavigatorSettingsInput type, instead you need to add similar argument to the setConnectionNavigatorSettings

originalNavigatorSettings better to rename to the datasourceNavigatorSettings

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that, in this case, we restricted ourselves by using a single interface. Imagine you want to add an additional field only to global settings or remove userSettings field from global interface (as its always false). When you have two entities, navigatorSettings and datasourceSettings, you can do this easily by changing just one interface. I think datasource settings and user settings should be strictly separated at the gql level.


supportedDataFormats: [ ResultDataFormat! ]!
configurationType: DriverConfigurationType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,12 @@ public WebConnectionInfo setConnectionNavigatorSettings(
@NotNull String id,
@NotNull DataSourceNavigatorSettings settings
) throws DBWebException {
WebConnectionInfo connectionInfo = WebDataSourceUtils.getWebConnectionInfo(webSession, projectId, id);
WebSessionProjectImpl project = webSession.getProjectById(projectId);
WebConnectionInfo connectionInfo = project != null ? project.getWebConnectionInfo(id) :
WebDataSourceUtils.getWebConnectionInfo(webSession, projectId, id);
DataSourceDescriptor dataSourceDescriptor = ((DataSourceDescriptor) connectionInfo.getDataSourceContainer());
try {
if (settings.isUserSettings()) {
if (project != null && !project.isPrivateProject() && settings.isUserSettings()) {
DataSourceNavigatorSettingsUtils.updateCustomNavigatorSettings(dataSourceDescriptor, settings);
} else {
// If user has no permissions to save it will cause error
Expand Down
24 changes: 2 additions & 22 deletions webapp/packages/core-connections/src/ConnectionInfoResource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2025 DBeaver Corp and others
* Copyright (C) 2020-2026 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
Expand All @@ -26,13 +26,7 @@ import {
resourceKeyListAliasFactory,
ResourceKeyUtils,
} from '@cloudbeaver/core-resource';
import {
DataSynchronizationService,
type NavigatorViewSettings,
ServerEventId,
SessionDataResource,
WorkspaceConfigEventHandler,
} from '@cloudbeaver/core-root';
import { DataSynchronizationService, ServerEventId, SessionDataResource, WorkspaceConfigEventHandler } from '@cloudbeaver/core-root';
import {
type AdminConnectionGrantInfo,
type AdminConnectionSearchInfo,
Expand Down Expand Up @@ -432,20 +426,6 @@ export class ConnectionInfoResource extends CachedMapResource<IConnectionInfoPar
return this.get(key)!;
}

async changeConnectionView(key: IConnectionInfoParams, settings: NavigatorViewSettings): Promise<Connection> {
const connectionNavigatorViewSettings = this.get(key)?.navigatorSettings || DEFAULT_NAVIGATOR_VIEW_SETTINGS;
const { connection } = await this.graphQLService.sdk.setConnectionNavigatorSettings({
connectionId: key.connectionId,
projectId: key.projectId,
settings: { ...connectionNavigatorViewSettings, ...settings },
});

this.set(createConnectionParam(connection), connection);
this.onDataOutdated.execute(key);

return this.get(key)!;
}

async update(key: IConnectionInfoParams, config: ConnectionConfig): Promise<DatabaseConnection> {
await this.performUpdate(key, [], async () => {
const { connection } = await this.graphQLService.sdk.updateConnection({
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default [
['ui_field_is_required', 'Please fill in this field'],
['ui_delete_confirmation_message', 'You are about to delete "{arg:item}". Are you sure?'],
['ui_not_selected', 'Not selected'],
['ui_reset', 'Reset'],

['root_permission_denied', "You don't have permissions"],
['root_permission_no_permission', "You don't have permission for this action"],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default [
['ui_field_is_required', 'Please fill in this field'],
['ui_delete_confirmation_message', 'You are about to delete "{arg:item}". Are you sure?'],
['ui_not_selected', 'Not selected'],
['ui_reset', 'Reset'],
Copy link
Contributor

Choose a reason for hiding this comment

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

can be translated it to languages respectively using ai suggestions


['root_permission_denied', "Vous n'avez pas les permissions"],
['root_permission_no_permission', "Vous n'avez pas la permission pour cette action"],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default [
['ui_field_is_required', 'Please fill in this field'],
['ui_delete_confirmation_message', 'You are about to delete "{arg:item}". Are you sure?'],
['ui_not_selected', 'Not selected'],
['ui_reset', 'Reset'],

['root_permission_denied', 'Non hai i permessi'],
['app_root_session_expire_warning_title', 'La sessione sta per scadere'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default [
['ui_field_is_required', 'Заполните это поле'],
['ui_delete_confirmation_message', 'Вы собираетесь удалить "{arg:item}". Вы уверены?'],
['ui_not_selected', 'Не выбрано'],
['ui_reset', 'Сбросить'],

['root_permission_denied', 'Отказано в доступе'],
['root_permission_no_permission', 'У вас нет разрешения на это действие'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/vi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default [
['ui_field_is_required', 'Please fill in this field'],
['ui_delete_confirmation_message', 'You are about to delete "{arg:item}". Are you sure?'],
['ui_not_selected', 'Not selected'],
['ui_reset', 'Reset'],

['root_permission_denied', 'Bạn không có quyền'],
['root_permission_no_permission', 'Bạn không có quyền thực hiện hành động này'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-localization/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default [
['ui_field_is_required', 'Please fill in this field'],
['ui_delete_confirmation_message', 'You are about to delete "{arg:item}". Are you sure?'],
['ui_not_selected', 'Not selected'],
['ui_reset', 'Reset'],

['root_permission_denied', '您没有权限'],
['root_permission_no_permission', '您没有权限执行此操作'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2026 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 { NavigatorSettingsInput } from '@cloudbeaver/core-sdk';

export type NavigatorView = 'simple' | 'advanced';
export type NavigatorViewSettings = Partial<NavigatorSettingsInput>;
export type NavigatorViewSettings = Omit<NavigatorSettingsInput, 'showSystemObjects'> & { showSystemObjects?: boolean };
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we mark a thing that is required to optional? may be it should be optional first from the begin?

Copy link
Contributor

Choose a reason for hiding this comment

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

also DEFAULT_NAVIGATOR_VIEW_SETTINGS in ConnectionInfoResource should be exported here, in this file


export const CONNECTION_NAVIGATOR_VIEW_SETTINGS: Record<NavigatorView, NavigatorViewSettings> = {
simple: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mutation clearConnectionNavigatorSettings($id: ID!, $projectId: ID!) {
connection: clearConnectionNavigatorSettings(id: $id, projectId: $projectId) {
...DatabaseConnectionNavigatorViewSettings
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
query getUserConnectionsNavigatorViewSettings($projectId: ID, $connectionId: ID, $projectIds: [ID!]) {
connections: userConnections(projectId: $projectId, id: $connectionId, projectIds: $projectIds) {
...DatabaseConnectionNavigatorViewSettings
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutation setConnectionNavigatorSettings($projectId: ID!, $connectionId: ID!, $settings: NavigatorSettingsInput!) {
connection: setConnectionNavigatorSettings(projectId: $projectId, id: $connectionId, settings: $settings) {
...DatabaseConnection
...DatabaseConnectionNavigatorViewSettings
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ fragment AllNavigatorSettings on NavigatorSettings {
hideFolders
hideSchemas
hideVirtualModel
}

userSettings
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ fragment DatabaseConnection on ConnectionInfo {
nodePath
features
supportedDataFormats
navigatorSettings {
...AllNavigatorSettings
}
canViewSettings
canEdit
canDelete
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fragment DatabaseConnectionNavigatorViewSettings on ConnectionInfo {
id
projectId
navigatorSettings {
...AllNavigatorSettings
}
originalNavigatorSettings {
...AllNavigatorSettings
}
Comment on lines +7 to +9
Copy link
Member

Choose a reason for hiding this comment

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

probably you need to split it into two fragments and two resources, because originalNavigatorSettings needed only for connection editing form

}
17 changes: 17 additions & 0 deletions webapp/packages/plugin-connection-view/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# dependencies
/node_modules

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
55 changes: 55 additions & 0 deletions webapp/packages/plugin-connection-view/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@cloudbeaver/plugin-connection-view",
"type": "module",
"sideEffects": [
"./lib/module.js",
"./lib/index.js",
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"exports": {
".": "./lib/index.js",
"./module": "./lib/module.js"
},
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob lib",
"lint": "eslint ./src/ --ext .ts,.tsx",
"validate-dependencies": "core-cli-validate-dependencies"
},
"dependencies": {
"@cloudbeaver/core-blocks": "workspace:*",
"@cloudbeaver/core-connections": "workspace:*",
"@cloudbeaver/core-data-context": "workspace:*",
"@cloudbeaver/core-di": "workspace:*",
"@cloudbeaver/core-events": "workspace:*",
"@cloudbeaver/core-localization": "workspace:*",
"@cloudbeaver/core-navigation-tree": "workspace:*",
"@cloudbeaver/core-projects": "workspace:*",
"@cloudbeaver/core-resource": "workspace:*",
"@cloudbeaver/core-root": "workspace:*",
"@cloudbeaver/core-sdk": "workspace:*",
"@cloudbeaver/core-ui": "workspace:*",
"@cloudbeaver/core-utils": "workspace:*",
"@cloudbeaver/core-view": "workspace:*",
"@cloudbeaver/plugin-connections": "workspace:*",
"@dbeaver/js-helpers": "workspace:*",
"mobx": "^6",
"mobx-react-lite": "^4",
"react": "^19",
"react-dom": "^19",
"tslib": "^2"
},
"devDependencies": {
"@cloudbeaver/core-cli": "workspace:*",
"@cloudbeaver/tsconfig": "workspace:*",
"@types/react": "^19",
"rimraf": "^6",
"typescript": "^5",
"typescript-plugin-css-modules": "^5"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2026 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_CONNECTION_VIEW_ADVANCED = createAction('connection-view-advanced', {
label: 'app_navigationTree_connection_view_option_advanced',
label: 'plugin_connection_view_option_advanced',
type: 'select',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2026 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_CONNECTION_VIEW_RESET = createAction('connection-view-reset', {
label: 'ui_reset',
tooltip: 'plugin_connection_view_option_reset_description',
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2026 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_CONNECTION_VIEW_SIMPLE = createAction('connection-view-simple', {
label: 'app_navigationTree_connection_view_option_simple',
label: 'plugin_connection_view_option_simple',
type: 'select',
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 DBeaver Corp and others
* Copyright (C) 2020-2026 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_CONNECTION_VIEW_SYSTEM_OBJECTS = createAction('connection-view-system-objects', {
label: 'app_navigationTree_connection_view_option_showSystemObjects',
label: 'plugin_connection_view_option_show_system_objects',
type: 'checkbox',
});
44 changes: 44 additions & 0 deletions webapp/packages/plugin-connection-view/src/ConnectionViewForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2026 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 { observer } from 'mobx-react-lite';

import { Container, FieldCheckbox, Group, GroupTitle, useAutoLoad, useTranslate } from '@cloudbeaver/core-blocks';
import { CONNECTION_NAVIGATOR_VIEW_SETTINGS, isNavigatorViewSettingsEqual } from '@cloudbeaver/core-root';
import { getConnectionFormOptionsPart, type ConnectionFormContainerProps } from '@cloudbeaver/plugin-connections';

import { getConnectionViewPart } from './getConnectionViewPart.js';

export const ConnectionViewForm = observer<ConnectionFormContainerProps>(function ConnectionViewForm({ formState }) {
const translate = useTranslate();
const optionsFormPart = getConnectionFormOptionsPart(formState);
const viewFormPart = getConnectionViewPart(formState);

useAutoLoad(ConnectionViewForm, [optionsFormPart, viewFormPart]);

const isSimple = isNavigatorViewSettingsEqual(viewFormPart.state, CONNECTION_NAVIGATOR_VIEW_SETTINGS.simple);

function changeView() {
const view = isSimple ? CONNECTION_NAVIGATOR_VIEW_SETTINGS.advanced : CONNECTION_NAVIGATOR_VIEW_SETTINGS.simple;
viewFormPart.state = { ...viewFormPart.state, ...view };
}

return (
<Group form gap>
<GroupTitle>{translate('plugin_connection_view')}</GroupTitle>
<Container gap dense>
<FieldCheckbox id="simple" checked={isSimple} onChange={changeView}>
{translate('plugin_connection_view_option_simple')}
</FieldCheckbox>
Comment on lines +35 to +37
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to use select here so we can also see 2 options: simple and advanced like it is in connection context menu

<FieldCheckbox name="showSystemObjects" state={viewFormPart.state}>
{translate('plugin_connection_view_option_show_system_objects')}
</FieldCheckbox>
</Container>
</Group>
);
});
Loading
Loading