mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 16:06:43 -06:00
Proposed option for #13795, adding module option to hide scripts from user display, documentation adjustment
This commit is contained in:
parent
df71b02e88
commit
2fd2b12853
@ -42,7 +42,7 @@ Defining script variables is optional: You may create a script with only a `run(
|
||||
|
||||
Any output generated by the script during its execution will be displayed under the "output" tab in the UI.
|
||||
|
||||
By default, scripts within a module are ordered alphabetically in the scripts list page. To return scripts in a specific order, you can define the `script_order` variable at the end of your module. The `script_order` variable is a tuple which contains each Script class in the desired order. Any scripts that are omitted from this list will be listed last. To omit scripts from display entirely, define the `script_hide` variable at the end of your module. Scripts listed in this tuple will be ommitted from the unordered script listing.
|
||||
By default, scripts within a module are ordered alphabetically in the scripts list page. To return scripts in a specific order, you can define the `script_order` variable at the end of your module. The `script_order` variable is a tuple which contains each Script class in the desired order. Any scripts that are omitted from this list will be listed last. To omit scripts from display entirely, define the `script_hide` variable at the end of your module. Scripts listed in this tuple will be ommitted from the unordered script listing. This is useful for hiding intermediate subclasses of Script, for example.
|
||||
|
||||
```python
|
||||
from extras.scripts import Script
|
||||
@ -53,8 +53,14 @@ class MyCustomScript(Script):
|
||||
class AnotherCustomScript(Script):
|
||||
...
|
||||
|
||||
script_order = (MyCustomScript, AnotherCustomScript)
|
||||
script_hide = (MyHiddenScript,)
|
||||
class MyScriptClass(Script):
|
||||
...
|
||||
|
||||
class MyScriptSubclass(MyScriptSubclass):
|
||||
...
|
||||
|
||||
script_order = (MyCustomScript, AnotherCustomScript, MyScriptSubclass)
|
||||
script_hide = (MyScriptClass,)
|
||||
```
|
||||
|
||||
## Module Attributes
|
||||
|
Loading…
Reference in New Issue
Block a user