Skip to content

Format default user preferences (and other) JSON when populating the config editor #14690

Closed
@markkuleinio

Description

@markkuleinio

NetBox version

v3.7.0

Feature type

Change to existing functionality

Proposed functionality

When editing Default user preferences in Current Config - Edit, the JSON is shown just dumped, like this (very short example):

{"tables": {"ASNTable": {"columns": ["asn", "tags"]}, "RackTable": {"columns": ["name", "site", "get_utilization", "get_power_utilization"]}}}

I propose that the JSON data would be formatted using the same formatter as in the Current Config screen (before editing, showing JSON nicely structured and indented) before showing it in the edit box, instead of just dumping the compressed JSON data there.

If there are other similar JSON-based configuration items, this same principle can probably be used in them all.

Use case

When fine-tuning the typically very long JSON data in the config editor it is hard to locate and understand particular keys and values in the unformatted JSON dump. Formatting the JSON data nicely will help editing the data and preventing errors when modifying and saving the configuration.

Even if the editor shows the data structured and indented, it is nevertheless saved in the optimal compressed format, so there is no loss of efficiency in the database.

Database changes

None

External dependencies

None (json module from Python standard library can be used unless some other method is already preferred in NetBox)

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions