Format JSON data in config contexts #1978

Closed
opened 2025-12-29 17:21:05 +01:00 by adam · 1 comment
Owner

Originally created by @cimnine on GitHub (Aug 30, 2018).

Environment

  • Python version: not relevant
  • NetBox version: >2.4

Proposed Functionality

Currently editing config contexts is a little painful. It's just a text field. There is no syntax highlighting or proper indention. It's just one big pile of characters and symbols that's hard to work with.

current

Therefore I suggest to introduce something like Ace to the UI of Netbox. It would make it a lot easier to work with the JSON of config contexts, like in this mockup:

mockup

Use Case

Displaying and editing config contexts.

Database Changes

None

External Dependencies

A code edit library like Ace.

Comment

I recognize that this is no high-prio task at all. For now, I just copy the JSON into a real editor (Atom, VS Code) and change it there. But I seems to be just little effort to include the proposed editor Ace, which would result in a greatly improved user experience when working with config contexts.

In the meantime I suggest to at least properly indent the JSON that is returned from the database when it's rendered in the text area.

Originally created by @cimnine on GitHub (Aug 30, 2018). ### Environment * Python version: not relevant * NetBox version: >2.4 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Currently editing config contexts is a little painful. It's just a text field. There is no syntax highlighting or proper indention. It's just one big pile of characters and symbols that's hard to work with. ![current](https://user-images.githubusercontent.com/804532/44866747-eed7c980-ac3a-11e8-88d9-b99a1684e67f.png) Therefore I suggest to introduce something like [Ace][ace] to the UI of Netbox. It would make it a lot easier to work with the JSON of config contexts, like in this mockup: ![mockup](https://user-images.githubusercontent.com/804532/44867010-981ebf80-ac3b-11e8-8196-167c6c24f528.png) [ace]: https://ace.c9.io/ <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case Displaying and editing config contexts. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes None <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies A code edit library like [Ace][ace]. ### Comment I recognize that this is no high-prio task at all. For now, I just copy the JSON into a real editor (Atom, VS Code) and change it there. But I seems to be just little effort to include the proposed editor [Ace][ace], which would result in a greatly improved user experience when working with config contexts. In the meantime I suggest to at least properly indent the JSON that is returned from the database when it's rendered in the text area.
adam added the status: acceptedtype: feature labels 2025-12-29 17:21:05 +01:00
adam closed this issue 2025-12-29 17:21:05 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 5, 2018):

We can fix up the formatting but I'm going to decline implementing the custom form control necessary to achieve syntax highlighting (HTML text areas can't display color).

@jeremystretch commented on GitHub (Sep 5, 2018): We can fix up the formatting but I'm going to decline implementing the custom form control necessary to achieve syntax highlighting (HTML text areas can't display color).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1978