Problem/Motivation

Often, models currently get built and published with the bpmn_io modeller. But users who can't use that modeller and want to have a look with eca_cm, we should allow importing such "foreign" models as eca_cm models.

Proposed resolution

Implement a form alter hook to add a checkbox to the eca import form and if that's checked, hook into the import process and make the necessary adjustments.

Issue fork eca_cm-3304333

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jurgenhaas created an issue. See original summary.

jurgenhaas’s picture

Assigned: jurgenhaas » Unassigned
Status: Active » Needs review

This was interesting, the ECA import function was already built in a way that allowed to make the necessary adjustments here.

mxh’s picture

Status: Needs review » Needs work

Can we make this a submit button instead of a checkbox? I'm asking because you've implemented the logic into a validation handler. Using the validate callback is not the right place, it should be a submit handler instead. Using a submit button should make adding it as a submit handler instead easier.

jurgenhaas’s picture

It's been a deliberate decision to implement this in the validate callback. This follows the architecture of the import controller: over there, the validate function verifies if the uploaded file is valid and prepares it for further processing. The submit callback then operates on that prepared result from the validate callback.

Hooking into this process, using the validate callback gets called after the import validate and before the import submit callback. Exactly what we need, whereas a submit callback here would be called after the import submit, which is too late.

Changing the checkbox to its own button could be done, I just found that offering it as a setting might be more intuitive. Did you propose the button because of validate vs. submit handler or because you think otherwise, that would be better for the user?

mxh’s picture

the validate function verifies if the uploaded file is valid and prepares it for further processing.

The first part is fine (verifying), the second is part should belong to a submission handler. Form validation may be called multiple times as when validation errors occurred, and writing or removing files within validation does not look like an idempotent operation. How would it behave when the function is called more than once?

Did you propose the button because of validate vs. submit handler or because you think otherwise, that would be better for the user?

No, just raised this because of my question in #4.

mxh’s picture

Assigned: Unassigned » mxh
Status: Needs work » Active

Will merge this one into 1.0.x.

  • jurgenhaas committed c7d5631 on 1.0.x
    Issue #3304333: Import models from other modellers into eca_cm
    
  • jurgenhaas committed d6e9474 on 1.0.x
    Issue #3304333: Import models from other modellers into eca_cm
    
mxh’s picture

Assigned: mxh » Unassigned
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.