mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
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
This commit is contained in:
parent
18b43408ec
commit
8f87c72eaa
@ -65,12 +65,6 @@ class AnotherCustomScript(Script):
|
|||||||
script_order = (MyCustomScript, AnotherCustomScript)
|
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
|
||||||
|
|
||||||
Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged.
|
Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% load log_levels %}
|
{% load log_levels %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{{ script }}{% endblock %}
|
{% block title %}{{ script.python_class.name }}{% endblock %}
|
||||||
|
|
||||||
{% block object_identifier %}
|
{% block object_identifier %}
|
||||||
{{ script.full_name }}
|
{{ script.full_name }}
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
{% block subtitle %}
|
{% block subtitle %}
|
||||||
<div class="text-secondary fs-5">
|
<div class="text-secondary fs-5">
|
||||||
{{ script.Meta.description|markdown }}
|
{{ script.python_class.Meta.description|markdown }}
|
||||||
</div>
|
</div>
|
||||||
{% endblock subtitle %}
|
{% endblock subtitle %}
|
||||||
|
|
||||||
|
@ -56,15 +56,15 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if script.is_executable %}
|
{% if script.is_executable %}
|
||||||
<a href="{% url 'extras:script' script.pk %}" id="{{ script.module }}.{{ script.class_name }}">{{ script.name }}</a>
|
<a href="{% url 'extras:script' script.pk %}" id="{{ script.module }}.{{ script.class_name }}">{{ script.python_class.name }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% url 'extras:script_jobs' script.pk %}" id="{{ script.module }}.{{ script.class_name }}">{{ script.name }}</a>
|
<a href="{% url 'extras:script_jobs' script.pk %}" id="{{ script.module }}.{{ script.class_name }}">{{ script.python_class.name }}</a>
|
||||||
<span class="text-danger">
|
<span class="text-danger">
|
||||||
<i class="mdi mdi-alert" title="{% trans "Script is no longer present in the source file" %}"></i>
|
<i class="mdi mdi-alert" title="{% trans "Script is no longer present in the source file" %}"></i>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ script.description|markdown|placeholder }}</td>
|
<td>{{ script.python_class.Meta.description|markdown|placeholder }}</td>
|
||||||
{% if last_job %}
|
{% if last_job %}
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'extras:script_result' job_pk=last_job.pk %}">{{ last_job.created|isodatetime }}</a>
|
<a href="{% url 'extras:script_result' job_pk=last_job.pk %}">{{ last_job.created|isodatetime }}</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user