Skip to content

Commit

Permalink
chore: filter network by default filters
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Jun 11, 2024
1 parent b2b682d commit 52cd058
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion components/data-graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ watch(
//** Add edges. */
networkData.forEach((entity) => {
entity.relations.forEach((element) => {
if (!graph.hasEdge(entity.id, element)) {
if (!graph.hasEdge(entity.id, element) && graph.hasNode(element)) {
graph.addEdge(entity.id, element);
} else if (!graph.hasNode(element)) {
console.error(
"graph does not have the node",
element,
"for the wanted relation in it's set.",
);
}
});
});
Expand Down
3 changes: 2 additions & 1 deletion components/data-network-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const { data, isPending, isPlaceholderData } = useGetNetworkData(
computed(() => {
return {
exclude_system_classes: [
"type",
// TO-DO: Currently there is an issue: filtering by case study and system_class type will return no results
// "type",
"object_location",
"reference_system",
"file",
Expand Down
5 changes: 5 additions & 0 deletions composables/use-get-network-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ export function useGetNetworkData(params: MaybeRef<GetNetworkDataParams>) {
async queryFn({ queryKey, signal }) {
const [, params] = queryKey;

const linked_to_ids = defaultFilterParams.type_id?.map((value) => {
return value;
});

const response = await api.GET("/network_visualisation/", {
params: {
query: {
...params,
linked_to_ids,
},
},
signal,
Expand Down

0 comments on commit 52cd058

Please sign in to comment.