Fix form field ordering

This commit is contained in:
Jeremy Stretch
2019-08-09 16:34:01 -04:00
parent 4fc19742ec
commit 3f7f3f88f3
5 changed files with 48 additions and 9 deletions

View File

@@ -37,6 +37,24 @@ Defining variables is optional: You may create a script with only a `run()` meth
Returning output from your script is optional. Any raw output generated by the script will be displayed under the "output" tab in the UI.
## Script Attributes
### script_name
This is the human-friendly names of your script. If omitted, the class name will be used.
### script_description
A human-friendly description of what your script does (optional).
### script_fields
The order in which the variable fields should appear. This is optional, however on Python 3.5 and earlier the fields will appear in random order. (Declarative ordering is preserved on Python 3.6 and above.) For example:
```
script_fields = ['var1', 'var2', 'var3']
```
## Logging
The Script object provides a set of convenient functions for recording messages at different severity levels:
@@ -106,8 +124,9 @@ from extras.scripts import Script, IntegerVar, ObjectVar, StringVar
class NewBranchScript(Script):
name = "New Branch"
description = "Provision a new branch site"
script_name = "New Branch"
script_description = "Provision a new branch site"
script_fields = ['site_name', 'switch_count', 'switch_model']
site_name = StringVar(
description="Name of the new site"