Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5732 Navigator filters fix for optional nodes #3024

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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