add ability to control json property UI order for module type profiles
NetBox version
v4.4.7
Feature type
Change to existing functionality
Proposed functionality
we are looking for the ability to control the UI order of properties in module type profiles. Ideally via a new attribute for the property, perhaps "weight".
Use case
Currently, when modifying the JSON schema for module type profiles, the order presented in the UI is derived from the property names (alphabetically).
We would like the ability to control UI order of properties to offer a better flow to properties. See example JSON:
{
"if": {
"properties": {
"type": {
"const": "NVMe"
}
}
},
"properties": {
"hot_swappable": {
"default": false,
"title": "Hot-swappable",
"type": "boolean"
},
"size": {
"description": "Raw disk capacity",
"title": "Size (GB)",
"type": "integer"
},
"type": {
"default": "SSD",
"enum": [
"HD",
"SSD",
"NVMe"
],
"title": "Disk type",
"type": "string"
},
"generation": {
"enum": [
"Gen3",
"Gen4",
"Gen5"
],
"title": "NVMe Generation",
"type": "string"
}
},
"required": [
"size"
],
"then": {
"required": [
"generation"
]
}
}
In the above example, the "generation" property actually comes before "type" in the UI because G comes before T. We'd like the ability to force "generation" to be after "type" in the UI so it makes more sense. Right now, the only work around I've found is to name the property something like "u_generation" so now the property starts with a U and comes after T. But this is clunky.
Database changes
none
External dependencies
none
We're pretty much limited to whatever the JSON schema library supports. Were you able to find any native functionality therein that would support what you're proposing?
We're pretty much limited to whatever the JSON schema library supports. Were you able to find any native functionality therein that would support what you're proposing?
I don't pretend to be an expert, but this leads me to a possibility of a custom keyword: https://docs.json-everything.net/schema/vocabs/
something like this example:
{
"properties": {
"type": {
"default": "SSD",
"enum": [
"HD",
"SSD",
"NVMe"
],
"title": "Disk type",
"type": "string"
},
"generation": {
"enum": [
"Gen3",
"Gen4",
"Gen5"
],
"title": "NVMe Generation",
"type": "string"
}
},
"required": [
"type"
],
"x-uiOrder": [
"type", "generation"
]
}