diff --git a/README.md b/README.md index dd95b358b5..e7f046e7ec 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,14 @@ You can see live demo of CloudBeaver here: https://demo.cloudbeaver.io ## Changelog +### 24.1.2. 2024-07-08 +- Added the ability to change the default commit mode for each connection separately; +- Added additional notifications about restricted operations; +- Improved application behavior when closing a connection - open editors won't be closed on disconnect; +- Added the "Keep alive" setting for Db2 LUW and IMB i, Apache Kyuubi, Clickhouse, Firebird and Trino; +- Fixed the dollar-quoted string parsing in the SQL editor for PostgreSQL; +- Many minor bug fixes, enhancements, and improvements have been made. + ### 24.1.1. 2024-06-24 - Unauthorized access vulnerability was fixed; - French language support was added (thanks to @matthieukhl); diff --git a/osgi-app.properties b/osgi-app.properties index 1a657ff267..527e3a5737 100644 --- a/osgi-app.properties +++ b/osgi-app.properties @@ -23,4 +23,6 @@ testBundlePaths=\ dbeaver/test;\ cloudbeaver/server/test; additionalModuleRoots=\ - opt; \ No newline at end of file + opt; +optionalFeatureRepositories=\ + dbeaver/product/repositories \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF index 028e4d1200..8ecf01a294 100644 --- a/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Model Bundle-SymbolicName: io.cloudbeaver.model;singleton:=true -Bundle-Version: 1.0.56.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.57.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.model/pom.xml b/server/bundles/io.cloudbeaver.model/pom.xml index b47d00242c..cb8a8fc0cf 100644 --- a/server/bundles/io.cloudbeaver.model/pom.xml +++ b/server/bundles/io.cloudbeaver.model/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.model - 1.0.56-SNAPSHOT + 1.0.57-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java index 1a20c860cc..5daf0a8d8e 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java @@ -256,18 +256,20 @@ public RMProject[] listAllSharedProjects() throws DBException { return new RMProject[0]; } var projects = new ArrayList(); - var allPaths = Files.list(sharedProjectsPath).collect(Collectors.toList()); - for (Path path : allPaths) { - var projectPerms = getProjectPermissions( - makeProjectIdFromPath(path, RMProjectType.SHARED), - RMProjectType.SHARED - ); - var rmProject = makeProjectFromPath(path, projectPerms, RMProjectType.SHARED, false); - projects.add(rmProject); + try (Stream list = Files.list(sharedProjectsPath)) { + var allPaths = list.toList(); + for (Path path : allPaths) { + var projectPerms = getProjectPermissions( + makeProjectIdFromPath(path, RMProjectType.SHARED), + RMProjectType.SHARED + ); + var rmProject = makeProjectFromPath(path, projectPerms, RMProjectType.SHARED, false); + projects.add(rmProject); + } + return projects.stream() + .filter(Objects::nonNull) + .toArray(RMProject[]::new); } - return projects.stream() - .filter(Objects::nonNull) - .toArray(RMProject[]::new); } catch (IOException e) { throw new DBException("Error reading shared projects", e); } @@ -581,7 +583,7 @@ public String createResource( @NotNull String resourcePath, boolean isFolder ) throws DBException { - try (var projectLock = lockController.lockProject(projectId, "createResource")) { + try (var ignoredLock = lockController.lockProject(projectId, "createResource")) { validateResourcePath(resourcePath); Path targetPath = getTargetPath(projectId, resourcePath); if (Files.exists(targetPath)) { @@ -613,7 +615,7 @@ public String moveResource( @NotNull String oldResourcePath, @NotNull String newResourcePath ) throws DBException { - try (var projectLock = lockController.lockProject(projectId, "moveResource")) { + try (var ignoredLock = lockController.lockProject(projectId, "moveResource")) { var normalizedOldResourcePath = CommonUtils.normalizeResourcePath(oldResourcePath); var normalizedNewResourcePath = CommonUtils.normalizeResourcePath(newResourcePath); if (log.isDebugEnabled()) { @@ -679,7 +681,7 @@ private void movePropertiesRecursive( @Override public void deleteResource(@NotNull String projectId, @NotNull String resourcePath, boolean recursive) throws DBException { - try (var projectLock = lockController.lockProject(projectId, "deleteResource")) { + try (var ignoredLock = lockController.lockProject(projectId, "deleteResource")) { if (log.isDebugEnabled()) { log.debug("Removing resource from '" + resourcePath + "' in project '" + projectId + "'" + (recursive ? " recursive" : "")); } @@ -768,7 +770,7 @@ public String setResourceContents( @NotNull byte[] data, boolean forceOverwrite ) throws DBException { - try (var lock = lockController.lockProject(projectId, "setResourceContents")) { + try (var ignoredLock = lockController.lockProject(projectId, "setResourceContents")) { validateResourcePath(resourcePath); Number fileSizeLimit = WebAppUtils.getWebApplication() .getAppConfiguration() @@ -822,7 +824,7 @@ public String setResourceProperty( @NotNull String propertyName, @Nullable Object propertyValue ) throws DBException { - try (var projectLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) { + try (var ignoredLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) { validateResourcePath(resourcePath); BaseWebProjectImpl webProject = getWebProject(projectId, false); doFileWriteOperation(projectId, webProject.getMetadataFilePath(), @@ -836,6 +838,27 @@ public String setResourceProperty( } } + @NotNull + @Override + public String setResourceProperties( + @NotNull String projectId, + @NotNull String resourcePath, + @NotNull Map properties + ) throws DBException { + try (var ignoredLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) { + validateResourcePath(resourcePath); + BaseWebProjectImpl webProject = getWebProject(projectId, false); + doFileWriteOperation(projectId, webProject.getMetadataFilePath(), + () -> { + log.debug("Updating resource '" + resourcePath + "' properties in project '" + projectId + "'"); + webProject.setResourceProperties(resourcePath, properties); + return null; + } + ); + return DEFAULT_CHANGE_ID; + } + } + private void validateResourcePath(String resourcePath) throws DBException { var fullPath = Paths.get(resourcePath); for (Path path : fullPath) { @@ -1089,7 +1112,7 @@ private RMResource makeResourceFromPath( ); } if (readProperties) { - final BaseProjectImpl project = (BaseProjectImpl) getWebProject(projectId, true); + final BaseProjectImpl project = getWebProject(projectId, true); final String resourcePath = getProjectRelativePath(projectId, path); final Map properties = project.getResourceProperties(resourcePath); @@ -1134,7 +1157,7 @@ private void fireRmResourceDeleteEvent(@NotNull String projectId, @NotNull Strin ); } - private void fireRmProjectAddEvent(@NotNull RMProject project) throws DBException { + private void fireRmProjectAddEvent(@NotNull RMProject project) { RMEventManager.fireEvent( new RMEvent( RMEvent.Action.RESOURCE_ADD, diff --git a/server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF index d114973475..be8541d8ab 100644 --- a/server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Community Product Bundle-SymbolicName: io.cloudbeaver.product.ce;singleton:=true -Bundle-Version: 24.1.2.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 24.1.3.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.product.ce/pom.xml b/server/bundles/io.cloudbeaver.product.ce/pom.xml index e5b100b491..1d94afbb4a 100644 --- a/server/bundles/io.cloudbeaver.product.ce/pom.xml +++ b/server/bundles/io.cloudbeaver.product.ce/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.product.ce - 24.1.2-SNAPSHOT + 24.1.3-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.resources.drivers.base/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.resources.drivers.base/META-INF/MANIFEST.MF index f4e8e60f4b..b733ca5ac3 100644 --- a/server/bundles/io.cloudbeaver.resources.drivers.base/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.resources.drivers.base/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Base JDBC drivers Bundle-SymbolicName: io.cloudbeaver.resources.drivers.base;singleton:=true -Bundle-Version: 1.0.101.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.102.qualifier +Bundle-Release-Date: 20240722 Bundle-Vendor: DBeaver Corp Bundle-ActivationPolicy: lazy Automatic-Module-Name: io.cloudbeaver.resources.drivers.base diff --git a/server/bundles/io.cloudbeaver.resources.drivers.base/pom.xml b/server/bundles/io.cloudbeaver.resources.drivers.base/pom.xml index 0561bfadf4..e5e794c754 100644 --- a/server/bundles/io.cloudbeaver.resources.drivers.base/pom.xml +++ b/server/bundles/io.cloudbeaver.resources.drivers.base/pom.xml @@ -9,6 +9,6 @@ ../ io.cloudbeaver.resources.drivers.base - 1.0.101-SNAPSHOT + 1.0.102-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.server/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.server/META-INF/MANIFEST.MF index eda743f9c6..ff7ce16808 100644 --- a/server/bundles/io.cloudbeaver.server/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.server/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Server Bundle-SymbolicName: io.cloudbeaver.server;singleton:=true -Bundle-Version: 24.1.2.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 24.1.3.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-Activator: io.cloudbeaver.server.CBPlatformActivator diff --git a/server/bundles/io.cloudbeaver.server/pom.xml b/server/bundles/io.cloudbeaver.server/pom.xml index 5261c97cf1..ca2d30b36d 100644 --- a/server/bundles/io.cloudbeaver.server/pom.xml +++ b/server/bundles/io.cloudbeaver.server/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.server - 24.1.2-SNAPSHOT + 24.1.3-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java index f87931b036..11793023a5 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java @@ -27,6 +27,7 @@ import io.cloudbeaver.registry.WebAuthProviderRegistry; import io.cloudbeaver.server.CBAppConfig; import io.cloudbeaver.server.CBApplication; +import io.cloudbeaver.server.CBPlatform; import io.cloudbeaver.utils.WebAppUtils; import io.cloudbeaver.utils.WebCommonUtils; import io.cloudbeaver.utils.WebDataSourceUtils; @@ -57,6 +58,7 @@ import java.io.InputStream; import java.util.*; +import java.util.stream.Collectors; /** * Various constants @@ -351,4 +353,13 @@ public static List getEnabledAuthProviders() { return result; } + /** + * Returns set of applicable ids of drivers. + */ + @NotNull + public static Set getApplicableDriversIds() { + return CBPlatform.getInstance().getApplicableDrivers().stream() + .map(DBPDriver::getId) + .collect(Collectors.toSet()); + } } diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBPlatform.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBPlatform.java index 5054d6b275..f0e656e645 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBPlatform.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBPlatform.java @@ -34,7 +34,6 @@ import org.jkiss.dbeaver.model.app.DBACertificateStorage; import org.jkiss.dbeaver.model.app.DBPWorkspace; import org.jkiss.dbeaver.model.connection.DBPDataSourceProviderDescriptor; -import org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry; import org.jkiss.dbeaver.model.connection.DBPDriver; import org.jkiss.dbeaver.model.connection.DBPDriverLibrary; import org.jkiss.dbeaver.model.impl.app.DefaultCertificateStorage; @@ -56,7 +55,8 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import java.util.stream.Collectors; /** @@ -199,12 +199,6 @@ public List getApplicableDrivers() { return applicableDrivers; } - @NotNull - @Override - public DBPDataSourceProviderRegistry getDataSourceProviderRegistry() { - return DataSourceProviderRegistry.getInstance(); - } - @NotNull public QMRegistry getQueryManager() { return queryManager; diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java index 8e6a76f602..f5185fcc6e 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java @@ -253,8 +253,8 @@ protected void readProductConfiguration(Map serverConfig, Gson g try (Reader reader = new InputStreamReader(new FileInputStream(rtConfig), StandardCharsets.UTF_8)) { var runtimeProductSettings = JSONUtils.parseMap(gson, reader); var productSettings = serverConfiguration.getProductSettings(); - productSettings.putAll(runtimeProductSettings); - Map flattenConfig = WebAppUtils.flattenMap(productSettings); + runtimeProductSettings.putAll(productSettings); + Map flattenConfig = WebAppUtils.flattenMap(runtimeProductSettings); productSettings.clear(); productSettings.putAll(flattenConfig); } catch (Exception e) { diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java index abc2334af3..f77c7cf6ab 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/core/impl/WebServiceCore.java @@ -67,10 +67,7 @@ import org.jkiss.dbeaver.utils.RuntimeUtils; import org.jkiss.utils.CommonUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -128,9 +125,9 @@ public List getUserConnections( if (projectIds != null) { stream = stream.filter(c -> projectIds.contains(c.getProjectId())); } - List applicableDrivers = CBPlatform.getInstance().getApplicableDrivers(); - return stream.filter(c -> applicableDrivers.contains(c.getDataSourceContainer().getDriver())) - .collect(Collectors.toList()); + Set applicableDrivers = WebServiceUtils.getApplicableDriversIds(); + return stream.filter(c -> applicableDrivers.contains(c.getDataSourceContainer().getDriver().getId())) + .toList(); } @Deprecated diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/navigator/impl/WebServiceNavigator.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/navigator/impl/WebServiceNavigator.java index d6f19cbb5f..62da42bc4c 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/navigator/impl/WebServiceNavigator.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/navigator/impl/WebServiceNavigator.java @@ -26,7 +26,6 @@ import io.cloudbeaver.model.rm.DBNAbstractResourceManagerNode; import io.cloudbeaver.model.rm.DBNResourceManagerResource; import io.cloudbeaver.model.session.WebSession; -import io.cloudbeaver.server.CBPlatform; import io.cloudbeaver.service.navigator.DBWServiceNavigator; import io.cloudbeaver.service.navigator.WebCatalog; import io.cloudbeaver.service.navigator.WebNavigatorNodeInfo; @@ -38,7 +37,6 @@ import org.jkiss.code.Nullable; import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.model.*; -import org.jkiss.dbeaver.model.connection.DBPDriver; import org.jkiss.dbeaver.model.edit.DBECommandContext; import org.jkiss.dbeaver.model.edit.DBEObjectMaker; import org.jkiss.dbeaver.model.edit.DBEObjectRenamer; @@ -85,7 +83,7 @@ public List getNavigatorNodeChildren( DBNNode[] nodeChildren; boolean isRootPath = CommonUtils.isEmpty(parentPath) || "/".equals(parentPath) || ROOT_DATABASES.equals(parentPath); DBNModel navigatorModel = session.getNavigatorModel(); - List applicableDrivers = CBPlatform.getInstance().getApplicableDrivers(); + Set applicableDrivers = WebServiceUtils.getApplicableDriversIds(); if (isRootPath) { DBNRoot rootNode = navigatorModel.getRoot(); nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, rootNode, true); @@ -97,8 +95,8 @@ public List getNavigatorNodeChildren( if (!parentNode.hasChildren(false)) { return EMPTY_NODE_LIST; } - if (parentNode instanceof DBNProject) { - parentNode = ((DBNProject) parentNode).getDatabases(); + if (parentNode instanceof DBNProject projectNode) { + parentNode = projectNode.getDatabases(); } nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, parentNode, false); } @@ -109,15 +107,16 @@ public List getNavigatorNodeChildren( Set nodeIds = new HashSet<>(); // filter duplicate node ids for (DBNNode node : nodeChildren) { - if (node instanceof DBNDatabaseFolder && CommonUtils.isEmpty(((DBNDatabaseFolder) node).getMeta().getChildren(null))) { + if (node instanceof DBNDatabaseFolder folderNode && CommonUtils.isEmpty(folderNode.getMeta().getChildren(null))) { // Skip empty folders. Folder may become empty if their nested elements are provided by UI plugins. continue; } if (!CommonUtils.toBoolean(onlyFolders) || node instanceof DBNContainer) { // Skip connections which are not supported in CB - if (node instanceof DBNDataSource) { - DBPDataSourceContainer container = ((DBNDataSource) node).getDataSourceContainer(); - if (!applicableDrivers.contains(container.getDriver())) { + if (node instanceof DBNDataSource dataSourceNode) { + DBPDataSourceContainer container = dataSourceNode.getDataSourceContainer(); + // compare by id because driver object can be recreated if it was custom or disabled + if (!applicableDrivers.contains(container.getDriver().getId())) { continue; } } diff --git a/server/bundles/io.cloudbeaver.service.admin/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.admin/META-INF/MANIFEST.MF index ed4cb3718d..5a5bfff532 100644 --- a/server/bundles/io.cloudbeaver.service.admin/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.admin/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - Administration Bundle-SymbolicName: io.cloudbeaver.service.admin;singleton:=true -Bundle-Version: 1.0.100.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.101.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.admin/pom.xml b/server/bundles/io.cloudbeaver.service.admin/pom.xml index 909440c700..335a635f3d 100644 --- a/server/bundles/io.cloudbeaver.service.admin/pom.xml +++ b/server/bundles/io.cloudbeaver.service.admin/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.admin - 1.0.100-SNAPSHOT + 1.0.101-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.auth/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.auth/META-INF/MANIFEST.MF index ae3fb06481..7eb60b597e 100644 --- a/server/bundles/io.cloudbeaver.service.auth/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.auth/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - Authentication Bundle-SymbolicName: io.cloudbeaver.service.auth;singleton:=true -Bundle-Version: 1.0.100.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.101.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.auth/pom.xml b/server/bundles/io.cloudbeaver.service.auth/pom.xml index 7a9f8b0db6..dde66852a0 100644 --- a/server/bundles/io.cloudbeaver.service.auth/pom.xml +++ b/server/bundles/io.cloudbeaver.service.auth/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.auth - 1.0.100-SNAPSHOT + 1.0.101-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.data.transfer/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.data.transfer/META-INF/MANIFEST.MF index 836cb4e7c1..94b781e7b7 100644 --- a/server/bundles/io.cloudbeaver.service.data.transfer/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.data.transfer/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - Data Transfer Bundle-SymbolicName: io.cloudbeaver.service.data.transfer;singleton:=true -Bundle-Version: 1.0.101.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.102.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.data.transfer/pom.xml b/server/bundles/io.cloudbeaver.service.data.transfer/pom.xml index 60f9fb3c35..454667b750 100644 --- a/server/bundles/io.cloudbeaver.service.data.transfer/pom.xml +++ b/server/bundles/io.cloudbeaver.service.data.transfer/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.data.transfer - 1.0.101-SNAPSHOT + 1.0.102-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.fs/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.fs/META-INF/MANIFEST.MF index 5da8fcc85f..d46956343b 100644 --- a/server/bundles/io.cloudbeaver.service.fs/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.fs/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - File System Bundle-SymbolicName: io.cloudbeaver.service.fs;singleton:=true -Bundle-Version: 1.0.18.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.19.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.fs/pom.xml b/server/bundles/io.cloudbeaver.service.fs/pom.xml index 93e4a3aef8..a3f4c4ea34 100644 --- a/server/bundles/io.cloudbeaver.service.fs/pom.xml +++ b/server/bundles/io.cloudbeaver.service.fs/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.fs - 1.0.18-SNAPSHOT + 1.0.19-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.metadata/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.metadata/META-INF/MANIFEST.MF index fdc2d81c97..92d1534941 100644 --- a/server/bundles/io.cloudbeaver.service.metadata/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.metadata/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - Metadata Bundle-SymbolicName: io.cloudbeaver.service.metadata;singleton:=true -Bundle-Version: 1.0.104.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.105.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.metadata/pom.xml b/server/bundles/io.cloudbeaver.service.metadata/pom.xml index fa10120229..cb96e24408 100644 --- a/server/bundles/io.cloudbeaver.service.metadata/pom.xml +++ b/server/bundles/io.cloudbeaver.service.metadata/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.metadata - 1.0.104-SNAPSHOT + 1.0.105-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.rm.nio/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.rm.nio/META-INF/MANIFEST.MF index b40e821b2f..b934ee2b58 100644 --- a/server/bundles/io.cloudbeaver.service.rm.nio/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.rm.nio/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Resource manager NIO implementation Bundle-SymbolicName: io.cloudbeaver.service.rm.nio;singleton:=true -Bundle-Version: 1.0.18.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.19.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.rm.nio/pom.xml b/server/bundles/io.cloudbeaver.service.rm.nio/pom.xml index f81d978059..a26c4c70cf 100644 --- a/server/bundles/io.cloudbeaver.service.rm.nio/pom.xml +++ b/server/bundles/io.cloudbeaver.service.rm.nio/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.rm.nio - 1.0.18-SNAPSHOT + 1.0.19-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.rm/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.rm/META-INF/MANIFEST.MF index 91c7dc5a7a..ff0a88c060 100644 --- a/server/bundles/io.cloudbeaver.service.rm/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.rm/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: Cloudbeaver Web Service - Resource manager Bundle-SymbolicName: io.cloudbeaver.service.rm;singleton:=true -Bundle-Version: 1.0.53.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.54.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.rm/pom.xml b/server/bundles/io.cloudbeaver.service.rm/pom.xml index 93e358d1dd..e85d48e771 100644 --- a/server/bundles/io.cloudbeaver.service.rm/pom.xml +++ b/server/bundles/io.cloudbeaver.service.rm/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.rm - 1.0.53-SNAPSHOT + 1.0.54-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java index 19d73fd036..8af78a4819 100644 --- a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java +++ b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java @@ -105,7 +105,7 @@ public RMResource[] listResources(@NotNull WebSession webSession, * @param resourcePath the resource path * @param propertyName the property name * @param propertyValue the property value - * @return the resource property + * @return true on success * @throws DBException the db exception */ @NotNull diff --git a/server/bundles/io.cloudbeaver.service.security/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.service.security/META-INF/MANIFEST.MF index 0a23dfd256..12d89ce7b0 100644 --- a/server/bundles/io.cloudbeaver.service.security/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.service.security/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: Cloudbeaver Web Service - Security Bundle-Vendor: DBeaver Corp Bundle-SymbolicName: io.cloudbeaver.service.security;singleton:=true -Bundle-Version: 1.0.56.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.57.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.service.security/pom.xml b/server/bundles/io.cloudbeaver.service.security/pom.xml index 52e189cee4..2d1100d522 100644 --- a/server/bundles/io.cloudbeaver.service.security/pom.xml +++ b/server/bundles/io.cloudbeaver.service.security/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.service.security - 1.0.56-SNAPSHOT + 1.0.57-SNAPSHOT eclipse-plugin diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java index 609d1fe54e..ea1a858221 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java @@ -127,8 +127,17 @@ public void initialize() throws DBException { LoggingProgressMonitor monitor = new LoggingProgressMonitor(log); + if (isDefaultH2Configuration(databaseConfiguration)) { + //force use default values even if they are explicitly specified + databaseConfiguration.setUser(null); + databaseConfiguration.setPassword(null); + databaseConfiguration.setSchema(null); + } + String dbUser = databaseConfiguration.getUser(); String dbPassword = databaseConfiguration.getPassword(); + String schemaName = databaseConfiguration.getSchema(); + if (CommonUtils.isEmpty(dbUser) && driver.isEmbedded()) { File pwdFile = application.getDataDirectory(true).resolve(DEFAULT_DB_PWD_FILE).toFile(); if (!driver.isAnonymousAccess()) { @@ -191,7 +200,6 @@ public void initialize() throws DBException { DatabaseMetaData metaData = connection.getMetaData(); log.debug("\tConnected to " + metaData.getDatabaseProductName() + " " + metaData.getDatabaseProductVersion()); - var schemaName = databaseConfiguration.getSchema(); if (dialect instanceof SQLDialectSchemaController && CommonUtils.isNotEmpty(schemaName)) { var dialectSchemaController = (SQLDialectSchemaController) dialect; var schemaExistQuery = dialectSchemaController.getSchemaExistQuery(schemaName); @@ -578,4 +586,11 @@ public SQLDialect getDialect() { return dialect; } + public static boolean isDefaultH2Configuration(WebDatabaseConfig databaseConfiguration) { + var v1DefaultUrl = "jdbc:h2:/opt/cloudbeaver/workspace/.data/" + V1_DB_NAME; + var v2DefaultUrl = "jdbc:h2:/opt/cloudbeaver/workspace/.data/" + V2_DB_NAME; + return v1DefaultUrl.equals(databaseConfiguration.getUrl()) + || v2DefaultUrl.equals(databaseConfiguration.getUrl()); + } + } diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/WebDatabaseConfig.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/WebDatabaseConfig.java index da58362d03..fb7243462a 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/WebDatabaseConfig.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/WebDatabaseConfig.java @@ -84,4 +84,16 @@ public boolean isBackupEnabled() { public String getSchema() { return schema; } + + void setPassword(String password) { + this.password = password; + } + + void setSchema(String schema) { + this.schema = schema; + } + + void setUser(String user) { + this.user = user; + } } diff --git a/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF b/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF index 19b4a4079f..91f609fa86 100644 --- a/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF +++ b/server/bundles/io.cloudbeaver.slf4j/META-INF/MANIFEST.MF @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: DBeaver Corp Bundle-Name: CloudBeaver SLF4j Binding Bundle-SymbolicName: io.cloudbeaver.slf4j;singleton:=true -Bundle-Version: 1.0.16.qualifier -Bundle-Release-Date: 20240708 +Bundle-Version: 1.0.17.qualifier +Bundle-Release-Date: 20240722 Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-ClassPath: . diff --git a/server/bundles/io.cloudbeaver.slf4j/pom.xml b/server/bundles/io.cloudbeaver.slf4j/pom.xml index 687b44ccc3..bf38ee28f1 100644 --- a/server/bundles/io.cloudbeaver.slf4j/pom.xml +++ b/server/bundles/io.cloudbeaver.slf4j/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.slf4j - 1.0.16-SNAPSHOT + 1.0.17-SNAPSHOT eclipse-plugin diff --git a/server/features/io.cloudbeaver.ce.drivers.feature/feature.xml b/server/features/io.cloudbeaver.ce.drivers.feature/feature.xml index 32d001ad44..f9d60b2369 100644 --- a/server/features/io.cloudbeaver.ce.drivers.feature/feature.xml +++ b/server/features/io.cloudbeaver.ce.drivers.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/server/features/io.cloudbeaver.ce.drivers.feature/pom.xml b/server/features/io.cloudbeaver.ce.drivers.feature/pom.xml index aecadc8e02..0b977ac226 100644 --- a/server/features/io.cloudbeaver.ce.drivers.feature/pom.xml +++ b/server/features/io.cloudbeaver.ce.drivers.feature/pom.xml @@ -9,6 +9,6 @@ ../ io.cloudbeaver.ce.drivers.feature - 1.0.124-SNAPSHOT + 1.0.125-SNAPSHOT eclipse-feature diff --git a/server/features/io.cloudbeaver.product.ce.feature/feature.xml b/server/features/io.cloudbeaver.product.ce.feature/feature.xml index 1c472a32c9..fd61b8e074 100644 --- a/server/features/io.cloudbeaver.product.ce.feature/feature.xml +++ b/server/features/io.cloudbeaver.product.ce.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/server/features/io.cloudbeaver.product.ce.feature/pom.xml b/server/features/io.cloudbeaver.product.ce.feature/pom.xml index deffd2b796..810c4d82e0 100644 --- a/server/features/io.cloudbeaver.product.ce.feature/pom.xml +++ b/server/features/io.cloudbeaver.product.ce.feature/pom.xml @@ -10,7 +10,7 @@ ../ io.cloudbeaver.product.ce.feature - 24.1.2-SNAPSHOT + 24.1.3-SNAPSHOT eclipse-feature diff --git a/server/features/io.cloudbeaver.server.feature/feature.xml b/server/features/io.cloudbeaver.server.feature/feature.xml index fa3bcc1a22..6fb5de427c 100644 --- a/server/features/io.cloudbeaver.server.feature/feature.xml +++ b/server/features/io.cloudbeaver.server.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/server/features/io.cloudbeaver.server.feature/pom.xml b/server/features/io.cloudbeaver.server.feature/pom.xml index 959d373cdb..0615903860 100644 --- a/server/features/io.cloudbeaver.server.feature/pom.xml +++ b/server/features/io.cloudbeaver.server.feature/pom.xml @@ -10,6 +10,6 @@ ../ io.cloudbeaver.server.feature - 24.1.2-SNAPSHOT + 24.1.3-SNAPSHOT eclipse-feature diff --git a/server/features/io.cloudbeaver.ws.feature/feature.xml b/server/features/io.cloudbeaver.ws.feature/feature.xml index ebfe364438..e12ce029c5 100644 --- a/server/features/io.cloudbeaver.ws.feature/feature.xml +++ b/server/features/io.cloudbeaver.ws.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/server/features/io.cloudbeaver.ws.feature/pom.xml b/server/features/io.cloudbeaver.ws.feature/pom.xml index 36c9e7cf1c..12f92ba6c4 100644 --- a/server/features/io.cloudbeaver.ws.feature/pom.xml +++ b/server/features/io.cloudbeaver.ws.feature/pom.xml @@ -10,6 +10,6 @@ ../ io.cloudbeaver.ws.feature - 1.0.54-SNAPSHOT + 1.0.55-SNAPSHOT eclipse-feature diff --git a/server/pom.xml b/server/pom.xml index d7a9c150f4..a5b5f622ab 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -19,7 +19,7 @@ CloudBeaver CE - 24.1.2 + 24.1.3 diff --git a/server/product/web-server/CloudbeaverServer.product b/server/product/web-server/CloudbeaverServer.product index f6c5c4606d..105f2764ce 100644 --- a/server/product/web-server/CloudbeaverServer.product +++ b/server/product/web-server/CloudbeaverServer.product @@ -2,7 +2,7 @@ diff --git a/server/product/web-server/pom.xml b/server/product/web-server/pom.xml index ff021e1428..77dc099f7b 100644 --- a/server/product/web-server/pom.xml +++ b/server/product/web-server/pom.xml @@ -9,7 +9,7 @@ 1.0.0-SNAPSHOT ../../ - 24.1.2-SNAPSHOT + 24.1.3-SNAPSHOT web-server eclipse-repository Cloudbeaver Server Product diff --git a/server/test/io.cloudbeaver.test.platform/src/io/cloudbeaver/model/rm/RMNIOTest.java b/server/test/io.cloudbeaver.test.platform/src/io/cloudbeaver/model/rm/RMNIOTest.java index ab4f65bcc8..495b4e5362 100644 --- a/server/test/io.cloudbeaver.test.platform/src/io/cloudbeaver/model/rm/RMNIOTest.java +++ b/server/test/io.cloudbeaver.test.platform/src/io/cloudbeaver/model/rm/RMNIOTest.java @@ -43,6 +43,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; public class RMNIOTest { @@ -135,12 +136,14 @@ public void testListFiles() throws DBException, IOException { String file2 = "script" + SecurityUtils.generateUniqueId() + ".sql"; rm.createResource(testProject.getId(), file1, true); rm.createResource(testProject.getId(), file2, false); - Set filesFromNio = - Files.list(rootPath) - .map(path -> ((RMPath) path).getResourcePath()) - .collect(Collectors.toSet()); - Assert.assertTrue(filesFromNio.contains(file1)); - Assert.assertTrue(filesFromNio.contains(file2)); + try (Stream list = Files.list(rootPath)) { + Set filesFromNio = + list + .map(path -> ((RMPath) path).getResourcePath()) + .collect(Collectors.toSet()); + Assert.assertTrue(filesFromNio.contains(file1)); + Assert.assertTrue(filesFromNio.contains(file2)); + } } @Test diff --git a/webapp/packages/core-administration/package.json b/webapp/packages/core-administration/package.json index 5ca1c2db93..4ca22be149 100644 --- a/webapp/packages/core-administration/package.json +++ b/webapp/packages/core-administration/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-administration/src/PermissionsResource.ts b/webapp/packages/core-administration/src/PermissionsResource.ts index 44008e5f07..f49f8020e9 100644 --- a/webapp/packages/core-administration/src/PermissionsResource.ts +++ b/webapp/packages/core-administration/src/PermissionsResource.ts @@ -15,7 +15,10 @@ export type AdminObjectGrantInfo = AdminObjectGrantInfoFragment; @injectable() export class PermissionsResource extends CachedMapResource { - constructor(private readonly graphQLService: GraphQLService, sessionDataResource: SessionDataResource) { + constructor( + private readonly graphQLService: GraphQLService, + sessionDataResource: SessionDataResource, + ) { super(); this.sync( diff --git a/webapp/packages/core-app/package.json b/webapp/packages/core-app/package.json index cd848ee4f3..c2eda7cecb 100644 --- a/webapp/packages/core-app/package.json +++ b/webapp/packages/core-app/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-authentication/package.json b/webapp/packages/core-authentication/package.json index d4e7f845c1..be5ff9055d 100644 --- a/webapp/packages/core-authentication/package.json +++ b/webapp/packages/core-authentication/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-authentication/src/AppAuthService.ts b/webapp/packages/core-authentication/src/AppAuthService.ts index bf2066c28a..e76d207d2b 100644 --- a/webapp/packages/core-authentication/src/AppAuthService.ts +++ b/webapp/packages/core-authentication/src/AppAuthService.ts @@ -30,7 +30,10 @@ export class AppAuthService extends Bootstrap { readonly auth: IExecutor; - constructor(private readonly serverConfigResource: ServerConfigResource, private readonly userInfoResource: UserInfoResource) { + constructor( + private readonly serverConfigResource: ServerConfigResource, + private readonly userInfoResource: UserInfoResource, + ) { super(); this.auth = new Executor(); this.userInfoResource.onDataUpdate.addHandler(this.authUser.bind(this)); diff --git a/webapp/packages/core-authentication/src/AuthInfoService.ts b/webapp/packages/core-authentication/src/AuthInfoService.ts index 3dd0d707ed..e4d0d70af7 100644 --- a/webapp/packages/core-authentication/src/AuthInfoService.ts +++ b/webapp/packages/core-authentication/src/AuthInfoService.ts @@ -25,6 +25,10 @@ export class AuthInfoService { return this.userInfoResource.data; } + get isAnonymous(): boolean { + return !this.userInfoResource.data; + } + constructor( private readonly userInfoResource: UserInfoResource, private readonly authProvidersResource: AuthProvidersResource, diff --git a/webapp/packages/core-authentication/src/AuthRolesResource.ts b/webapp/packages/core-authentication/src/AuthRolesResource.ts index 0cf05b8ef7..5b9673ea6d 100644 --- a/webapp/packages/core-authentication/src/AuthRolesResource.ts +++ b/webapp/packages/core-authentication/src/AuthRolesResource.ts @@ -12,7 +12,10 @@ import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class AuthRolesResource extends CachedDataResource { - constructor(private readonly graphQLService: GraphQLService, sessionPermissionsResource: SessionPermissionsResource) { + constructor( + private readonly graphQLService: GraphQLService, + sessionPermissionsResource: SessionPermissionsResource, + ) { super(() => []); sessionPermissionsResource.require(this, EAdminPermission.admin).outdateResource(this); diff --git a/webapp/packages/core-authentication/src/PasswordPolicyService.ts b/webapp/packages/core-authentication/src/PasswordPolicyService.ts index 4c19107734..480e11bcec 100644 --- a/webapp/packages/core-authentication/src/PasswordPolicyService.ts +++ b/webapp/packages/core-authentication/src/PasswordPolicyService.ts @@ -32,7 +32,10 @@ export class PasswordPolicyService { }; } - constructor(private readonly serverConfigResource: ServerConfigResource, private readonly localizationService: LocalizationService) { + constructor( + private readonly serverConfigResource: ServerConfigResource, + private readonly localizationService: LocalizationService, + ) { makeObservable(this, { config: computed, }); diff --git a/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts b/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts index 6dc92d8978..dd8d85ec31 100644 --- a/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/TeamMetaParametersResource.ts @@ -14,7 +14,10 @@ export type TeamMetaParameter = ObjectPropertyInfo; @injectable() export class TeamMetaParametersResource extends CachedDataResource { - constructor(private readonly graphQLService: GraphQLService, sessionResource: SessionResource) { + constructor( + private readonly graphQLService: GraphQLService, + sessionResource: SessionResource, + ) { super(() => []); this.sync( diff --git a/webapp/packages/core-authentication/src/UserMetaParametersResource.ts b/webapp/packages/core-authentication/src/UserMetaParametersResource.ts index e3514ecb60..ab1f5b50c3 100644 --- a/webapp/packages/core-authentication/src/UserMetaParametersResource.ts +++ b/webapp/packages/core-authentication/src/UserMetaParametersResource.ts @@ -23,7 +23,11 @@ export interface IUserMetaParameterOptions { @injectable() export class UserMetaParametersResource extends CachedDataResource { - constructor(private readonly graphQLService: GraphQLService, sessionResource: SessionResource, userInfoResource: UserInfoResource) { + constructor( + private readonly graphQLService: GraphQLService, + sessionResource: SessionResource, + userInfoResource: UserInfoResource, + ) { super(() => []); this.sync( diff --git a/webapp/packages/core-authentication/src/UsersResource.ts b/webapp/packages/core-authentication/src/UsersResource.ts index 221bec3190..8155178da0 100644 --- a/webapp/packages/core-authentication/src/UsersResource.ts +++ b/webapp/packages/core-authentication/src/UsersResource.ts @@ -66,7 +66,8 @@ export class UsersResource extends CachedMapResource this.markOutdated()); this.aliases.add(UsersResourceFilterKey, key => resourceKeyList( this.entries diff --git a/webapp/packages/core-blocks/package.json b/webapp/packages/core-blocks/package.json index d4e20c0be9..8f556957cd 100644 --- a/webapp/packages/core-blocks/package.json +++ b/webapp/packages/core-blocks/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-blocks/public/icons/refresh_m.svg b/webapp/packages/core-blocks/public/icons/refresh_m.svg index 2e92fd0d20..526825db88 100644 --- a/webapp/packages/core-blocks/public/icons/refresh_m.svg +++ b/webapp/packages/core-blocks/public/icons/refresh_m.svg @@ -1,8 +1,8 @@ - - + + diff --git a/webapp/packages/core-blocks/public/icons/timer_m.svg b/webapp/packages/core-blocks/public/icons/timer_m.svg index 32d1a40037..10649167d7 100644 --- a/webapp/packages/core-blocks/public/icons/timer_m.svg +++ b/webapp/packages/core-blocks/public/icons/timer_m.svg @@ -1,6 +1,8 @@ - - - - - + + + + + \ No newline at end of file diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistry.tsx b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistry.tsx new file mode 100644 index 0000000000..d0db5ab6de --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistry.tsx @@ -0,0 +1,29 @@ +/* + * 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 React, { memo, useContext } from 'react'; + +import { ComponentsRegistryContext } from './ComponentsRegistryContext'; +import { CRegistryList } from './CRegistryList'; + +export interface CRegistryProps extends React.PropsWithChildren { + registry: CRegistryList; +} + +/** + * experimental, can be changed + */ +export const CRegistry = memo(function CRegistry({ registry, children }) { + const parent = useContext(ComponentsRegistryContext); + const context = new Map(parent); + + for (const [component, validators] of registry) { + context.set(component, [...(context.get(component) || []), validators]); + } + + return {children}; +}); diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryList.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryList.ts new file mode 100644 index 0000000000..02772b643e --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryList.ts @@ -0,0 +1,13 @@ +/* + * 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 React from 'react'; + +import { IComponentsTreeNodeValidator } from './IComponentsTreeNodeValidator'; + +export type RegistryEntry> = [T, IComponentsTreeNodeValidator[]]; +export type CRegistryList = RegistryEntry>[]; diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.module.css b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryLoader.ts similarity index 57% rename from webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.module.css rename to webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryLoader.ts index 294039e523..d098f1e37c 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/TableFooterMenu/TableFooterMenu.module.css +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/CRegistryLoader.ts @@ -5,7 +5,6 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -.wrapper { - display: flex; - height: 100%; -} +import { importLazyComponent } from '../importLazyComponent'; + +export const CRegistry = importLazyComponent(() => import('./CRegistry').then(m => m.CRegistry)); diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsRegistryContext.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsRegistryContext.ts new file mode 100644 index 0000000000..0b765ebb31 --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsRegistryContext.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. + */ +import { createContext } from 'react'; + +import { IComponentsTreeNodeValidator } from './IComponentsTreeNodeValidator'; + +export const ComponentsRegistryContext = createContext, IComponentsTreeNodeValidator[][]>>(new Map()); diff --git a/webapp/packages/plugin-data-export/src/DATA_EXPORT_SETTINGS_GROUP.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsTreeContext.ts similarity index 53% rename from webapp/packages/plugin-data-export/src/DATA_EXPORT_SETTINGS_GROUP.ts rename to webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsTreeContext.ts index 991978c9df..d75271c41f 100644 --- a/webapp/packages/plugin-data-export/src/DATA_EXPORT_SETTINGS_GROUP.ts +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/ComponentsTreeContext.ts @@ -5,6 +5,8 @@ * 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 { createContext } from 'react'; -export const DATA_EXPORT_SETTINGS_GROUP = ROOT_SETTINGS_GROUP.createSubGroup('plugin_data_export_data_export_settings_group'); +import { IComponentsTreeNode } from './IComponentsTreeNode'; + +export const ComponentsTreeContext = createContext>>([]); diff --git a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/IAutoRefreshSettings.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNode.ts similarity index 65% rename from webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/IAutoRefreshSettings.ts rename to webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNode.ts index 2931e312bc..e33c6d98ea 100644 --- a/webapp/packages/plugin-data-viewer/src/TableViewer/TableFooter/AutoRefresh/IAutoRefreshSettings.ts +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNode.ts @@ -6,7 +6,8 @@ * you may not use this file except in compliance with the License. */ -export interface IAutoRefreshSettings { - interval: number | null; - stopOnError: boolean; +export interface IComponentsTreeNode { + component: React.FC; + props: T; + replacement: React.FC | null; } diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNodeValidator.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNodeValidator.ts new file mode 100644 index 0000000000..70049ff1ce --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/IComponentsTreeNodeValidator.ts @@ -0,0 +1,13 @@ +/* + * 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 interface IComponentsTreeNodeValidator> { + component: T; + replacement?: T; + validator: (props: T extends React.FC ? P : unknown) => boolean; +} diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/registry.tsx b/webapp/packages/core-blocks/src/ComponentsRegistry/registry.tsx new file mode 100644 index 0000000000..2ae5090dad --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/registry.tsx @@ -0,0 +1,85 @@ +/* + * 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 { observer } from 'mobx-react-lite'; +import React, { forwardRef, useContext } from 'react'; + +import { ComponentsRegistryContext } from './ComponentsRegistryContext'; +import { ComponentsTreeContext } from './ComponentsTreeContext'; +import { IComponentsTreeNode } from './IComponentsTreeNode'; +import { IComponentsTreeNodeValidator } from './IComponentsTreeNodeValidator'; + +/** + * experimental, can be changed + */ +export function registry>(component: T): T { + const componentRef = observer( + forwardRef(function Registry(props, ref) { + const node: IComponentsTreeNode = { + component: componentRef, + props, + replacement: null, + }; + const context = [...useContext(ComponentsTreeContext), node]; + const registry = useContext(ComponentsRegistryContext); + let Component = component as any; + + const registryNodes = registry.get(componentRef); + for (const validators of registryNodes || []) { + if (validators) { + const result = getComponent(context, validators); + + if (result) { + Component = result; + break; + } + } + } + + if (Component !== component) { + node.replacement = Component; + } + + return ( + + + + ); + }), + ); + + return componentRef as unknown as T; +} + +function getComponent(context: IComponentsTreeNode[], validators: IComponentsTreeNodeValidator[]) { + let position = 0; + let node = context[position]; + let lastValidator: IComponentsTreeNodeValidator | null = null; + + for (const validator of validators) { + lastValidator = validator; + while (position < context.length) { + node = context[position++]; + if (node.component === lastValidator.component) { + if (!lastValidator.validator(node.props) || (node.replacement !== null && node.replacement === lastValidator.replacement)) { + return null; + } + break; + } + } + + if (position >= context.length) { + break; + } + } + + if (node.component === lastValidator?.component && lastValidator.replacement) { + return lastValidator.replacement; + } + + return null; +} diff --git a/webapp/packages/core-blocks/src/ComponentsRegistry/useParentProps.ts b/webapp/packages/core-blocks/src/ComponentsRegistry/useParentProps.ts new file mode 100644 index 0000000000..47e16da957 --- /dev/null +++ b/webapp/packages/core-blocks/src/ComponentsRegistry/useParentProps.ts @@ -0,0 +1,25 @@ +/* + * 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 { useContext } from 'react'; + +import { ComponentsTreeContext } from './ComponentsTreeContext'; + +/** + * experimental, can be changed + */ +export function useParentProps(component: React.FC): T | undefined { + const tree = useContext(ComponentsTreeContext); + + for (let i = tree.length - 1; i >= 0; i--) { + if (tree[i].component === component) { + return tree[i].props as T; + } + } + + return undefined; +} diff --git a/webapp/packages/core-blocks/src/TimerIcon.module.css b/webapp/packages/core-blocks/src/TimerIcon.module.css index 3a364533a0..e5299f9b3e 100644 --- a/webapp/packages/core-blocks/src/TimerIcon.module.css +++ b/webapp/packages/core-blocks/src/TimerIcon.module.css @@ -10,6 +10,7 @@ width: 16px; height: 16px; overflow: hidden; + user-select: none; & > .icon { width: 16px; @@ -45,7 +46,6 @@ opacity: 0; } } - } .interval { font-size: 8px; diff --git a/webapp/packages/core-blocks/src/TimerIcon.tsx b/webapp/packages/core-blocks/src/TimerIcon.tsx index 0de5860e34..3f0cbc8281 100644 --- a/webapp/packages/core-blocks/src/TimerIcon.tsx +++ b/webapp/packages/core-blocks/src/TimerIcon.tsx @@ -15,7 +15,7 @@ import { useS } from './useS'; interface Props { state: 'play' | 'stop'; - interval: number; + interval: React.ReactNode; } export const TimerIcon = observer>(function TimerIcon({ state, interval, ...rest }) { diff --git a/webapp/packages/core-blocks/src/index.ts b/webapp/packages/core-blocks/src/index.ts index d0f3993f09..ed29b86fba 100644 --- a/webapp/packages/core-blocks/src/index.ts +++ b/webapp/packages/core-blocks/src/index.ts @@ -16,6 +16,14 @@ export * from './CommonDialog/DialogsPortal'; export * from './ErrorDetailsDialog/ErrorDetailsDialog'; +export * from './ComponentsRegistry/CRegistryLoader'; +// we don't expect to use this component directly only as a wrapper for another component +// eslint-disable-next-line @cloudbeaver/no-sync-component-import +export * from './ComponentsRegistry/registry'; +export * from './ComponentsRegistry/CRegistryList'; +export * from './ComponentsRegistry/IComponentsTreeNodeValidator'; +export * from './ComponentsRegistry/useParentProps'; + export * from './AppRefreshButton'; export * from './ComplexLoader'; export * from './DisplayError'; diff --git a/webapp/packages/core-blocks/src/useExecutor.ts b/webapp/packages/core-blocks/src/useExecutor.ts index 14ed4ac712..25f70b4281 100644 --- a/webapp/packages/core-blocks/src/useExecutor.ts +++ b/webapp/packages/core-blocks/src/useExecutor.ts @@ -74,7 +74,5 @@ export function useExecutor(options: IUseExecutorOptions): void { executor.removeBefore(before); } }; - }, [ - executor, props.handlers?.length, props.postHandlers?.length, before, next, - ]); + }, [executor, props.handlers?.length, props.postHandlers?.length, before, next]); } diff --git a/webapp/packages/core-bootstrap/package.json b/webapp/packages/core-bootstrap/package.json index 3b4f91cd2b..71a40c9d73 100644 --- a/webapp/packages/core-bootstrap/package.json +++ b/webapp/packages/core-bootstrap/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-browser-cookies/package.json b/webapp/packages/core-browser-cookies/package.json index e31b678bfa..6caf2402ec 100644 --- a/webapp/packages/core-browser-cookies/package.json +++ b/webapp/packages/core-browser-cookies/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-browser-settings/package.json b/webapp/packages/core-browser-settings/package.json index d1a119396a..4e3e348468 100644 --- a/webapp/packages/core-browser-settings/package.json +++ b/webapp/packages/core-browser-settings/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-browser/package.json b/webapp/packages/core-browser/package.json index 0e7c23c82b..d61b8816b8 100644 --- a/webapp/packages/core-browser/package.json +++ b/webapp/packages/core-browser/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-client-activity/package.json b/webapp/packages/core-client-activity/package.json index 71d813cc62..22722cebb9 100644 --- a/webapp/packages/core-client-activity/package.json +++ b/webapp/packages/core-client-activity/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-connections/package.json b/webapp/packages/core-connections/package.json index 6879f22040..73087cf8f8 100644 --- a/webapp/packages/core-connections/package.json +++ b/webapp/packages/core-connections/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-connections/src/ConnectionInfoResource.ts b/webapp/packages/core-connections/src/ConnectionInfoResource.ts index 49c37698d0..d37c3c6e62 100644 --- a/webapp/packages/core-connections/src/ConnectionInfoResource.ts +++ b/webapp/packages/core-connections/src/ConnectionInfoResource.ts @@ -450,9 +450,7 @@ export class ConnectionInfoResource extends CachedMapResource; @@ -568,6 +566,10 @@ export class ConnectionInfoResource extends CachedMapResource connectionInfo.load(data.key)); this.onDelete.before(this.onDisconnect); + this.connectionInfo.onConnectionClose.next(this.onDisconnect, key => ({ + connections: [key], + state: 'after' as const, + })); makeObservable(this, { projectConnections: computed({ @@ -177,10 +181,6 @@ export class ConnectionsManagerService { try { for (const connection of this.projectConnections) { await this._closeConnectionAsync(connection); - this.onDisconnect.execute({ - connections: [createConnectionParam(connection)], - state: 'after', - }); } notification.close(); @@ -211,10 +211,6 @@ export class ConnectionsManagerService { await this._closeConnectionAsync(connection); notification.close(); - this.onDisconnect.execute({ - connections: [createConnectionParam(connection)], - state: 'after', - }); } catch (exception: any) { controller.reject(exception); } diff --git a/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts b/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts index d4b79e490d..10513b6134 100644 --- a/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts +++ b/webapp/packages/core-connections/src/DatabaseAuthModelsResource.ts @@ -14,7 +14,10 @@ export type DatabaseAuthModel = DatabaseAuthModelBase; @injectable() export class DatabaseAuthModelsResource extends CachedMapResource { - constructor(private readonly graphQLService: GraphQLService, serverConfigResource: ServerConfigResource) { + constructor( + private readonly graphQLService: GraphQLService, + serverConfigResource: ServerConfigResource, + ) { super(); this.sync( serverConfigResource, diff --git a/webapp/packages/core-data-context/package.json b/webapp/packages/core-data-context/package.json index 12be5a57c9..34b7b039fc 100644 --- a/webapp/packages/core-data-context/package.json +++ b/webapp/packages/core-data-context/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-di/package.json b/webapp/packages/core-di/package.json index 7b4c3d95d9..a1fff5d0d9 100644 --- a/webapp/packages/core-di/package.json +++ b/webapp/packages/core-di/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-dialogs/package.json b/webapp/packages/core-dialogs/package.json index e3c75422fa..3ed69b1a76 100644 --- a/webapp/packages/core-dialogs/package.json +++ b/webapp/packages/core-dialogs/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-events/package.json b/webapp/packages/core-events/package.json index 3ca7c29960..af07f59e31 100644 --- a/webapp/packages/core-events/package.json +++ b/webapp/packages/core-events/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-executor/package.json b/webapp/packages/core-executor/package.json index 1262038048..5d868b8dcb 100644 --- a/webapp/packages/core-executor/package.json +++ b/webapp/packages/core-executor/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-executor/src/ExecutionContext.ts b/webapp/packages/core-executor/src/ExecutionContext.ts index 69e8bda16c..0a2abb209c 100644 --- a/webapp/packages/core-executor/src/ExecutionContext.ts +++ b/webapp/packages/core-executor/src/ExecutionContext.ts @@ -11,7 +11,10 @@ export class ExecutionContext implements IExecutionContext { readonly contexts: Map, any>; readonly contextCreators: Map, IContextLoader>; - constructor(private readonly data: TData, context?: IExecutionContext) { + constructor( + private readonly data: TData, + context?: IExecutionContext, + ) { this.contexts = context?.contexts || new Map(); this.contextCreators = context?.contextCreators ?? new Map(); } diff --git a/webapp/packages/core-executor/src/Executor.ts b/webapp/packages/core-executor/src/Executor.ts index 2da69c3985..12921cb73e 100644 --- a/webapp/packages/core-executor/src/Executor.ts +++ b/webapp/packages/core-executor/src/Executor.ts @@ -22,7 +22,10 @@ export class Executor extends ExecutorHandlersCollection implements private readonly scheduler: TaskScheduler; - constructor(private readonly defaultData: T | null = null, isBlocked: BlockedExecution | null = null) { + constructor( + private readonly defaultData: T | null = null, + isBlocked: BlockedExecution | null = null, + ) { super(); this.scheduler = new TaskScheduler(isBlocked); } diff --git a/webapp/packages/core-extensions/package.json b/webapp/packages/core-extensions/package.json index edc24f1df7..6f413a6bf0 100644 --- a/webapp/packages/core-extensions/package.json +++ b/webapp/packages/core-extensions/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-localization/package.json b/webapp/packages/core-localization/package.json index fdbd3b9d91..8ec5165d15 100644 --- a/webapp/packages/core-localization/package.json +++ b/webapp/packages/core-localization/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-navigation-tree/package.json b/webapp/packages/core-navigation-tree/package.json index 27a062cc1a..a8a344f9bd 100644 --- a/webapp/packages/core-navigation-tree/package.json +++ b/webapp/packages/core-navigation-tree/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-notifications/package.json b/webapp/packages/core-notifications/package.json index 0059c45b5f..06c86ee7a6 100644 --- a/webapp/packages/core-notifications/package.json +++ b/webapp/packages/core-notifications/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-product/package.json b/webapp/packages/core-product/package.json index 9c54d24fcb..d469feb4be 100644 --- a/webapp/packages/core-product/package.json +++ b/webapp/packages/core-product/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-projects/package.json b/webapp/packages/core-projects/package.json index fa1ffe90d1..0489a16783 100644 --- a/webapp/packages/core-projects/package.json +++ b/webapp/packages/core-projects/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-resource-manager/package.json b/webapp/packages/core-resource-manager/package.json index ae2c7c4358..13df0ca432 100644 --- a/webapp/packages/core-resource-manager/package.json +++ b/webapp/packages/core-resource-manager/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts b/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts index f43f32cb59..c50494fecb 100644 --- a/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts +++ b/webapp/packages/core-resource-manager/src/ProjectPermissionsResource.ts @@ -13,7 +13,10 @@ import { GraphQLService } from '@cloudbeaver/core-sdk'; @injectable() export class ProjectPermissionsResource extends CachedDataResource { - constructor(private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource) { + constructor( + private readonly graphQLService: GraphQLService, + permissionsResource: SessionPermissionsResource, + ) { super(() => []); permissionsResource.require(this, EAdminPermission.admin).outdateResource(this); diff --git a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts index c4e9876637..875afc4288 100644 --- a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts +++ b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts @@ -45,7 +45,7 @@ export class SharedProjectsResource extends CachedMapResource new Map(), []); sessionPermissionsResource.require(this, EAdminPermission.admin); - this.sync(sessionPermissionsResource, () => {}); + sessionPermissionsResource.onDataOutdated.addHandler(() => this.markOutdated()); this.connect(projectInfoResource); this.onDataOutdated.addHandler(() => projectInfoResource.markOutdated()); diff --git a/webapp/packages/core-resource/package.json b/webapp/packages/core-resource/package.json index 575ab2f868..7c72183e4f 100644 --- a/webapp/packages/core-resource/package.json +++ b/webapp/packages/core-resource/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-root/package.json b/webapp/packages/core-root/package.json index e135104158..6fc262c2fb 100644 --- a/webapp/packages/core-root/package.json +++ b/webapp/packages/core-root/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-root/src/FeaturesResource.ts b/webapp/packages/core-root/src/FeaturesResource.ts index 68474a8b58..6c3796f14e 100644 --- a/webapp/packages/core-root/src/FeaturesResource.ts +++ b/webapp/packages/core-root/src/FeaturesResource.ts @@ -19,7 +19,10 @@ export type ApplicationFeature = WebFeatureSet; @injectable() export class FeaturesResource extends CachedDataResource { private baseFeatures: string[]; - constructor(private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource) { + constructor( + private readonly graphQLService: GraphQLService, + permissionsResource: SessionPermissionsResource, + ) { super(() => []); this.baseFeatures = []; diff --git a/webapp/packages/core-root/src/ServerNodeService.ts b/webapp/packages/core-root/src/ServerNodeService.ts index 721f171abb..d11415f2c3 100644 --- a/webapp/packages/core-root/src/ServerNodeService.ts +++ b/webapp/packages/core-root/src/ServerNodeService.ts @@ -16,7 +16,10 @@ import { ServerEventId, SessionEventSource } from './SessionEventSource'; export class ServerNodeService extends Dependency { private applicationRunId: string | null; onApplicationRunIdChange: IExecutor; - constructor(private readonly graphQLService: GraphQLService, private readonly sessionEventSource: SessionEventSource) { + constructor( + private readonly graphQLService: GraphQLService, + private readonly sessionEventSource: SessionEventSource, + ) { super(); this.onApplicationRunIdChange = new Executor(); this.applicationRunId = null; diff --git a/webapp/packages/core-root/src/SessionExpireEventService.ts b/webapp/packages/core-root/src/SessionExpireEventService.ts index b2ea73f0d3..c53aa0a0ce 100644 --- a/webapp/packages/core-root/src/SessionExpireEventService.ts +++ b/webapp/packages/core-root/src/SessionExpireEventService.ts @@ -13,7 +13,10 @@ import { SessionExpireService } from './SessionExpireService'; @injectable() export class SessionExpireEventService extends Dependency { - constructor(private readonly sessionEventSource: SessionEventSource, private readonly sessionExpireService: SessionExpireService) { + constructor( + private readonly sessionEventSource: SessionEventSource, + private readonly sessionExpireService: SessionExpireService, + ) { super(); this.sessionEventSource.onEvent(ServerEventId.CbSessionExpired, () => { this.onSessionExpireEvent(); diff --git a/webapp/packages/core-routing/package.json b/webapp/packages/core-routing/package.json index 6415a2db8a..a126706912 100644 --- a/webapp/packages/core-routing/package.json +++ b/webapp/packages/core-routing/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-sdk/package.json b/webapp/packages/core-sdk/package.json index a2e8b435b8..5ede498e7a 100644 --- a/webapp/packages/core-sdk/package.json +++ b/webapp/packages/core-sdk/package.json @@ -15,7 +15,6 @@ "gql:gen": "yarn run clean && graphql-codegen", "gql:gen:dev": "yarn run clean && graphql-codegen --watch", "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" @@ -25,6 +24,7 @@ "@cloudbeaver/core-executor": "^0", "@cloudbeaver/core-utils": "^0", "axios": "^1", + "graphql": "^16", "graphql-request": "^6", "mobx": "^6" }, diff --git a/webapp/packages/core-server-localization/package.json b/webapp/packages/core-server-localization/package.json index 6e78a70825..6774665eef 100644 --- a/webapp/packages/core-server-localization/package.json +++ b/webapp/packages/core-server-localization/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-session-localization/package.json b/webapp/packages/core-session-localization/package.json index ecbcf36598..26dc6af997 100644 --- a/webapp/packages/core-session-localization/package.json +++ b/webapp/packages/core-session-localization/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-settings-localization/package.json b/webapp/packages/core-settings-localization/package.json index de77756c13..624c8db1c8 100644 --- a/webapp/packages/core-settings-localization/package.json +++ b/webapp/packages/core-settings-localization/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-settings-user/package.json b/webapp/packages/core-settings-user/package.json index 7c88482699..b5f0ae8cd1 100644 --- a/webapp/packages/core-settings-user/package.json +++ b/webapp/packages/core-settings-user/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-settings/package.json b/webapp/packages/core-settings/package.json index b62fed8d4f..699e0ed2e3 100644 --- a/webapp/packages/core-settings/package.json +++ b/webapp/packages/core-settings/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-storage/package.json b/webapp/packages/core-storage/package.json index 13c024b496..c231bd96f7 100644 --- a/webapp/packages/core-storage/package.json +++ b/webapp/packages/core-storage/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-task-manager/package.json b/webapp/packages/core-task-manager/package.json index 6eb2213786..e8a4be05af 100644 --- a/webapp/packages/core-task-manager/package.json +++ b/webapp/packages/core-task-manager/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-theming/package.json b/webapp/packages/core-theming/package.json index 3168a9426f..8ca6f99167 100644 --- a/webapp/packages/core-theming/package.json +++ b/webapp/packages/core-theming/package.json @@ -13,7 +13,6 @@ "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" diff --git a/webapp/packages/core-ui/package.json b/webapp/packages/core-ui/package.json index 19453010f2..8980f89719 100644 --- a/webapp/packages/core-ui/package.json +++ b/webapp/packages/core-ui/package.json @@ -13,7 +13,6 @@ "build": "tsc -b", "clean": "rimraf --glob dist", "lint": "eslint ./src/ --ext .ts,.tsx", - "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix", "validate-dependencies": "core-cli-validate-dependencies", "update-ts-references": "yarn run clean && typescript-resolve-references" }, diff --git a/webapp/packages/core-ui/src/ContextMenu/MenuActionElement.tsx b/webapp/packages/core-ui/src/ContextMenu/MenuActionElement.tsx index f09ccb2518..68e6fd4212 100644 --- a/webapp/packages/core-ui/src/ContextMenu/MenuActionElement.tsx +++ b/webapp/packages/core-ui/src/ContextMenu/MenuActionElement.tsx @@ -6,7 +6,6 @@ * you may not use this file except in compliance with the License. */ import { observer } from 'mobx-react-lite'; -import React from 'react'; import { Checkbox, MenuItem, MenuItemCheckbox, MenuItemElement, MenuItemRadio, Radio, useTranslate } from '@cloudbeaver/core-blocks'; import { getBindingLabel, IMenuActionItem } from '@cloudbeaver/core-view'; diff --git a/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.module.css b/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.module.css index ba55f561c7..5d05be7459 100644 --- a/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.module.css +++ b/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.module.css @@ -8,6 +8,7 @@ .menuBar { height: 32px; display: flex; + flex-shrink: 0; & > .menuSeparator { height: 100%; diff --git a/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.tsx b/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.tsx index 26388e5d80..e74ca308df 100644 --- a/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.tsx +++ b/webapp/packages/core-ui/src/ContextMenu/MenuBar/MenuBar.tsx @@ -8,14 +8,26 @@ import { observer } from 'mobx-react-lite'; import { forwardRef, useCallback } from 'react'; -import { getComputed, MenuSeparator, MenuSeparatorStyles, s, SContext, StyleRegistry, useAutoLoad, useS } from '@cloudbeaver/core-blocks'; -import { useDataContextLink } from '@cloudbeaver/core-data-context'; +import { + getComputed, + Loader, + MenuSeparator, + MenuSeparatorStyles, + registry, + s, + SContext, + StyleRegistry, + useAutoLoad, + useS, +} from '@cloudbeaver/core-blocks'; +import { IDataContext, useDataContextLink } from '@cloudbeaver/core-data-context'; import { DATA_CONTEXT_MENU_NESTED, DATA_CONTEXT_SUBMENU_ITEM, IMenuActionItem, IMenuData, IMenuItem, + isMenuCustomItem, MenuActionItem, MenuBaseItem, MenuSeparatorItem, @@ -28,7 +40,7 @@ import type { IMenuBarNestedMenuSettings, IMenuBarProps } from './IMenuBarProps' import style from './MenuBar.module.css'; import { MenuBarItem } from './MenuBarItem'; -const registry: StyleRegistry = [ +const styleRegistry: StyleRegistry = [ [ MenuSeparatorStyles, { @@ -49,11 +61,13 @@ export const MenuBar = observer( } return ( - +
- {items.map(item => ( - - ))} + + {items.map(item => ( + + ))} +
); @@ -78,6 +92,20 @@ const MenuBarElement = observer(function MenuBarElement({ } if (item instanceof MenuSubMenuItem) { + if (item.action) { + return ( + ( + + {children} + + )} + className={className} + /> + ); + } return ; } @@ -85,8 +113,14 @@ const MenuBarElement = observer(function MenuBarElement({ return ; } + if (isMenuCustomItem(item)) { + const CustomMenuItem = item.getComponent(); + + return ; + } + if (item instanceof MenuActionItem) { - return ; + return ; } if (item instanceof MenuBaseItem) { @@ -108,42 +142,46 @@ const MenuBarElement = observer(function MenuBarElement({ return null; }); -interface IMenuBarActionProps { +export interface IMenuBarActionProps { item: IMenuActionItem; + context: IDataContext; + submenu?: React.FC; className?: string; - onClick: () => void; } -const MenuBarAction = observer(function MenuBarAction({ item, className, onClick }) { - const actionInfo = item.action.actionInfo; - const loading = item.action.isLoading(); +export const MenuBarAction = registry( + observer(function MenuBarAction({ item, submenu, className }) { + const actionInfo = item.action.actionInfo; + const loading = item.action.isLoading(); - /** @deprecated must be refactored (#1)*/ - const displayLabel = item.action.isLabelVisible(); + /** @deprecated must be refactored (#1)*/ + const displayLabel = item.action.isLabelVisible(); - function handleClick() { - onClick(); - item.action.activate(); - } + function handleClick() { + item.events?.onSelect?.(); + item.action.activate(); + } - return ( -