After much work I have finally made Ignition commit and push to a Git origin repo by using the “Update” gateway event script and calling a bat file to handle all of the logic. Running Windows Server 2019 and Ignition 8.1.1.
The problem I have now is that every commit is a generic message hard coded into the bat file with a timestamp for when the bat file is ran.
What I would like to do is have the update event prompt the user for input and pass that input as an argument to my bat file and use that as the commit message.
Since it is gateway scope and not client scope system.gui.inputBox doesn’t work. I could have it read a tag and write the commit message to the tag, but there is no way to force someone to enter something into that tag through client event scripts (only runs on time, shut down, shutdown-intercept, or an interval). I could maybe do on keystroke and hope everyone uses ctrl + s but that leaves a pretty large gap and I don’t know that the timing would always work out that the keystroke intercept happens before the gateway update event.
Anyone have any creative ideas on how to prompt the user for input when saving the project to get a custom git commit message?
Gateway execution is headless. Sorry. You’d need a module loaded into the designer that could intercept the save operation and gather the info before the save goes to the gateway.
Assuming it is even possible to intercept the save operation.
Seems tricky to do…
maybe one could alter the whole menu and keybinding to trigger your own “save” events that first opens a popup…
Ive seen someone change the rightclick context menu on project browser before so im guessing the main menu would also be possible. Welh he tried to change it alteast i think in the end he didnt have to, but idk if it was possible at all
yeah it probaly somethin here in the doc it says “Represents a menu merge for a JMenu. This may be a top-level menu (like “file”) or a sub-menu”
and file is exactly the one you would want to change
I know someone who has build a simple module to handle this. You can then sign in your repo, select wether export project, tags, gw bkup. I’ll ask him if he can share it…
Any chance you could share more about this module with me?
Sure… @mazeyrat may be of some help here.
Yes @gnguyen @isabellapitco we have a module to control some git action from vision or perspective.
(best with Ignition 8.1.16 which enable to manage one repository per project)
You can test the module:
BYES-Git-signed-1.8.0.modl (3.1 MB)
In our use case we track with git the projects changes, we have another module to add script functions in order to export gateway ressources (images, tags.json, sqlite config table, modules versions and few critical files: ignition.conf and redundancy.xml) in another git repo “export_gateway” for gateway ressources.
Example of popup:
Hope this help.
Thank you @mazeyrat for sharing this. Awesome, as usual!