From c031e0c8ccfabb54e7219a243c526e0df2827369 Mon Sep 17 00:00:00 2001 From: jdbocarsly Date: Wed, 17 Jul 2024 23:08:36 -0500 Subject: [PATCH 1/9] fix issue that sometimes crashes the graphs route --- pydatalab/pydatalab/routes/v0_1/graphs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pydatalab/pydatalab/routes/v0_1/graphs.py b/pydatalab/pydatalab/routes/v0_1/graphs.py index 319f3a368..82c3d122c 100644 --- a/pydatalab/pydatalab/routes/v0_1/graphs.py +++ b/pydatalab/pydatalab/routes/v0_1/graphs.py @@ -72,7 +72,9 @@ def get_graph_cy_format(item_id: Optional[str] = None, collection_id: Optional[s drawn_elements = set() node_collections = set() for document in all_documents: - for relationship in document.get("relationships", []): + # for some reason, document["relationships"] is sometimes equal to None, so we + # need this `or` statement. + for relationship in document.get("relationships") or []: # only considering child-parent relationships if relationship.get("type") == "collections" and not collection_id: collection_data = flask_mongo.db.collections.find_one( @@ -113,7 +115,7 @@ def get_graph_cy_format(item_id: Optional[str] = None, collection_id: Optional[s ) continue - for relationship in document.get("relationships", []): + for relationship in document.get("relationships") or []: # only considering child-parent relationships: if relationship.get("relation") not in ("parent", "is_part_of"): continue From a7086e1f402ff6be1cdfefe5943f5215a0fb5898 Mon Sep 17 00:00:00 2001 From: jdbocarsly Date: Wed, 17 Jul 2024 23:09:18 -0500 Subject: [PATCH 2/9] fix modelValue prop type in ItemSelect --- webapp/src/components/ItemSelect.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/components/ItemSelect.vue b/webapp/src/components/ItemSelect.vue index bb273eb76..5ebe6303d 100644 --- a/webapp/src/components/ItemSelect.vue +++ b/webapp/src/components/ItemSelect.vue @@ -52,7 +52,7 @@ export default { }, props: { modelValue: { - type: String, + type: [String, Array], // Array only if "multiple" is specified default: "", }, formattedItemNameMaxLength: { From c4899e20125381aad87faf4197e5d0ae252b6b93 Mon Sep 17 00:00:00 2001 From: jdbocarsly Date: Wed, 17 Jul 2024 23:12:31 -0500 Subject: [PATCH 3/9] add ability to select items to exclude from showing edges in the itemGraph --- webapp/src/components/ItemGraph.vue | 100 ++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 28 deletions(-) diff --git a/webapp/src/components/ItemGraph.vue b/webapp/src/components/ItemGraph.vue index c9c2f0e42..d9f49c228 100644 --- a/webapp/src/components/ItemGraph.vue +++ b/webapp/src/components/ItemGraph.vue @@ -1,37 +1,53 @@