From 930d4c6448263ee6ec5681b8c2f7fc3eef6c7254 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 17 May 2024 09:16:05 -0700 Subject: [PATCH 1/4] 16050 Show script python_class name and description --- netbox/templates/extras/script/base.html | 4 ++-- netbox/templates/extras/script_list.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/netbox/templates/extras/script/base.html b/netbox/templates/extras/script/base.html index 7220b329dbe..37575312dbe 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.description|markdown }}
{% endblock subtitle %} diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 7ce5ca6ebd7..23240ea3081 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.description|markdown|placeholder }} {% if last_job %} {{ last_job.created|isodatetime }} From f0783c49992e4f7c91f37f3e03c5c7ea09aa961d Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 24 May 2024 08:44:08 -0700 Subject: [PATCH 2/4] 16050 change to use Meta.description --- netbox/templates/extras/script/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/templates/extras/script/base.html b/netbox/templates/extras/script/base.html index 37575312dbe..725e4737c3b 100644 --- a/netbox/templates/extras/script/base.html +++ b/netbox/templates/extras/script/base.html @@ -17,7 +17,7 @@ {% block subtitle %}
- {{ script.python_class.description|markdown }} + {{ script.python_class.Meta.description|markdown }}
{% endblock subtitle %} From a0a1a7c0f2d23e466956f79c79c85d9249b1af3c Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 24 May 2024 08:52:24 -0700 Subject: [PATCH 3/4] 16050 change to use Meta.description --- netbox/templates/extras/script_list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 23240ea3081..27b6115a7ed 100644 --- a/netbox/templates/extras/script_list.html +++ b/netbox/templates/extras/script_list.html @@ -64,7 +64,7 @@
{% endif %} - {{ script.python_class.description|markdown|placeholder }} + {{ script.python_class.Meta.description|markdown|placeholder }} {% if last_job %} {{ last_job.created|isodatetime }} From dc50a73b22b29a1f405df3237ea17fabd968b37e Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 4 Jun 2024 07:55:11 -0700 Subject: [PATCH 4/4] 16050 remove module name customization from docs --- docs/customization/custom-scripts.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/customization/custom-scripts.md b/docs/customization/custom-scripts.md index 21ae20f0558..2a8f252aa2c 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.