Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elements.changed event is not triggering in custom rule #2144

Open
okankrdg opened this issue Apr 18, 2024 · 6 comments
Open

elements.changed event is not triggering in custom rule #2144

okankrdg opened this issue Apr 18, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@okankrdg
Copy link

okankrdg commented Apr 18, 2024

Describe the Bug

elements.changed and elements.create events are not working in extends RuleProvider.

Steps to Reproduce

  1. Create a CustomRuleProvider, like the below
  2. Add to additonalModules
  3. Do element change or create on designer.
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';

const HIGH_PRIORITY = 1500;

export default class CustomRuleProvider extends RuleProvider {
  constructor(eventBus) {
      super(eventBus);
  }

  init() {

    this.addRule('elements.create', HIGH_PRIORITY, function(context) {
      console.log("create not working")
  
    });
    this.addRule('elements.changed', HIGH_PRIORITY, function(context) {
      console.log("changed not working")
  
    });
  this.addRule('elements.move', HIGH_PRIORITY, function(context) {
    console.log("moveee wroking",context)

  });

   this.addRule('connection.create', HIGH_PRIORITY, context => {
      console.log('connection.create working')
    
    });
   
}
}
CustomRuleProvider.$inject = ["eventBus"]

Expected Behavior

expecting 'elements.changed' or 'elements.created' event trigger when element was created or changed.

Environment

  • Browser: [Version microsoft Edge 123.0.2420.97]
  • Library version: [17.2.1]
@okankrdg okankrdg added the bug Something isn't working label Apr 18, 2024
@nikku
Copy link
Member

nikku commented Apr 18, 2024

Please use our existing issue templates. That helps you to establish the necessary context, including a clear description of what you believe should happen.

@okankrdg
Copy link
Author

okankrdg commented Apr 18, 2024

I updated the bug reports.@nikku

@nikku
Copy link
Member

nikku commented Apr 18, 2024

Thanks @okankrdg. Why do you expect the following, and what would you like to accomplish?

expecting 'elements.changed' or 'elements.created' event trigger when element was created or changed.

Rules are only evaluated for certain wellknown activities.

@okankrdg
Copy link
Author

I would like only specific task connected be from Non-interrepting Element. for example Non-interrepting--> service task -> service -task. it is ok. but I would like not allowed the service task is changed.

Thanks @okankrdg. Why do you expect the following, and what would you like to accomplish?

expecting 'elements.changed' or 'elements.created' event trigger when element was created or changed.

Rules are only evaluated for certain wellknown activities.

@nikku
Copy link
Member

nikku commented Apr 19, 2024

I guess it makes sense if you share a screencapture of the interaction youd like to allow and/or disallow.

@okankrdg
Copy link
Author

I'm only allowing connected to service-task from non-interreptuing event. it's working with connection.create event but I can't prevent it when I changed type.

custom-rule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants