Identify object on historyEntry and source of changes

Hi!

We are having a scenario where we need to identify which changes are to be logged or not and the problem is that there is no id for the edited object on the HistoryEntryAlso, there is no simple way to know if the object is a node or connector.
You can see an example running here with the latest packages. 

In the mentioned example there are two timeouts that would represent two ways of making changes to the diagram. So, a way to identify if a change would not require log is to add a property in the addInfo field, then we would check its value finding the object in the diagram on the diagram.HistoryManager.canLog function. Since the  HistoryEntry does not contain an id, this solution is not possible.


historyEntry example without id

Why the id isn't on the HistoryEntry?

Thanks



5 Replies

AR Aravind Ravi Syncfusion Team May 13, 2022 11:25 AM UTC

Hi Camila,


By default, in the diagram, when we do any changes, the historyChange event get triggered and in that event we passed only which property get changed in that object as source argument. In history manager also we just passed only the changed property of object. Could you please share us for what requirement you need node / connector id in the historyManager property. This would help us to analyze further and provide solution as soon as possible.


Regards

Aravind Ravi



CB Camila BlancFick May 13, 2022 01:23 PM UTC

Thanks for replying  Aravind.

Our requirement is that: a diagram can be modified in real time by the user (manual change) and an observable getting changes from an API (external changes). We need a way to differentiate the external changes from the manual, and only track the manual ones.

For example, there would be one manual change to a connector that changes the 
strokeColor to red and another from the API that changes the strokeWidth. One change next in time the other.

Regards, 

Camila



AR Aravind Ravi Syncfusion Team May 16, 2022 12:46 PM UTC

Hi Camila,


We suspect that you need to find out which element gets changed while you are doing manual or programmatic changes. Instead of using the historyChange event you can use propertyChange event to identify the object. When you do any changes propertyChange event also gets triggered. In that event through element argument, you can get in which element you made changes. Please refer to the code snippet and sample


public propertyChange(args: IPropertyChangeEventArgs) {

    console.log(args.element);

  }


Sample: https://stackblitz.com/edit/angular-9nclns-fqk6sc?file=app.component.ts


Regards

Aravind Ravi



CB Camila BlancFick May 16, 2022 01:11 PM UTC

Sorry, I think you misunderstood the problem. 

I can't get that info from within the canLog function to not log  programmatic changes.


The problem is that we need to decide which changes track and we do not have any id in the HistoryEntry. 


Shall I make a ticket for feature request instead?



AR Aravind Ravi Syncfusion Team May 17, 2022 12:28 PM UTC

Hi Camila,


Currently we don’t have to track ID of changed object in history entry in our diagram control. We have logged “Need to add object ID in the historyChange event argument” as a feature. We does not have any immediate plans to start this feature. We will implement this feature in any one of our upcoming releases.  


You can track the feature status from the below link


Link: https://www.syncfusion.com/feedback/34940/always-include-id-property-on-historyentry



Regards, 

Aravind Ravi


Loader.
Up arrow icon