From 8f87c72eaa94f849573fcfa232d91a481278504e Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Thu, 6 Jun 2024 06:05:59 -0700 Subject: [PATCH] 16050 Show script python_class name and description (#16185) * 16050 Show script python_class name and description * 16050 change to use Meta.description * 16050 change to use Meta.description * 16050 remove module name customization from docs --- docs/customization/custom-scripts.md | 6 ------ netbox/templates/extras/script/base.html | 4 ++-- netbox/templates/extras/script_list.html | 6 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index 21ae20f05..2a8f252aa 100644 --- a/docs/customization/custom-scripts.md +++ b/docs/customization/custom-scripts.md @@ -65,12 +65,6 @@ class AnotherCustomScript(Script): script_order = (MyCustomScript, AnotherCustomScript) ``` -## Module Attributes - -### `name` - -You can define `name` within a script module (the Python file which contains one or more scripts) to set the module name. If `name` is not defined, the module's file name will be used. - ## Script Attributes Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged. diff --git a/netbox/templates/extras/script/base.html b/netbox/templates/extras/script/base.html index 7220b329d..725e4737c 100644 --- a/netbox/templates/extras/script/base.html +++ b/netbox/templates/extras/script/base.html @@ -4,7 +4,7 @@ {% load log_levels %} {% load i18n %} -{% block title %}{{ script }}{% endblock %} +{% block title %}{{ script.python_class.name }}{% endblock %} {% block object_identifier %} {{ script.full_name }} @@ -17,7 +17,7 @@ {% block subtitle %}
- {{ script.Meta.description|markdown }} + {{ script.python_class.Meta.description|markdown }}
{% endblock subtitle %} diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 7ce5ca6eb..27b6115a7 100644 --- a/netbox/templates/extras/script_list.html +++ b/netbox/templates/extras/script_list.html @@ -56,15 +56,15 @@ {% if script.is_executable %} - {{ script.name }} + {{ script.python_class.name }} {% else %} - {{ script.name }} + {{ script.python_class.name }} {% endif %} - {{ script.description|markdown|placeholder }} + {{ script.python_class.Meta.description|markdown|placeholder }} {% if last_job %} {{ last_job.created|isodatetime }}