Open quenhulu opened 6 years ago
@quenhulu Could you please add more details about your change? Thanks :-)
I want to group devices by manufacturer, e.g. Arista, Cisco and Juniper.
However manufacturer
is not a section, but one of the device_type
attributes.
So, I chaned code to group by an even attribute of section too.
manufacturer
is an attribute of device_type
:
$ curl http://localhost/api/dcim/devices/ | jq .
{
"count": 99,
"next": "http://localhost/api/dcim/devices/?limit=50&offset=50",
"previous": null,
"results": [
{
"id": 1,
"name": "switch00",
"display_name": "switch00",
"device_type": {
"id": 1,
"url": "http://localhost/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost/api/dcim/manufacturers/1/",
"name": "ARISTA",
"slug": "arista"
},
"model": "DCS-7050QX-32",
"slug": "dcs-7050qx-32"
},
...
netbox.yml:
netbox:
main:
api_url: 'http://localhost/api/dcim/devices/'
group_by:
default:
# group by manufacturer
- device_type.manufacturer
Add support for grouping by nested group. This patch splits group name with dot when get group value. Example of nested group name is `device_type.manufacturer'.