1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

adds extra column for result on the script job table #15983

This commit is contained in:
Abhimanyu Saharan
2024-05-09 23:02:36 +05:30
parent 9f940150fc
commit 6f3dfbabee

View File

@ -17,6 +17,7 @@ from dcim.models import Device, DeviceRole, Platform
from extras.dashboard.forms import DashboardWidgetAddForm, DashboardWidgetForm
from extras.dashboard.utils import get_widget_class
from netbox.constants import DEFAULT_ACTION_PERMISSIONS
from netbox.tables import columns
from netbox.views import generic
from netbox.views.generic.mixins import TableMixin
from utilities.data import shallow_compare_dict
@ -1126,9 +1127,15 @@ class ScriptJobsView(generic.ObjectView):
jobs_table = JobTable(
data=script.jobs.all(),
orderable=False,
user=request.user
user=request.user,
extra_columns=[(
'result', columns.TemplateColumn(
template_code='<a href="{% url "extras:script_result" job_pk=record.pk %}">{{ record.completed }}</a>'
)
),]
)
jobs_table.configure(request)
jobs_table.columns.show('result')
return render(request, 'extras/script/jobs.html', {
'script': script,