label-studio-frontend icon indicating copy to clipboard operation
label-studio-frontend copied to clipboard

add events for creation, deletion and label updates of relations

Open alxflam opened this issue 3 years ago • 0 comments

Hi,

i'm trying to embed LSF into a custom application which works fine. I need to be able to recognize operations such as creation and deletion of regions and their relations. This already works for regions, but there are no events broadcast yet for relations. Hence this PR adds events for:

  • Creating relations, topic: "addRelation"
  • Deleting relations, topic: "deleteRelation"
  • Selecting labels of a relation, topic: "selectRelationLabels"

These events are especially helpful if the embedding application wants to:

  • maintain an 'isDirty' state, hence did any relation or entity change or got created / deleted
  • e.g. to make a label mandatory for every relation, the callback for "addRelation" can be used to display a dialog so the user has to select a label (and then set it by 'relation.relations.children[userSelectedIndex].selected = true').

I could not spot any tests yet for the existing events, if you can point me into the right direction i could also try to provide tests to verify the events are actually broadcasted.

Greetings, Alex

alxflam avatar Jan 20 '22 21:01 alxflam