Open-Systems-Pharmacology / MoBi

MoBi® is a software tool for multiscale physiological modeling and simulation
Other
31 stars 10 forks source link

Every action that converts a PK-Sim module to an extension module should have a confirmation dialog #1411

Closed PavelBal closed 2 weeks ago

PavelBal commented 3 months ago

Any action that will convert a PK-Sim module to an extension module should not only show a warning, but also have a "yes/no" option.

rwmcintosh commented 3 months ago

What's there now? Just a notice?

PavelBal commented 3 months ago

Yes, "The module will be converted".

rwmcintosh commented 3 months ago

Now I remember why this is implemented as notice instead of confirmation dialog. It's done during command execution. At a point where backing out is not possible. In most cases you can reverse the command after.

This might require re-evaluating how we have this implemented.

rwmcintosh commented 2 months ago

If we are going to do this, I think the only way to prompt the user before the command begins execution is to eliminate the direct running of commands in MoBi use a purpose-built task to prompt/execute all commands.

I believe the task is not as big as it sounds, we can use MoBiContext to execute the task. So most things would probably convert from.

new Command().Run(_context)

to

_context.RunCommand(new Command())

or something like that. Tedious due to the number of instances, but not impossible - way less work than converting PSV/MSV to PV/IC.

Then we can think about how to actually check this. Right now the commands are prompting based on whether the building block version will be updated. This is only done in one or two abstract base commands so it should not be too difficult to get the default existing functionality by checking the inheritance.

@Yuri05 @msevestre What do you guys think about changing this around?

rwmcintosh commented 2 months ago

Check this PR for a demo where I just converted one command execution.

https://github.com/Open-Systems-Pharmacology/MoBi/pull/1480/files