Skip to content

Script ordering is nondeterministic for Managed File #15891

Closed
@jchambers2012

Description

@jchambers2012

NetBox version

v3.76

Feature type

Change to existing functionality

Proposed functionality

Today it appears that the “/extras/scripts/” view is sorted based on core_managedfile’s data_synced field. I would like to see the order_by be defined or want to add a new setting to the configuration to allow for us to set a static way for the screen to render.
Hardcode this line

script_modules = ScriptModule.objects.restrict(request.user)
to

        script_modules = ScriptModule.objects.restrict(request.user).order_by("data_path")

Or allow for a config setting like below:

        script_modules = ScriptModule.objects.restrict(request.user)
        ORDERING_CHOICES = ["data_path","file_path"]
        sort = getattr(settings,"SCRIPT_VIEW_SORT",None)
        if sort in ORDERING_CHOICES:
            script_modules = script_modules.order_by(sort_field)
        return render(request, 'extras/script_list.html', {

Hardcoding the .order_by("data_path") fixes the issue on my local box no matter how files are added or updated to the script page

Use case

Our end users complain that the script groups jump all over the page as we add or update script in Netbox. This forces them to have to scroll up and down the page till they are able to find the group of script they wish to run

Database changes

This is a GUI change and no database changes are expected

External dependencies

n/a

Metadata

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions