The Template Configuration module is designed to make creating model configurations, used multiple times with slight modification, easy. Simply annotate a Json configuration, run the included python script, place the generated template into the web/ftl folder, and launch the module.
Using the Templates
Use the Import Template button to begin the import dialog. Every field from the template file is read and displayed with certain identifying information in the form: "Property Name - Message" with information about how that field spatially related to any static content in the template. If it says field, the template has no static value for that property. If it says prefix, the template contains static content that will come after the entered value. Suffix similarly refers to preceding static content. Body means there is static content on both sides. Globals do not offer information about their locations, as they may appear in differing situations throughout the ftl but all correspond to a single input.
Once your fields are filled, use the Import button to begin the import process. You should see the results of your dynamically populated import right on the page. If there are errors, don't worry, the dialog will remember the values you've entered if you attempt to re-open the same template.
Creating a Template
Annotating the JSON
After acquiring a JSON file you'd like to make a template of, proceed to the various lines you would like to make dynamically modified by the template wizard. NOTE: Spaces in your annotations will appear as underscores. Our annotation is very simple:
Four dollar signs with or without text separating the sets of two denotes that line of the JSON needs to be accessed by the template. Template fields are identified by 1) what attribute they modify, 2) what is their spatial relationship with the static field value, and 3) what is the message between the dollar signs? These messages will help identify the UI elements during the templating wizard. So, to annotate the line, ' "xid":"someXid", ' from an exported JSON, we could modify it to ' "xid":"$$NewXIDPrefix$$someXid", ' or just ' "xid":"$$$$someXid", '.
Note that in both cases the dollar signs occur inside the quotation marks. Were it a numeric value we were trying to grab, we could simply not have the quotation marks all together. The first annotation will produce "xid - NewXIDPrefix" with a text box hint of "Prefix" and the second will produce "xid" with a hint of "Prefix" again.
Four percent signs with and only with text separating the sets of two denotes a global field. These fields do not evaluate their context, so you can reuse them anywhere in the file and, as long as the identifier between the sets is the same, only one field will appear in the template wizard. For example: "xid":"%%DeviceName%%someXid"
Using the python script
Presuming you have python, you can run the script h2ftl in the "templateConfig/web/scripts" directory one of two ways. Either run it from the command line, as "python h2ftl.py ./input.txt ./output.ftl", or modify the script's default file paths to your input and output files. Now move the output ftl file into the templateConfig/web/ftl directory.