Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom field types for standardized location identifiers #12194

Closed
jeremystretch opened this issue Apr 6, 2023 · 4 comments
Closed

Add custom field types for standardized location identifiers #12194

jeremystretch opened this issue Apr 6, 2023 · 4 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@jeremystretch
Copy link
Member

jeremystretch commented Apr 6, 2023

NetBox version

v3.4.7

Feature type

New functionality

Proposed functionality

Add three new types of custom field:

Custom fields of either type would render as selection fields listing only valid values as selectable options. These would be maintained within NetBox core, with no additional setup needed on the part of the administrator.

Use case

These are well-known values with a wide range of useful applications concerning the assignment of location data. For example, it is common practice to designate the LOCODE for each site on a network.

Database changes

N/A

External dependencies

There are a few ways we might source this data, such as the locode Python package. Further evaluation of the available options is needed.

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Apr 6, 2023
@BarbarossaTM
Copy link
Contributor

This would be awesome, especially UN-LOCODE!

Do you have some idea in mind how to model this? Like for example would there be two levels for country and city?

@jeremystretch jeremystretch added needs milestone Awaiting prioritization for inclusion with a future NetBox release status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation needs milestone Awaiting prioritization for inclusion with a future NetBox release labels May 4, 2023
@jeremystretch jeremystretch added this to the v3.6 milestone May 5, 2023
@jeremystretch jeremystretch self-assigned this May 31, 2023
@jeremystretch
Copy link
Member Author

jeremystretch commented Jun 23, 2023

My initial thought here was to introduce new custom field types to hold the types of data mentioned above, but in retrospect that seems like a poor approach that won't scale well. Instead, I've just opened #12988 which proposes moving stored custom field choices into a separate model, which will allow for the efficient reuse of choice sets across multiple custom fields.

Marking this as blocked pending the acceptance of that proposal.

@jeremystretch jeremystretch added status: blocked Another issue or external requirement is preventing implementation and removed status: accepted This issue has been accepted for implementation labels Jun 23, 2023
@gdprdatasubect
Copy link
Contributor

Would it be possible to include NUTS1-3 for regions too?

jeremystretch added a commit that referenced this issue Jul 19, 2023
* Initial work on custom field choice sets

* Rename choices to extra_choices (prep for #12194)

* Remove CustomField.choices

* Add & update tests

* Clean up table columns

* Add order_alphanetically boolean for choice sets

* Introduce ArrayColumn for choice lists

* Show dependent custom fields on choice set view

* Update custom fields documentation

* Introduce ArrayWidget for more convenient editing of choices

* Incorporate PR feedback

* Misc cleanup
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: blocked Another issue or external requirement is preventing implementation labels Jul 19, 2023
@jeremystretch
Copy link
Member Author

Another set to consider is CLLI.

jeremystretch added a commit that referenced this issue Jul 28, 2023
* Initial work on custom field choice sets

* Rename choices to extra_choices (prep for #12194)

* Remove CustomField.choices

* Add & update tests

* Clean up table columns

* Add order_alphanetically boolean for choice sets

* Introduce ArrayColumn for choice lists

* Show dependent custom fields on choice set view

* Update custom fields documentation

* Introduce ArrayWidget for more convenient editing of choices

* Incorporate PR feedback

* Misc cleanup

* Initial work on predefined choices for custom fields

* Misc cleanup

* Add IATA airport codes

* #13241: Add support for custom field choice labels

* Restore ArrayColumn

* Misc cleanup

* Change extra_choices back to a nested ArrayField to preserve choice ordering

* Hack to bypass GraphQL API test utility absent support for nested ArrayFields
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

3 participants