Commit d94eab11 authored by Tim Bleimehl's avatar Tim Bleimehl 🤸🏼
Browse files

fix new filter system

parent dc56e19a
Pipeline #1664 passed with stage
in 52 seconds
......@@ -31,7 +31,7 @@ class GraphSchema(py2neo.Subgraph):
parent_capture_point: CapturePoint,
extra_props: Dict = None,
) -> "GraphSchema":
# ToDo: Break this function down. Too complex/spaghetti!
# ToDo: Refactor or break this function down. Too complex/spaghetti!
# the nodes are bound atm. meaning they belong to a certain DB. we need to unbound them.
# we clean the nodes and relationship from Neo4j's `call db.schema.visualization` from IDs (the IDs are random anyway on every call and consequently worthless outside of the own transaction)
......@@ -52,6 +52,8 @@ class GraphSchema(py2neo.Subgraph):
continue
rel_nodes = [None, None]
for node in neo4j_schema_vis_data["nodes"]:
if not parent_capture_point.parent_logger.node_filter_func(node):
continue
if rel_nodes[0] and rel_nodes[1]:
break
if node.identity in [rel.start_node.identity, rel.end_node.identity]:
......@@ -62,9 +64,6 @@ class GraphSchema(py2neo.Subgraph):
parent_capture_point=parent_capture_point,
extra_props=extra_props,
)
if clean_rel_node is None:
# the node was filterd out
continue
if rel.start_node.identity == rel.end_node.identity:
rel_nodes[0] = rel_nodes[1] = clean_rel_node
elif node.identity == rel.start_node.identity:
......@@ -92,13 +91,13 @@ class GraphSchema(py2neo.Subgraph):
# lets make up that leeway
single_nodes_cleaned = []
for node in nodes_without_relation:
if not parent_capture_point.parent_logger.node_filter_func(node):
continue
clean_node = cls._get_or_create_unbound_schema_node(
node=node,
parent_capture_point=parent_capture_point,
extra_props=extra_props,
)
if clean_node is None:
continue
single_nodes_cleaned.append(
cls._get_or_create_unbound_schema_node(
node=node,
......@@ -144,12 +143,10 @@ class GraphSchema(py2neo.Subgraph):
)
clean_node.__primarykey__ = "__label_name"
clean_node.__primarylabel__ = list(node.labels)[0]
if parent_capture_point.parent_logger.node_filter_func(clean_node):
parent_capture_point.parent_logger.all_schema_nodes[
tuple(node.labels)
] = clean_node
else:
return None
parent_capture_point.parent_logger.all_schema_nodes[
tuple(node.labels)
] = clean_node
else:
clean_node = parent_capture_point.parent_logger.all_schema_nodes[
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment