Integrate Blockly



  • Hi everyone!
    How difficult would it be to integrate Blockly as a more use friendly way to make rules?
    Something like blockly would make a javascript code as a result then added to rules list.
    How would you start to implement this?

    Thank you!
    Best regards,
    Mark


  • ADMIN

    @blacksheepinc MyController uses pure Java to configure rules. However, you can use script based condition. You can use your Blockly generated code with some modifications.



  • @jkandasa Thank you!
    As I saw there are 2 different kind of script defined at the rules page. Operation and Condition.
    I guess at the backend loop it checks every condition and if it's true it will perform the operation.
    Is it possible to make a script with blockly(condition and operation in one script), save as a script file, then use them as condition?


  • ADMIN

    @blacksheepinc In the backend, it checkes only the file you have mentioned on your rule. not all the scripts. Operation is common for many activites. However you can address your operation also on condition itself.



  • @jkandasa I see.
    I made a simple version where the blockly makes javascript as output, then I can run it, and it performs the task, but it is manual and done by the front-end.
    I would like to make an extra menu, next to the rules menu.
    It would work like the same, first there is a list, you can enable/disable or add/edit.
    Then the rule edit will be the blockly page. Click save and it makes a script file in the resources folder.
    Then the back end would perform each script if enabled.

    Or the second idea is to hide the operations and conditions menus. So when blockly makes the output, it will split into condition and operation, automatically saving them to the corresponding places. I think this idea needs less recoding/modifications to work.

    I think with this graphical interface people would use this with more confidence then the current method. Also would be easier to expand with additional functions instead of the need to use scripts.

    What do you think Jeeva?


  • ADMIN

    @blacksheepinc Your idea looks great. Let me have a look on Blockly and update you shortly on this.



  • @jkandasa Thanks Jeeva!



  • @jkandasa Did you have time to think about this?


  • ADMIN

    @blacksheepinc I am sorry. Yet to have a look. Will do it by this weekend. Sorry for the delay.



  • @jkandasa any news?


  • ADMIN

    @blacksheepinc Hi, Yes, I had a look. And looks like we can implement with MyController with some new implementation to support for JSR223 standard(which is used in Java). Kindly create a request on github.com/mycontroller-org/mycontroller/issues When I get time I will work on this. Thank you!


Log in to reply