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 filterset field data to uiSchema in REST API for all models with filtersets #4462

Closed
12 tasks
gsnider2195 opened this issue Sep 15, 2023 · 2 comments
Closed
12 tasks
Assignees
Labels
type: feature Introduction of new or enhanced functionality to the application

Comments

@gsnider2195
Copy link
Contributor

gsnider2195 commented Sep 15, 2023

As ...

Cora - Coder

I want ...

To be able to access filterset information in the REST API

So that ...

I can build the dynamic filter form in the Nautobot 2.0 React UI

I know this is done when...

The uiSchema for all models includes a json schema similar to:

{
    "Platform (name or ID)": {
        "filters": [
            {
                "id": "platform",
                "name": "exact"
            },
            {
                "id": "platform__n",
                "name": "not exact (n)"
            }
        ]
    },
    "Is full depth": {
        "filters": [
            {
                "id": "is_full_depth",
                "name": "exact"
            }
        ]
    },
    "Name": {
        "filters": [
            {
                "id": "name__n",
                "name": "not exact (n)"
            },
            {
                "id": "name__ic",
                "name": "contains (ic)"
            },
            {
                "id": "name__nic",
                "name": "not contains (nic)"
            },
            {
                "id": "name__iew",
                "name": "ends with (iew)"
            },
            {
                "id": "name__niew",
                "name": "not ends with (niew)"
            },
            {
                "id": "name__isw",
                "name": "starts with (isw)"
            },
            {
                "id": "name__nisw",
                "name": "not starts with (nisw)"
            },
            {
                "id": "name__ie",
                "name": "exact (ie)"
            },
            {
                "id": "name__nie",
                "name": "not exact (nie)"
            },
            {
                "id": "name__re",
                "name": "matches regex (re)"
            },
            {
                "id": "name__nre",
                "name": "not matches regex (nre)"
            },
            {
                "id": "name__ire",
                "name": "matches regex (ire)"
            },
            {
                "id": "name__nire",
                "name": "not matches regex (nire)"
            }
        ]
    }
}

Where the top level key is the filter label and the value is derived from the filters in the filterset. This will eventually be a consolidation of the functionality already built into the /api/ui/core/filterset-fields/lookup-value-dom-element/ and /api/core/filterset-fields/lookup-choices/ but moving them to the list view OPTIONS request uiSchema key and building the information for the entire filterset by iterating over the FilterSet().filters.keys().

Optional - Feature groups this request pertains to.

  • Automation
  • Circuits
  • DCIM
  • IPAM
  • Misc (including Data Sources)
  • Organization
  • Plugins (and other Extensibility)
  • Security (Secrets, etc)
  • Image Management
  • UI/UX
  • Documentation
  • Other (not directly a platform feature)

Database Changes

No

External Dependencies

No response

@gsnider2195 gsnider2195 added type: feature Introduction of new or enhanced functionality to the application triage This issue is new and has not been reviewed. labels Sep 15, 2023
@bryanculver
Copy link
Member

@bryanculver bryanculver removed the triage This issue is new and has not been reviewed. label Sep 18, 2023
@gsnider2195 gsnider2195 self-assigned this Sep 25, 2023
@gsnider2195
Copy link
Contributor Author

Completed by #4521

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new or enhanced functionality to the application
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants