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

Be able to hide create / append anything behind a feature toggle #236

Closed
nikku opened this issue Feb 3, 2023 · 8 comments · Fixed by #238
Closed

Be able to hide create / append anything behind a feature toggle #236

nikku opened this issue Feb 3, 2023 · 8 comments · Fixed by #238
Assignees

Comments

@nikku
Copy link
Member

nikku commented Feb 3, 2023

What should we do?

The connectors extension uses connectorsExtension.appendAnything=false to not show it. We could simply re-use that flag:

// create modeler
const modeler = new BpmnModeler({
  connectorsExtension: {
    appendAnything: false
  }
});

// and the feature is gone

Why should we do it?

This allows us to roll it out across our toolstack in a safe manner.

@smbea smbea added the ready Ready to be worked on label Feb 3, 2023
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed ready Ready to be worked on labels Feb 3, 2023
@smbea
Copy link
Contributor

smbea commented Feb 3, 2023

Does something like 30d7603 make sense? I added a module that basically removes the create/append palette/contextpad entries if connectorsExtension.appendAnything is false but I'm not sure if this is a proper way to do it @nikku

@nikku
Copy link
Member Author

nikku commented Feb 3, 2023

@smbea Alternative to 30d7603 would be to filter out the entire module, based on the provided option:

CustomModeler.getModule = function(options) {
  const modules = super.getModules(options);
  
  if (options.connectorsExtension?.appendAnything === false) {
    modules = modules.without(CreateAppendAnythingModule);
  }

  return modules;
};

The third option would be to push an additional module that overrides named services exported by the module to empty stubs.

@smbea
Copy link
Contributor

smbea commented Feb 6, 2023

Wouldn't that first option mean having a new custom Modeler, that would need to be used instead of the Cloud Modeler? Not sure if I understood correctly

@nikku
Copy link
Member Author

nikku commented Feb 6, 2023

The first option would mean:

  • BpmnViewer#getModules receives the options the instance is started with 1️⃣
  • It can filter the modules at initialization time (rather than compile time), based on configuration passed.

If we want to go this route we need to extend the existing BaseViewer#getModules to accomplish 1️⃣. Alternative: Go any other route. But as we already have create-append-anything self-contained the best thing would be to not ship it completely, conditionally.

@smbea
Copy link
Contributor

smbea commented Feb 6, 2023

I redid this with 805318d. It follows what we do for alignToOrigin.

Maybe it's not exactly what you were mentioning but I think it achieves the same thing - don't add the module completely. Wdyt?

@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending in progress Currently worked on and removed in progress Currently worked on needs review Review pending labels Feb 6, 2023
@nikku
Copy link
Member Author

nikku commented Feb 6, 2023

Good one. alignToOrigin is basically a hack that we need to use because we're missing #236 (comment). I'll see if we can follow up with a more reasonable approach: Simply allow Modeler#getModules to be subclassed.

@smbea smbea closed this as completed in #238 Feb 6, 2023
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Feb 6, 2023
@smbea
Copy link
Contributor

smbea commented Feb 6, 2023

My confusion was because getModules is only present in BaseViewer and not in Modeler. But looking forward to a follow up for this

@nikku
Copy link
Member Author

nikku commented Feb 6, 2023

My confusion was because getModules is only present in BaseViewer and not in Modeler. But looking forward to a follow up for this

The inheritance chain looks like this:

BaseViewer > Viewer > BaseModeler > Modeler

So any improvement in BaseViewer will be for the benefit of overall extensibility (all Viewer / Modeler variants).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants