hivemq / hivemq-edge

HiveMQ Edge is an MQTT gateway that enables interoperability between OT devices and IT systems. It translates diverse protocols into MQTT for streamlined communication and helps organize data into a unified namespace, making managing and streaming data across your infrastructure easier.
http://hivemq.com
Apache License 2.0
90 stars 20 forks source link

refactor(20321): Refactoring the policy loading #385

Closed vanch3d closed 2 months ago

vanch3d commented 2 months ago

See https://hivemq.kanbanize.com/ctrl_board/57/cards/20321/details/

The PR refactors how the policy payload is transformed into a designer graph.

The previous process was creating the graph elements (nodes and edges) from the payload and inserting them iteratively into the Design store. This created a re-render race condition, with parent nodes not yet inserted into the graph when their connecting edges were added. The error message at the first loading was the visual result of the faulty operation.

The new process iteratively creates ALL the graph elements BEFORE inserting them in two distinct operations: nodes first then edges.

The PR also fixes a bug with the behaviour policy, in which pipelines were connected to every transition created, regardless of the real dependency.

Before

screenshot-localhost_3000-2024 04 23-13_03_01

screenshot-localhost_3000-2024 04 23-13_03_27

After

screenshot-localhost_3000-2024 04 23-13_02_26