mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/devel' into CB-92-builder-package
# Conflicts: # webapp/yarn.lock
This commit is contained in:
+3
-3
@@ -66,9 +66,9 @@ public class SampleDataSourceConfigurationStorage implements DBPDataSourceConfig
|
||||
if (sampleConfigFile.exists()) {
|
||||
log.debug("Loading provided connections from [" + sampleConfigFile.getFullPath().toString() + "]");
|
||||
List<? extends DBPDataSourceContainer> dsList = registry.loadDataSourcesFromFile(this, sampleConfigFile);
|
||||
for (DBPDataSourceContainer ds : dsList) {
|
||||
log.debug("\tProvided connection: " + ds.getName());
|
||||
}
|
||||
// for (DBPDataSourceContainer ds : dsList) {
|
||||
// log.debug("\tProvided connection: " + ds.getName());
|
||||
// }
|
||||
return dsList;
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -152,6 +152,9 @@ public class WebDatabaseDriverConfig {
|
||||
cfg.setHostPort(driver.getDefaultPort());
|
||||
cfg.setUrl(driver.getDataSourceProvider().getConnectionURL(driver, cfg));
|
||||
DBPPropertyDescriptor[] properties = driver.getDataSourceProvider().getConnectionProperties(webSession.getProgressMonitor(), driver, cfg);
|
||||
if (properties == null) {
|
||||
return new WebPropertyInfo[0];
|
||||
}
|
||||
|
||||
PropertySourceCustom propertySource = new PropertySourceCustom(
|
||||
properties,
|
||||
|
||||
+26
-18
@@ -73,7 +73,7 @@ public class WebSession {
|
||||
private String locale;
|
||||
private boolean cacheExpired;
|
||||
|
||||
private final List<WebConnectionInfo> connections = new ArrayList<>();
|
||||
private final Map<String, WebConnectionInfo> connections = new HashMap<>();
|
||||
private final List<WebServerMessage> progressMessages = new ArrayList<>();
|
||||
|
||||
private final Map<String, WebAsyncTaskInfo> asyncTasks = new HashMap<>();
|
||||
@@ -83,6 +83,7 @@ public class WebSession {
|
||||
private DBNModel navigatorModel;
|
||||
private DBNProjectDatabases databases;
|
||||
private DBRProgressMonitor progressMonitor = new SessionProgressMonitor();
|
||||
private DBNProject projectNode;
|
||||
|
||||
public WebSession(HttpSession httpSession) {
|
||||
this.id = httpSession.getId();
|
||||
@@ -175,7 +176,7 @@ public class WebSession {
|
||||
this.navigatorModel.initialize();
|
||||
|
||||
DBPProject project = platform.getWorkspace().getActiveProject();
|
||||
DBNProject projectNode = this.navigatorModel.getRoot().getProjectNode(project);
|
||||
this.projectNode = this.navigatorModel.getRoot().getProjectNode(project);
|
||||
this.databases = projectNode.getDatabases();
|
||||
this.locale = Locale.getDefault().getLanguage();
|
||||
|
||||
@@ -184,7 +185,7 @@ public class WebSession {
|
||||
for (DBPDataSourceContainer ds : databases.getDataSourceRegistry().getDataSources()) {
|
||||
if (ds.isProvided()) {
|
||||
WebConnectionInfo connectionInfo = new WebConnectionInfo(this, ds);
|
||||
connections.add(connectionInfo);
|
||||
connections.put(connectionInfo.getId(), connectionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,13 +202,13 @@ public class WebSession {
|
||||
attributes.clear();
|
||||
}
|
||||
|
||||
List<WebConnectionInfo> conCopy;
|
||||
Map<String, WebConnectionInfo> conCopy;
|
||||
synchronized (this.connections) {
|
||||
conCopy = new ArrayList<>(this.connections);
|
||||
conCopy = new HashMap<>(this.connections);
|
||||
this.connections.clear();
|
||||
}
|
||||
|
||||
for (WebConnectionInfo connectionInfo : conCopy) {
|
||||
for (WebConnectionInfo connectionInfo : conCopy.values()) {
|
||||
if (connectionInfo.isConnected()) {
|
||||
new DisconnectJob(connectionInfo.getDataSourceContainer()).schedule();
|
||||
}
|
||||
@@ -247,7 +248,11 @@ public class WebSession {
|
||||
return navigatorModel;
|
||||
}
|
||||
|
||||
public DBNProjectDatabases getDatabases() {
|
||||
public DBNProject getProjectNode() {
|
||||
return projectNode;
|
||||
}
|
||||
|
||||
public DBNProjectDatabases getDatabasesNode() {
|
||||
return databases;
|
||||
}
|
||||
|
||||
@@ -293,23 +298,26 @@ public class WebSession {
|
||||
@Association
|
||||
public List<WebConnectionInfo> getConnections() {
|
||||
synchronized (connections) {
|
||||
return new ArrayList<>(connections);
|
||||
return new ArrayList<>(connections.values());
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public WebConnectionInfo getWebConnectionInfo(String connectionID) throws DBWebException {
|
||||
WebConnectionInfo connectionInfo = null;
|
||||
WebConnectionInfo connectionInfo;
|
||||
synchronized (connections) {
|
||||
for (WebConnectionInfo ci : connections) {
|
||||
if (ci.getId().equals(connectionID)) {
|
||||
connectionInfo = ci;
|
||||
break;
|
||||
}
|
||||
}
|
||||
connectionInfo = connections.get(connectionID);
|
||||
}
|
||||
if (connectionInfo == null) {
|
||||
throw new DBWebException("Connection '" + connectionID + "' not found");
|
||||
DBPDataSourceContainer dataSource = databases.getDataSourceRegistry().getDataSource(connectionID);
|
||||
if (dataSource != null) {
|
||||
connectionInfo = new WebConnectionInfo(this, dataSource);
|
||||
synchronized (connections) {
|
||||
connections.put(connectionID, connectionInfo);
|
||||
}
|
||||
} else {
|
||||
throw new DBWebException("Connection '" + connectionID + "' not found");
|
||||
}
|
||||
}
|
||||
return connectionInfo;
|
||||
}
|
||||
@@ -317,13 +325,13 @@ public class WebSession {
|
||||
|
||||
public void addConnection(WebConnectionInfo connectionInfo) {
|
||||
synchronized (connections) {
|
||||
connections.add(connectionInfo);
|
||||
connections.put(connectionInfo.getId(), connectionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeConnection(WebConnectionInfo connectionInfo) {
|
||||
synchronized (connections) {
|
||||
connections.remove(connectionInfo);
|
||||
connections.remove(connectionInfo.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
import org.jkiss.dbeaver.Log;
|
||||
import org.jkiss.dbeaver.model.DBConstants;
|
||||
import org.jkiss.dbeaver.model.connection.DBPDriver;
|
||||
import org.jkiss.dbeaver.model.exec.DBCException;
|
||||
import org.jkiss.dbeaver.model.runtime.LoggingProgressMonitor;
|
||||
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;
|
||||
import org.jkiss.dbeaver.registry.driver.DriverDescriptor;
|
||||
import org.jkiss.dbeaver.utils.ContentUtils;
|
||||
import org.jkiss.dbeaver.utils.GeneralUtils;
|
||||
import org.jkiss.dbeaver.utils.SystemVariablesResolver;
|
||||
@@ -82,9 +82,9 @@ public class CBDatabase {
|
||||
|
||||
void initialize() throws DBException {
|
||||
if (CommonUtils.isEmpty(databaseConfiguration.getDriver())) {
|
||||
throw new DBException("Database driver not specified");
|
||||
throw new DBException("No database driver configured for CloudBeaver database");
|
||||
}
|
||||
DriverDescriptor driver = DataSourceProviderRegistry.getInstance().findDriver(databaseConfiguration.getDriver());
|
||||
DBPDriver driver = DataSourceProviderRegistry.getInstance().findDriver(databaseConfiguration.getDriver());
|
||||
if (driver == null) {
|
||||
throw new DBException("Driver '" + databaseConfiguration.getDriver() + "' not found");
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class CBPlatform extends BasePlatformImpl {
|
||||
continue;
|
||||
}
|
||||
List<? extends DBPDriverLibrary> libraries = driver.getDriverLibraries();
|
||||
if (!libraries.isEmpty()) {
|
||||
{
|
||||
boolean hasAllFiles = true;
|
||||
for (DBPDriverLibrary lib : libraries) {
|
||||
if (!lib.isOptional() && lib.getType() != DBPDriverLibrary.FileType.license &&
|
||||
@@ -172,7 +172,7 @@ public class CBPlatform extends BasePlatformImpl {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("Available drivers: " + applicableDrivers.stream().map(DBPDriver::getId).collect(Collectors.joining(",")));
|
||||
log.info("Available drivers: " + applicableDrivers.stream().map(DBPDriver::getFullName).collect(Collectors.joining(",")));
|
||||
|
||||
sessionManager = WebSessionManager.getInstance();
|
||||
|
||||
|
||||
+4
-1
@@ -148,7 +148,7 @@ class CBSecurityController implements DBWSecurityController {
|
||||
String propertyName = cred.getKey();
|
||||
WebAuthProviderPropertyDescriptor property = authProvider.getCredentialParameter(propertyName);
|
||||
if (property == null) {
|
||||
throw new IllegalArgumentException("Invalid auth provider '" + authProvider.getId() + "' property '" + propertyName + "'");
|
||||
return null;
|
||||
}
|
||||
String encodedValue = CommonUtils.toString(cred.getValue());
|
||||
encodedValue = property.getEncryption().encrypt(userId, encodedValue);
|
||||
@@ -162,6 +162,9 @@ class CBSecurityController implements DBWSecurityController {
|
||||
if (!CommonUtils.isEmpty(credentials)) {
|
||||
try (PreparedStatement dbStat = dbCon.prepareStatement("INSERT INTO CB_USER_CREDENTIALS(USER_ID,PROVIDER_ID,CRED_ID,CRED_VALUE) VALUES(?,?,?,?)")) {
|
||||
for (String[] cred : transformedCredentials) {
|
||||
if (cred == null) {
|
||||
continue;
|
||||
}
|
||||
dbStat.setString(1, userId);
|
||||
dbStat.setString(2, authProvider.getId());
|
||||
dbStat.setString(3, cred[0]);
|
||||
|
||||
+4
-4
@@ -135,7 +135,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
throw new DBWebException("Datasource '" + dataSourceId + "' not found");
|
||||
}
|
||||
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabases().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabasesNode().getDataSourceRegistry();
|
||||
DBPDataSourceContainer newDataSource = sessionRegistry.createDataSource(dataSourceTemplate);
|
||||
newDataSource.setSavePassword(true);
|
||||
((DataSourceDescriptor)newDataSource).setTemporary(true);
|
||||
@@ -164,7 +164,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo createConnection(WebSession webSession, WebConnectionConfig connectionConfig) throws DBWebException {
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabases().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabasesNode().getDataSourceRegistry();
|
||||
|
||||
DBPDataSourceContainer newDataSource = makeConnectionInstance(connectionConfig, sessionRegistry);
|
||||
if (CommonUtils.isEmpty(newDataSource.getName())) {
|
||||
@@ -181,7 +181,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
|
||||
@Override
|
||||
public WebConnectionInfo testConnection(WebSession webSession, WebConnectionConfig connectionConfig) throws DBWebException {
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabases().getDataSourceRegistry();
|
||||
DBPDataSourceRegistry sessionRegistry = webSession.getDatabasesNode().getDataSourceRegistry();
|
||||
|
||||
DBPDataSourceContainer newDataSource = makeConnectionInstance(connectionConfig, sessionRegistry);
|
||||
try {
|
||||
@@ -216,7 +216,7 @@ public class WebServiceCore implements DBWServiceCore {
|
||||
// Disconnect in async mode?
|
||||
//new DisconnectJob(connectionInfo.getDataSource()).schedule();
|
||||
}
|
||||
webSession.getDatabases().getDataSourceRegistry().removeDataSource(connectionInfo.getDataSourceContainer());
|
||||
webSession.getDatabasesNode().getDataSourceRegistry().removeDataSource(connectionInfo.getDataSourceContainer());
|
||||
webSession.removeConnection(connectionInfo);
|
||||
|
||||
return disconnected;
|
||||
|
||||
+7
-1
@@ -35,6 +35,7 @@ import org.jkiss.dbeaver.model.navigator.DBNNode;
|
||||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
|
||||
import org.jkiss.dbeaver.model.struct.DBSObject;
|
||||
import org.jkiss.dbeaver.model.struct.rdb.DBSCatalog;
|
||||
import org.jkiss.utils.ArrayUtils;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -56,7 +57,12 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
DBNNode[] nodeChildren;
|
||||
boolean isRootPath = CommonUtils.isEmpty(parentPath) || "/".equals(parentPath);
|
||||
if (isRootPath) {
|
||||
nodeChildren = session.getDatabases().getChildren(monitor);
|
||||
nodeChildren = session.getDatabasesNode().getChildren(monitor);
|
||||
// Inject extra nodes
|
||||
List<DBNNode> extraNodes = session.getProjectNode().getExtraNodes();
|
||||
if (!extraNodes.isEmpty()) {
|
||||
nodeChildren = ArrayUtils.concatArrays(extraNodes.toArray(new DBNNode[0]), nodeChildren);
|
||||
}
|
||||
} else {
|
||||
DBNNode parentNode = session.getNavigatorModel().getNodeByPath(monitor, parentPath);
|
||||
if (parentNode == null) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -52,7 +52,7 @@ export const UserInfo = observer(function UserInfo() {
|
||||
<user-icon as="div">
|
||||
<IconOrImage icon='user' viewBox='0 0 28 28' />
|
||||
</user-icon>
|
||||
<user-name as='div'>{authInfoService.userInfo.userId}</user-name>
|
||||
<user-name as='div'>{authInfoService.userInfo.displayName || authInfoService.userInfo.userId}</user-name>
|
||||
</user>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user