mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-12 23:37:00 +08:00
CB-2186 datasource updated events fixes
This commit is contained in:
-2
@@ -418,7 +418,6 @@ public class LocalResourceController implements RMController {
|
||||
} catch (IOException e) {
|
||||
throw new DBException("Error moving resource '" + oldResourcePath + "'", e);
|
||||
}
|
||||
WebAppUtils.addRmResourceUpdatedEvent(CBEventConstants.CLOUDBEAVER_RM_RESOURCE_UPDATED, projectId, oldResourcePath);
|
||||
return DEFAULT_CHANGE_ID;
|
||||
}
|
||||
|
||||
@@ -449,7 +448,6 @@ public class LocalResourceController implements RMController {
|
||||
rmResourcePath
|
||||
)
|
||||
);
|
||||
WebAppUtils.addRmResourceUpdatedEvent(CBEventConstants.CLOUDBEAVER_RM_RESOURCE_UPDATED, projectId, resourcePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -387,7 +387,9 @@ type LogEntry {
|
||||
}
|
||||
|
||||
enum CBEventType {
|
||||
cb_config_changed
|
||||
cb_config_changed,
|
||||
cb_datasource_updated,
|
||||
cb_resource_updated
|
||||
}
|
||||
|
||||
type CBEvent {
|
||||
|
||||
+5
@@ -19,6 +19,7 @@ package io.cloudbeaver.service.navigator.impl;
|
||||
|
||||
import io.cloudbeaver.DBWebException;
|
||||
import io.cloudbeaver.WebServiceUtils;
|
||||
import io.cloudbeaver.events.CBEventConstants;
|
||||
import io.cloudbeaver.model.WebCommandContext;
|
||||
import io.cloudbeaver.model.WebConnectionInfo;
|
||||
import io.cloudbeaver.model.rm.DBNAbstractResourceManagerNode;
|
||||
@@ -30,6 +31,7 @@ import io.cloudbeaver.service.navigator.WebCatalog;
|
||||
import io.cloudbeaver.service.navigator.WebNavigatorNodeInfo;
|
||||
import io.cloudbeaver.service.navigator.WebStructContainers;
|
||||
import io.cloudbeaver.service.security.SMUtils;
|
||||
import io.cloudbeaver.utils.WebAppUtils;
|
||||
import io.cloudbeaver.utils.WebConnectionFolderUtils;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
@@ -469,6 +471,7 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
((DBNDataSource) node).moveToFolder(folderNode.getOwnerProject(), folder);
|
||||
node.getOwnerProject().getDataSourceRegistry().updateDataSource(
|
||||
((DBNDataSource) node).getDataSourceContainer());
|
||||
WebAppUtils.addDatasourceUpdatedEvent(node.getOwnerProject().getId());
|
||||
} else if (node instanceof DBNLocalFolder) {
|
||||
DBPDataSourceFolder folder = WebConnectionFolderUtils.getParentFolder(folderNode);
|
||||
if (folder != null) {
|
||||
@@ -481,6 +484,7 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
}
|
||||
((DBNLocalFolder) node).getFolder().setParent(folder);
|
||||
WebServiceUtils.updateConfigAndRefreshDatabases(session, node.getOwnerProject().getId());
|
||||
WebAppUtils.addDatasourceUpdatedEvent(node.getOwnerProject().getId());
|
||||
} else if (node instanceof DBNResourceManagerResource) {
|
||||
boolean rmNewNode = folderNode instanceof DBNAbstractResourceManagerNode;
|
||||
DBNResourceManagerResource rmOldNode = (DBNResourceManagerResource) node;
|
||||
@@ -496,6 +500,7 @@ public class WebServiceNavigator implements DBWServiceNavigator {
|
||||
}
|
||||
String resourcePath = rmOldNode.getResourceFolder();
|
||||
session.getRmController().moveResource(projectId, resourcePath, newPath);
|
||||
WebAppUtils.addRmResourceUpdatedEvent(CBEventConstants.CLOUDBEAVER_RM_RESOURCE_UPDATED, projectId, resourcePath);
|
||||
} else {
|
||||
throw new DBWebException("Navigator node '" + path + "' is not a data source node");
|
||||
}
|
||||
|
||||
+6
-1
@@ -17,12 +17,14 @@
|
||||
package io.cloudbeaver.service.rm.impl;
|
||||
|
||||
import io.cloudbeaver.DBWebException;
|
||||
import io.cloudbeaver.events.CBEventConstants;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import io.cloudbeaver.service.admin.AdminPermissionInfo;
|
||||
import io.cloudbeaver.service.rm.DBWServiceRM;
|
||||
import io.cloudbeaver.service.rm.model.RMProjectPermissions;
|
||||
import io.cloudbeaver.service.rm.model.RMSubjectProjectPermissions;
|
||||
import io.cloudbeaver.service.security.SMUtils;
|
||||
import io.cloudbeaver.utils.WebAppUtils;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.code.Nullable;
|
||||
import org.jkiss.dbeaver.DBException;
|
||||
@@ -137,7 +139,9 @@ public class WebServiceRM implements DBWServiceRM {
|
||||
) throws DBException {
|
||||
checkIsRmEnabled(webSession);
|
||||
try {
|
||||
return getResourceController(webSession).createResource(projectId, resourcePath, isFolder);
|
||||
String result = getResourceController(webSession).createResource(projectId, resourcePath, isFolder);
|
||||
WebAppUtils.addRmResourceUpdatedEvent(CBEventConstants.CLOUDBEAVER_RM_RESOURCE_UPDATED, projectId, resourcePath);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
throw new DBWebException("Error creating resource " + resourcePath, e);
|
||||
}
|
||||
@@ -151,6 +155,7 @@ public class WebServiceRM implements DBWServiceRM {
|
||||
checkIsRmEnabled(webSession);
|
||||
try {
|
||||
getResourceController(webSession).deleteResource(projectId, resourcePath, false);
|
||||
WebAppUtils.addRmResourceUpdatedEvent(CBEventConstants.CLOUDBEAVER_RM_RESOURCE_UPDATED, projectId, resourcePath);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
throw new DBWebException("Error deleting resource " + resourcePath, e);
|
||||
|
||||
Reference in New Issue
Block a user