- work in progress -
The Plugin API GUI page is accessible from Administration tab. It allows creating, editing and deleting of Reaction scripts. It is possible to directly execute scripts or schedule the execution of scripts.
The toolbar for the list contains differnt categories (2-5) for a better overview.
- Filter Category:
- Number of filtered elements to maximum elements
- Quick search
- Reset button to reset only the Filter Category (only visible if the list is filtered)
- Edit Data Category:
- Create new element
- Upload Script
- List of scripts:
- Enable/Disable Scipt
- Name clickable, opens the script in the editor
- Script runs at scheduled times
- Script affects these Building Block Types
- Actions column (Execute, Download Script, Show Log, Delete)
Uploading a Script
After clicking Upload button (1) a dialog for uploading new scripts is opened.
By clicking browse you can choose scripts in .js or .txt format. To upload a new script you have to enter a name, other attributes are optional.
Invalid Cron Syntax
If the Cronjob syntax for scheduling the execution is invalid, the script cannot be uploaded. See Cronjob Syntax
Creating new Script
By clicking the New button (2) an editor for script code will be opened.
Enabling and Disabling Scripts
If a script is enabled it either constantly listens for changes (subscription scripts) or will be executed on schedule (direct execution scripts).
Scheduling Script Execution
Every enabled reaction script can have a scheduled execution. The schedule can be set during script upload or directly in the list. Schedule input only supports Cronjob syntax for scheduling and will not be saved if it is invalid.
Some Cronjob examples might look like:
- 0 15 10 01 * ? Fire at 10:15 AM on the 1st day of every month
- 0 0 12 1/5 * ? Fire at 12 PM (noon) every 5 days every month, starting on the first day of the month
- 0 11 11 11 11 ? Fire every November 11 at 11:11 AM
For Cronjob scheduling tutorial and examples visit this page.
If a script is syntactically invalid, it will be automatically disabled in the list and a warning icon will be displayed in front of the name. The execute button is inactive and after editing this script a message describing the error will appear.
Actions column has four types of action:
- Directly execute script
- Download script
- Show logs for script
- Delete script
The script can be directly executed even if it is disabled but it must have valid syntax otherwise the button will be disabled.
Every script execution will log its start and end time in the database. Additionally function api.printLog(string message) will print this message to database.
LOG action button (8) will show all logged messages for a specific script. If there are no logs, the dialog will not be opened and proper message will appear.
From the Log dialog all log entries can be copied to clipboard or deleted.