komodorio / komoplane

🍨 Crossplane Troubleshooting Tool by Komodor
Apache License 2.0
275 stars 24 forks source link

Incorrect Node Argument Order in addEdge Function #68

Open etesami opened 2 months ago

etesami commented 2 months ago

In the getGraphDataFunction, the addEdge function is called with the node arguments in the wrong order. Typically, an edge is drawn from a claim to its composition and composite resources. This means the source should be the claim, and the target should be the composition or composite resources. However, the function is currently being called with the composition and composite resources as the source and the claim as the target, which is incorrect.

https://github.com/komodorio/komoplane/blob/e04d6ecdbd0d9729d37b2d11a17024bbe566f8d9/pkg/frontend/src/pages/ClaimPage.tsx#L113-L132

Impact: This incorrect ordering has caused confusion in other parts of the code. For example, it has led to settings being configured incorrectly, such as using markerStart instead of markerEnd here:

https://github.com/komodorio/komoplane/blob/e04d6ecdbd0d9729d37b2d11a17024bbe566f8d9/pkg/frontend/src/components/graph/data.ts#L79

Additionally, this error results in calling getLayoutElement with RL arguments, even though the graph is supposed to be displayed with LR (left-to-right) settings:

https://github.com/komodorio/komoplane/blob/e04d6ecdbd0d9729d37b2d11a17024bbe566f8d9/pkg/frontend/src/components/graph/RelationsGraph.tsx#L75-L79

I have a proposed solution for this issue. Please let me know if this understanding is correct and desirable.

undera commented 2 months ago

It's a bit hard to understand without illustration. Can you post here a screenshot of diagram that you believe is incorrect?