Skip to content

Commit

Permalink
CB-5732 Navigator filters fix for optional nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Oct 22, 2024
1 parent 5282175 commit 6552f3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,14 @@ public DBSObjectFilter getFilter() throws DBWebException {
if (!(node instanceof DBNDatabaseNode dbNode)) {
throw new DBWebException("Invalid navigator node type: " + node.getClass().getName());
}
DBSObjectFilter filter = dbNode.getNodeFilter(dbNode.getItemsMeta(), true);
return filter == null || filter.isEmpty() || !filter.isEnabled() ? null : filter;
try {
DBSObjectFilter filter = dbNode.getNodeFilter(
DBNUtils.getValidItemsMeta(session.getProgressMonitor(), dbNode),
true);
return filter == null || filter.isEmpty() || !filter.isEnabled() ? null : filter;
} catch (DBException e) {
throw new DBWebException(e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import io.cloudbeaver.BaseWebProjectImpl;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.WebProjectImpl;
import io.cloudbeaver.WebServiceUtils;
import io.cloudbeaver.model.WebCommandContext;
import io.cloudbeaver.model.WebConnectionInfo;
Expand All @@ -43,6 +42,8 @@
import org.jkiss.dbeaver.model.exec.DBCExecutionContext;
import org.jkiss.dbeaver.model.exec.DBCExecutionContextDefaults;
import org.jkiss.dbeaver.model.navigator.*;
import org.jkiss.dbeaver.model.navigator.meta.DBXTreeItem;
import org.jkiss.dbeaver.model.rm.RMControllerProvider;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.rm.RMProjectPermission;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
Expand Down Expand Up @@ -229,8 +230,11 @@ public boolean setNavigatorNodeFilter(
}
filter.setEnabled(true);
if (node instanceof DBNDatabaseNode dbNode) {
dbNode.setNodeFilter(dbNode.getItemsMeta(), filter, true);
if (hasNodeEditPermission(webSession, node, ((WebProjectImpl) node.getOwnerProject()).getRMProject())) {
DBXTreeItem itemsMeta = DBNUtils.getValidItemsMeta(webSession.getProgressMonitor(), dbNode);
dbNode.setNodeFilter(itemsMeta, filter, true);
if (node.getOwnerProject() instanceof RMControllerProvider rmControllerProvider &&
hasNodeEditPermission(webSession, node, rmControllerProvider.getRMProject())
) {
// Save settings
dbNode.getDataSourceContainer().persistConfiguration();
}
Expand Down

0 comments on commit 6552f3f

Please sign in to comment.