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

Region slug searchable #1366

Closed
jdecorniquet opened this issue Jul 20, 2017 · 8 comments
Closed

Region slug searchable #1366

jdecorniquet opened this issue Jul 20, 2017 · 8 comments
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@jdecorniquet
Copy link

Issue type: Feature request

Hello, it would be nice to be able to search for a region slug name.

This would come very handy in case one would build a very exhaustive database of countries/provinces/cities in the following parent/child structure:

-parent name (slug)
--child name (slug)
---sub child name (slug)

Example below:

-CA (canada)
--ON (ontario)
---FAL (fort-albany)
-US (usa)
--CA (california)
---ALA (albany)
--NY (new-york)
---ALB (albany)

Having potentially thousands of city per country we could simply search for the word "albany" and see all Region elements matching or containing it. In the example above, we'd have 3 results for showing the region name, the slug and parent if any. An ouput example below as csv format:

FAL,fort-albany,ON
ALA,albany,CA
ALB,albany,NY

Thanks,

@bellwood
Copy link
Contributor

Just as an aside to this, removing slugs from the data model was discussed earlier this year but doesn't seem to have come to a resolve:

https://groups.google.com/forum/#!searchin/netbox-discuss/slug%7Csort:relevance/netbox-discuss/SRVcWLjjoo8/_PccrV4gBwAJ

To your usage case, I agree that having a way to search within regions, especially for larger organizations, would be useful. As an Albany NY resident I approve of your example ;)

@jdecorniquet
Copy link
Author

Thanks for the input @bellwood

Well indeed for all that is related to the Regions, I find slug extremely handy but then again that could just be replaced by a more specific field.

Eitherways, "slug" or "something more specific" does not change the original feature request of this topic. :)

@jeremystretch
Copy link
Member

@jdecorniquet In what context do you mean? What type of object(s) do you want to search for by region slug?

@jdecorniquet
Copy link
Author

@jeremystretch

Well in the current version I use (v2.0.7), Region is not a searchable object yet that precisely the type I'm looking for here.

My use case has the Region's name standing for acronyms of actual cities, and there slug for the full name. Our Site naming convention includes the actual Region's acronym, so the purpose of this feature would be to ease the acronym lookup in order to create a new site.

An example would be one looking for Albany, NY's acronym by querying "albany". One would eventually find the result "ALB,albany,NY" (region name,slug,parent_region_name) and then be able to create a Site named "ALB01" for instance.

In my company's case, we dumped from NATO a complete list of North American cities (official acronym, full name, state, postal etc) and would like to import it all in our Netbox in order to have all information in one place.

I hope this helps.

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application and removed awaiting reply labels Jul 24, 2017
@jeremystretch
Copy link
Member

--CA (california)
---ALA (albany)
--NY (new-york)
---ALB (albany)

Keep in mind that slugs must be unique, so you can't have two regions with the slug "albany." Also, I would suggest swapping the fields. I would define Albany, CA as:

{
    "parent": {...},
    "name": "Albany, CA",
    "slug": "ALA"
}

This ensures that the human-friendly name is always displayed for the region. The name is also currently a unique field, although this example has me considering removing that constraint. I think it'd be reasonable to have two regions named "Albany" (but with unique slugs) since regions are arranged hierarchically (e.g. country > state > city).

@jdecorniquet
Copy link
Author

Side question related to this topic:
Assuming one would have an exhaustive list of Regions, when creating a Site, would the drop down selection for the "Region" field be able to handle the very, very long list?
As in, is there any limitation to that currently?

I'm also considering the hassle of actually looking through that drop down selection to find the exact Region we need, even though that's a necessary evil to my case I believe.

@bdlamprecht
Copy link
Contributor

I'd also like to see the region be searchable as as well.
Currently, I'm testing the same basic hierarchy as @jdecorniquet is for the regions.
In my scenario, the regions (and member sites) are structured as follows:

-Geographical Region
--Country
---City
----Site 1
----Site 2

A real-world example of that would be:

-EMEA
--South Africa
---Johannesburg
----Site X
----Site Z

When fully populated against 500+ regions, the UI for that page is quite large and makes it difficult to find what you're looking for.

@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Jan 26, 2018
@bdlamprecht
Copy link
Contributor

Really looking forward to this addition, thanks Jeremy!

funzoneq added a commit to openfibernet/netbox that referenced this issue Feb 6, 2018
* Fixes netbox-community#1765: Improved rendering of null options for model choice fields in filter forms

* Fixes netbox-community#1802: Typo in ldap.md

* Fixes netbox-community#1621: Tweaked LLDP interface name evaluation logic

* Fixes netbox-community#1807: Populate VRF from parent when creating a new prefix

* Fixes netbox-community#1809: Populate tenant assignment from parent when creating a new prefix

* Closes netbox-community#1824: Add virtual machine count to platforms list

* Fixes netbox-community#1818: InventoryItem API serializer no longer requires specifying a null value for items with no parent

* Evaluate device_id rather than pulling entire device (DB optimization)

* added statement and exaple for using ForeignKey ID's in write actions

* Closes netbox-community#1828: Added warning about media directory permissions

* fixed duplicate api docs example and grammar

* Closes netbox-community#1835: Consistent position of previous/next rack buttons

* Fixes netbox-community#1845: Correct display of VMs in list with no role assigned

* Closes netbox-community#1406: Display tenant description as title text in object tables

* Closes netbox-community#1366: Enable searching for regions by name/slug

* Cleaned up InventoryItem add/edit/delete links and return URL

* Closes netbox-community#1073: Include prefixes/IPs from all VRFs when viewing the children of a container prefix in the global table

* Closes netbox-community#144: Implemented list and bulk edit/delete views for InventoryItems

* Added report results to the home page

* Fixes netbox-community#1850: Fix TypeError when attempting IP address import if only unnamed devices exist

* Added warning message about automatically deleting child inventory items

* Release v.2.2.9
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
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

4 participants