Skip to content

Enable rendering job data using a custom HTML template #19817

@jeremystretch

Description

@jeremystretch

NetBox version

v4.3.3

Feature type

New functionality

Proposed functionality

Extend the JobRunner class to allow specifying the path to a custom template. If provided, this template will be used to render the job's data in the UI.

class MyJob(JobRunner):
    template_name = 'foo/my_job.html'
    
    def run(self, *args, **kwargs):
        ...

Also add a render() method to JobRunner, which will render HTML content from the template, using the job's data as context.

Use case

This will enable the presentation of job data to the user via more elegant means, as opposed to raw data. NetBox does something similar today for custom scripts, but this requires a separate view (ScriptResultView). (It is likely that this view can be replaced by this feature.)

Database changes

N/A

External dependencies

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity: mediumRequires a substantial but not unusual amount of effort to implementtype: featureIntroduction of new functionality to the application

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions