Skip to content

Closes: #193 - Allow Custom Object Types to specify a group_name for navigation menu grouping#410

Merged
arthanson merged 9 commits intomainfrom
193-grouped-custom-object-types
Mar 9, 2026
Merged

Closes: #193 - Allow Custom Object Types to specify a group_name for navigation menu grouping#410
arthanson merged 9 commits intomainfrom
193-grouped-custom-object-types

Conversation

@bctiemann
Copy link
Copy Markdown
Contributor

Closes: #193

This adds a group_name field to CustomObjectType which allows COTs to be grouped in the navigation menu. An unspecified group_name results in COTs being grouped under "Objects" as before.

Screenshot 2026-02-19 at 6 04 47 PM

Note: This solution requires that NetBox be restarted in order to re-populate the groupings in the nav menu if they have changed. This is because only the list of items within a group is iterable; the groupings themselves are populated concretely at app startup time.

@bctiemann bctiemann added this to the v0.4.7 milestone Feb 19, 2026
@bctiemann bctiemann requested a review from arthanson February 20, 2026 16:51
Copy link
Copy Markdown
Contributor

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing test for some reason: django.db.utils.ProgrammingError: relation "netbox_custom_objects_customobjecttype" does not exist

@bctiemann bctiemann requested a review from arthanson March 4, 2026 18:49
Copy link
Copy Markdown
Contributor

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple issues:

I had two existing custom object types, I added a a1 group label to the first, b2 to the second one.

  1. When I add b2 the custom object in the sidebar disappears - forcing you to restart. I know you stated that it requires a restart to show, but this forces a restart as soon as you add a group name. I don't think that is acceptable, or if okay with PM then should at least have a big warning on the field that you must restart if you change this item - IMHO I wouldn't ship with this restriction.

  2. The ordering of the menu items is non-deterministic. Each time you restart the group a1 and b2 can shift places. a1 is first on some restarts, b1 is first on others.

  3. Should probably add group-name to filters

I also think there should be some minimal tests:

  • A test that a COT with group_name appears in the correct group in get_grouped_menu_items()
  • A test that group_name is serialized in the API response

@bctiemann
Copy link
Copy Markdown
Contributor Author

@claude /review

@bctiemann bctiemann requested a review from arthanson March 5, 2026 22:15
@arthanson arthanson merged commit ebd6c0f into main Mar 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grouping custom objects

2 participants