Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 getDefaultNavigatorSettings() {
return dataSourceContainer.getNavigatorSettings().getOriginalSettings();
}

@Property
@NotNull
public List<WebDataFormat> getSupportedDataFormats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ type ConnectionInfo {

"Supported features (provided etc)"
features: [ String! ]!
"Navigator settings for the connection (with user settings applied)"
navigatorSettings: NavigatorSettings!
"Default navigator settings for the connection (without user settings applied)"
defaultNavigatorSettings: NavigatorSettings!

supportedDataFormats: [ ResultDataFormat! ]!
configurationType: DriverConfigurationType

Expand Down Expand Up @@ -595,7 +599,7 @@ type NavigatorSettings {
hideFolders: Boolean!
hideSchemas: Boolean!
hideVirtualModel: Boolean!

"Shows whether these settings are user-specific or global"
userSettings: Boolean! @since(version: "25.3.2")
}

Expand Down Expand Up @@ -837,10 +841,10 @@ extend type Mutation {
"Disconnect from the database"
closeConnection( id: ID!, projectId: ID ): ConnectionInfo!

"Change navigator settings for connection. It can change default settings or user settings depending on userSettings property."
"Change navigator settings for connection. It can change default settings or user settings depending on 'default' parameter."
setConnectionNavigatorSettings( id: ID!, projectId: ID, settings: NavigatorSettingsInput!): ConnectionInfo!
"Sets to default navigator settings for connection. Resets all user navigator settings for this connection."
clearConnectionNavigatorSettings(projectId: ID!, id: ID! ): ConnectionInfo! @since(version: "25.3.2")
clearConnectionNavigatorSettings(projectId: ID!, id: ID!): ConnectionInfo! @since(version: "25.3.2")

#### Generic async functions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ public void bindWiring(DBWBindingContext model) throws DBWebException {
getWebSession(env),
getProjectReference(env),
getArgumentVal(env, "id"),
WebServiceUtils.parseNavigatorSettings(getArgument(env, "settings"))
))
WebServiceUtils.parseNavigatorSettings(getArgument(env, "settings"))
)
)
.dataFetcher(
"clearConnectionNavigatorSettings", env -> getService(env).clearConnectionNavigatorSettings(
getWebSession(env),
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',
});
Loading
Loading