Back to Netbox

Script List Content

netbox/templates/extras/inc/script_list_content.html

4.6.32.7 KB
Original Source

{% load buttons %} {% load helpers %} {% load perms %} {% load i18n %} {# Core script list content - used by both full page and embedded views #} {% for module in script_modules %} {% include 'inc/sync_warning.html' with object=module %}

{% if not embedded %}

{{ module }} {% if perms.extras.change_scriptmodule %} {% trans "Edit" %} {% endif %} {% if perms.extras.delete_scriptmodule %} {% trans "Delete" %} {% endif %}

{% endif %} {% with scripts=module.ordered_scripts %} {% if scripts %}

{% trans "Name" %}{% trans "Description" %}{% trans "Last Run" %}{% trans "Status" %}
{% for script in scripts %} {% if script in available_scripts %} {% with last_job=script.get_latest_jobsfirst %}{% if script.is_executable %} {{ script.python_class.name }} {% else %} {{ script.python_class.name }} {% endif %}{{ script.python_class.descriptionmarkdown
{% if script.python_class.commit_default %} {% endif %} {% csrf_token %} {% if last_job %} {% if not embedded %}{% trans "Run Again" %}{% endif %} {% else %} {% if not embedded %}{% trans "Run Script" %}{% endif %} {% endif %}
{% endif %}
{% if last_job and not embedded %} {% for test_name, data in last_job.data.tests.items %}{{ test_name }}{{ data.success }}{{ data.info }}{{ data.warning }}{{ data.failure }}
{% endfor %} {% elif last_job and not last_job.data.log and not embedded %} {# legacy #} {% for method, stats in last_job.data.items %}{{ method }}{{ stats.success }}{{ stats.info }}{{ stats.warning }}{{ stats.failure }}
{% endfor %} {% endif %} {% endwith %} {% endif %} {% endfor %}
{% else %}

{% blocktrans with module=module.name %}Could not load scripts from module {{ module }}{% endblocktrans %} {% if module.error %}{{ module.error }}{% endif %}

{% endif %} {% endwith %} {% empty %}

{% trans "No Scripts Found" %}

{% if perms.extras.add_scriptmodule and not embedded %} {% url 'extras:scriptmodule_add' as create_script_url %} {% blocktrans trimmed %} Get started by creating a script from an uploaded file or data source. {% endblocktrans %} {% endif %} {% endfor %}