Skip to content

Commit

Permalink
Merge branch 'devel' into CB-4691-control-files-downloading-ability
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniaBzzz authored Jul 1, 2024
2 parents 5d63d1b + 4433018 commit 794ea87
Show file tree
Hide file tree
Showing 38 changed files with 249 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,15 @@ public int getKeepAliveInterval() {
return dataSourceContainer.getConnectionConfiguration().getKeepAliveInterval();
}

@Property
public boolean isAutocommit() {
Boolean isAutoCommit = dataSourceContainer.getConnectionConfiguration().getBootstrap().getDefaultAutoCommit();
if (isAutoCommit == null) {
return true;
}
return isAutoCommit;
}

@Property
public List<WebSecretInfo> getSharedSecrets() throws DBException {
return dataSourceContainer.listSharedCredentials()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.jkiss.dbeaver.model.websocket.event.WSEventController;

import java.nio.file.Path;
import java.util.Map;

/**
* Base interface for web application
Expand Down Expand Up @@ -95,4 +96,8 @@ default String getRootURI() {
int getServerPort();

boolean isLicenseRequired();

default void getStatusInfo(Map<String, Object> infoMap) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ type ConnectionInfo {
url: String

keepAliveInterval: Int!
autocommit: Boolean

properties: Object

Expand Down Expand Up @@ -505,6 +506,7 @@ input ConnectionConfig {

# Keep-Alive interval
keepAliveInterval: Int
autocommit: Boolean

# Template connection
template: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ public static void setConnectionConfiguration(DBPDriver driver, DBPConnectionCon
if (config.getKeepAliveInterval() >= 0) {
dsConfig.setKeepAliveInterval(config.getKeepAliveInterval());
}
if (config.isDefaultAutoCommit() != null) {
dsConfig.getBootstrap().setDefaultAutoCommit(config.isDefaultAutoCommit());
}
// Save provider props
if (config.getProviderProperties() != null) {
dsConfig.setProviderProperties(new LinkedHashMap<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class WebConnectionConfig {
private List<WebNetworkHandlerConfigInput> networkHandlersConfig;
private DBPDriverConfigurationType configurationType;
private String selectedSecretId;
private boolean defaultAutoCommit;

public WebConnectionConfig() {
}
Expand All @@ -85,6 +86,7 @@ public WebConnectionConfig(Map<String, Object> params) {
url = JSONUtils.getString(params, "url");

keepAliveInterval = JSONUtils.getInteger(params, "keepAliveInterval", -1);
defaultAutoCommit = JSONUtils.getBoolean(params, "autocommit", true);

name = JSONUtils.getString(params, "name");
description = JSONUtils.getString(params, "description");
Expand Down Expand Up @@ -235,6 +237,11 @@ public Integer getKeepAliveInterval() {
return keepAliveInterval;
}

@Property
public Boolean isDefaultAutoCommit() {
return defaultAutoCommit;
}

@Nullable
public String getSelectedSecretId() {
return selectedSecretId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
package io.cloudbeaver.server.servlets;

import com.google.gson.stream.JsonWriter;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.CBConstants;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import org.jkiss.dbeaver.utils.GeneralUtils;
Expand All @@ -44,6 +46,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
infoMap.put("health", "ok");
infoMap.put("product.name", GeneralUtils.getProductName());
infoMap.put("product.version", GeneralUtils.getProductVersion().toString());
CBApplication.getInstance().getStatusInfo(infoMap);
try (JsonWriter writer = new JsonWriter(response.getWriter())) {
JSONUtils.serializeMap(writer, infoMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ public WebConnectionInfo updateConnection(
}

dataSource.setFolder(config.getFolder() != null ? sessionRegistry.getFolder(config.getFolder()) : null);

if (config.isDefaultAutoCommit() != null) {
dataSource.setDefaultAutoCommit(config.isDefaultAutoCommit());
}
WebServiceUtils.setConnectionConfiguration(dataSource.getDriver(),
dataSource.getConnectionConfiguration(),
config);
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@cloudbeaver/core-version": "^0",
"@cloudbeaver/core-version-update": "^0",
"@cloudbeaver/core-view": "^0",
"@cloudbeaver/core-website": "^0",
"mobx": "^6",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-bootstrap/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { coreUIManifest } from '@cloudbeaver/core-ui';
import { coreVersionManifest } from '@cloudbeaver/core-version';
import { coreVersionUpdateManifest } from '@cloudbeaver/core-version-update';
import { coreViewManifest } from '@cloudbeaver/core-view';
import { coreWebsiteManifest } from '@cloudbeaver/core-website';

export const coreManifests: PluginManifest[] = [
{
Expand All @@ -63,6 +64,7 @@ export const coreManifests: PluginManifest[] = [
coreResourceManifest,
coreSDKManifest,
coreRootManifest,
coreWebsiteManifest,
coreBrowserSettingsManifest,
coreBrowserCookiesManifest,
coreProductManifest,
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-bootstrap/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
},
{
"path": "../core-view/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
}
],
"include": [
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default [
['connections_connection_edit_access_team', 'Team'],
['connections_connection_edit_search', 'Suchen'],
['connections_connection_edit_search_hosts', 'Hostnamen'],
['connections_connection_expert_settings', 'Expert settings'],
['connections_connection_address', 'Adresse'],
['connections_connection_folder', 'Ordner'],
['connections_connection_name', 'Verbindungsname'],
Expand All @@ -42,4 +43,5 @@ export default [
['connections_network_handler_ssh_tunnel_auth_type', 'Authentifizierungsmethode'],
['connections_network_handler_ssh_tunnel_advanced_settings', 'Erweiterte Einstellungen'],
['connections_not_found', 'Es wurden keine Datenbankverbindungen gefunden'],
['connections_connection_autocommit', 'Auto commit'],
];
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default [
['connections_connection_test_fail', 'Connection test failed'],
['connections_connection_create_fail', 'Fail to create connection'],
['connections_connection_save_fail', 'Fail to save connection'],
['connections_connection_expert_settings', 'Expert settings'],
['connections_connection_keep_alive', 'Keep alive (in seconds)'],
['connections_connection_autocommit', 'Auto commit'],
['connections_connection_keep_alive_tooltip', 'No auto disconnect'],
['connections_network_handler_test', 'Test Tunnel'],
['connections_network_handler_test_fail', 'Tunnel test failed'],
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default [
['connections_connection_test_fail', 'Échec du test de connexion'],
['connections_connection_create_fail', 'Échec de la création de la connexion'],
['connections_connection_save_fail', 'Échec de la sauvegarde de la connexion'],
['connections_connection_expert_settings', 'Expert settings'],
['connections_connection_keep_alive', 'Garder actif (en secondes)'],
['connections_connection_autocommit', 'Auto commit'],
['connections_connection_keep_alive_tooltip', 'Pas de déconnexion automatique'],
['connections_network_handler_test', 'Tester le tunnel'],
['connections_network_handler_test_fail', 'Échec du test du tunnel'],
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default [
['connections_connection_test_fail', 'Prova di connessione fallita'],
['connections_connection_create_fail', 'Errore di creazione connessione'],
['connections_connection_save_fail', 'Errore di salvataggio connessione'],
['connections_connection_expert_settings', 'Expert settings'],
['connections_connection_keep_alive', 'Keep alive (in seconds)'],
['connections_connection_autocommit', 'Auto commit'],
['connections_connection_keep_alive_tooltip', 'No auto disconnect'],
['connections_network_handler_test', 'Prova il Tunnel'],
['connections_network_handler_test_fail', 'Prova del Tunnel fallita'],
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default [
['connections_connection_test_fail', 'Не удалось выполнить подключение'],
['connections_connection_create_fail', 'Не удалось создать подключение'],
['connections_connection_save_fail', 'Не удалось сохранить подключение'],
['connections_connection_expert_settings', 'Продвинутые настройки'],
['connections_connection_keep_alive', 'Поддерживать соединение (в секундах)'],
['connections_connection_autocommit', 'Авто коммит'],
['connections_connection_keep_alive_tooltip', 'Не отключать соединение'],
['connections_network_handler_test', 'Проверить подключение'],
['connections_network_handler_test_fail', 'Не удалось установить соединение'],
Expand Down
2 changes: 2 additions & 0 deletions webapp/packages/core-connections/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export default [
['connections_connection_test_fail', '连接测试失败'],
['connections_connection_create_fail', '无法创建连接'],
['connections_connection_save_fail', '无法保存连接'],
['connections_connection_expert_settings', 'Expert settings'],
['connections_connection_keep_alive', 'Keep alive (in seconds)'],
['connections_connection_autocommit', 'Auto commit'],
['connections_connection_keep_alive_tooltip', 'No auto disconnect'],
['connections_network_handler_test', '测试隧道'],
['connections_network_handler_test_fail', '隧道测试失败'],
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"peerDependencies": {},
"devDependencies": {
"@cloudbeaver/core-sdk": "^0",
"@cloudbeaver/core-website": "^0",
"@cloudbeaver/tests-runner": "^0",
"@types/jest": "^29",
"msw": "^2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* you may not use this file except in compliance with the License.
*/
import type { ServerConfigQuery } from '@cloudbeaver/core-sdk';
import { WebsiteLinks } from '@cloudbeaver/core-website';

import { defaultProductConfiguration } from './defaultProductConfiguration';

Expand Down Expand Up @@ -112,7 +113,7 @@ export const defaultServerConfig: (productConfiguration?: Record<string, any>) =
productInfo: {
id: 'io.cloudbeaver.product.ce.product',
version: '22.1.2.202207140640',
latestVersionInfo: 'https://dbeaver.com/product/cloudbeaver-ce-version.json',
latestVersionInfo: WebsiteLinks.LATEST_COMMUNITY_VERSION_PAGE,
name: 'CloudBeaver CE Server',
description: 'Cloudbeaver Web UI Application',
buildTime: 'July 14, 2022',
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-root/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
{
"path": "../core-utils/tsconfig.json"
},
{
"path": "../core-website/tsconfig.json"
},
{
"path": "../tests-runner/tsconfig.json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fragment DatabaseConnection on ConnectionInfo {
description
driverId
keepAliveInterval
autocommit

template
connected
Expand Down
24 changes: 24 additions & 0 deletions webapp/packages/core-website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/lib

# misc
.DS_Store
.env*

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# typescript
*.tsbuildinfo
28 changes: 28 additions & 0 deletions webapp/packages/core-website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@cloudbeaver/core-website",
"sideEffects": [
"src/**/*.css",
"src/**/*.scss",
"public/**/*"
],
"version": "0.1.0",
"description": "",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"build": "tsc -b",
"clean": "rimraf --glob dist",
"lint": "eslint ./src/ --ext .ts,.tsx",
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix",
"test": "core-cli-test",
"validate-dependencies": "core-cli-validate-dependencies",
"update-ts-references": "yarn run clean && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-di": "^0"
},
"peerDependencies": {},
"devDependencies": {
"typescript": "^5"
}
}
34 changes: 34 additions & 0 deletions webapp/packages/core-website/src/WebsiteLinks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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 class WebsiteLinks {
static DATA_EDITOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Data-editor/';
static SQL_EDITOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/SQL-Editor/';
static SERVER_CONFIGURATION_RESOURCE_QUOTAS_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Server-configuration/#resource-quotas';
static DATABASE_NAVIGATOR_DOCUMENTATION_PAGE = 'https://dbeaver.com/docs/cloudbeaver/Database-Navigator/';

static ENTERPRISE_BUY_PRODUCT_PAGE = 'https://dbeaver.com/products/cloudbeaver-enterprise/';
static TEAM_EDITION_BUY_PRODUCT_PAGE = 'https://dbeaver.com/products/team-edition/';
static LATEST_COMMUNITY_VERSION_PAGE = 'https://dbeaver.com/product/cloudbeaver-ce-version.json';

static TEAM_ARCHIVE = 'https://dbeaver.com/downloads-team';
static CONTACT_PAGE = 'https://dbeaver.com/contact/';

static GITHUB_REPOSITORY_PAGE = 'https://github.com/dbeaver/cloudbeaver';

static getTeamArchiveById(id: string) {
return `${WebsiteLinks.TEAM_ARCHIVE}/${id}`;
}

static getProductBuyPage(distributed: boolean) {
if (distributed) {
return WebsiteLinks.TEAM_EDITION_BUY_PRODUCT_PAGE;
}

return WebsiteLinks.ENTERPRISE_BUY_PRODUCT_PAGE;
}
}
9 changes: 9 additions & 0 deletions webapp/packages/core-website/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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 * from './WebsiteLinks';
export * from './manifest';
16 changes: 16 additions & 0 deletions webapp/packages/core-website/src/manifest.ts
Original file line number Diff line number Diff line change
@@ -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.
*/
import type { PluginManifest } from '@cloudbeaver/core-di';

export const coreWebsiteManifest: PluginManifest = {
info: {
name: 'Core Website',
},

providers: [],
};
Loading

0 comments on commit 794ea87

Please sign in to comment.