mirror of
https://github.com/netbox-community/netbox.git
synced 2026-02-05 23:06:25 -06:00
Update GraphQL types & filters
This commit is contained in:
@@ -6,7 +6,7 @@ import strawberry_django
|
|||||||
from strawberry.scalars import ID
|
from strawberry.scalars import ID
|
||||||
from strawberry_django import BaseFilterLookup, ComparisonFilterLookup, FilterLookup
|
from strawberry_django import BaseFilterLookup, ComparisonFilterLookup, FilterLookup
|
||||||
|
|
||||||
from core.graphql.filter_mixins import ChangeLogFilterMixin
|
from core.graphql.filter_mixins import BaseObjectTypeFilterMixin, ChangeLogFilterMixin
|
||||||
from dcim import models
|
from dcim import models
|
||||||
from dcim.constants import *
|
from dcim.constants import *
|
||||||
from dcim.graphql.enums import InterfaceKindEnum
|
from dcim.graphql.enums import InterfaceKindEnum
|
||||||
@@ -75,6 +75,8 @@ __all__ = (
|
|||||||
'ModuleTypeFilter',
|
'ModuleTypeFilter',
|
||||||
'ModuleTypeProfileFilter',
|
'ModuleTypeProfileFilter',
|
||||||
'PlatformFilter',
|
'PlatformFilter',
|
||||||
|
'PortMappingFilter',
|
||||||
|
'PortTemplateMappingFilter',
|
||||||
'PowerFeedFilter',
|
'PowerFeedFilter',
|
||||||
'PowerOutletFilter',
|
'PowerOutletFilter',
|
||||||
'PowerOutletTemplateFilter',
|
'PowerOutletTemplateFilter',
|
||||||
@@ -409,9 +411,6 @@ class FrontPortFilter(ModularComponentModelFilterMixin, CabledObjectModelFilterM
|
|||||||
color: BaseFilterLookup[Annotated['ColorEnum', strawberry.lazy('netbox.graphql.enums')]] | None = (
|
color: BaseFilterLookup[Annotated['ColorEnum', strawberry.lazy('netbox.graphql.enums')]] | None = (
|
||||||
strawberry_django.filter_field()
|
strawberry_django.filter_field()
|
||||||
)
|
)
|
||||||
rear_ports: Annotated['RearPortFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
|
||||||
strawberry_django.filter_field()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.filter_type(models.FrontPortTemplate, lookups=True)
|
@strawberry_django.filter_type(models.FrontPortTemplate, lookups=True)
|
||||||
@@ -422,9 +421,37 @@ class FrontPortTemplateFilter(ModularComponentTemplateFilterMixin):
|
|||||||
color: BaseFilterLookup[Annotated['ColorEnum', strawberry.lazy('netbox.graphql.enums')]] | None = (
|
color: BaseFilterLookup[Annotated['ColorEnum', strawberry.lazy('netbox.graphql.enums')]] | None = (
|
||||||
strawberry_django.filter_field()
|
strawberry_django.filter_field()
|
||||||
)
|
)
|
||||||
rear_ports: Annotated['RearPortTemplateFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
|
||||||
|
|
||||||
|
@strawberry_django.filter_type(models.PortMapping, lookups=True)
|
||||||
|
class PortMappingFilter(BaseObjectTypeFilterMixin):
|
||||||
|
device: Annotated['DeviceFilter', strawberry.lazy('dcim.graphql.filters')] | None = strawberry_django.filter_field()
|
||||||
|
front_port: Annotated['FrontPortFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
strawberry_django.filter_field()
|
strawberry_django.filter_field()
|
||||||
)
|
)
|
||||||
|
rear_port: Annotated['RearPortFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
|
front_port_position: FilterLookup[int] | None = strawberry_django.filter_field()
|
||||||
|
rear_port_position: FilterLookup[int] | None = strawberry_django.filter_field()
|
||||||
|
|
||||||
|
|
||||||
|
@strawberry_django.filter_type(models.PortTemplateMapping, lookups=True)
|
||||||
|
class PortTemplateMappingFilter(BaseObjectTypeFilterMixin):
|
||||||
|
device_type: Annotated['DeviceTypeFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
|
module_type: Annotated['ModuleTypeFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
|
front_port: Annotated['FrontPortTemplateFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
|
rear_port: Annotated['RearPortTemplateFilter', strawberry.lazy('dcim.graphql.filters')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
|
front_port_position: FilterLookup[int] | None = strawberry_django.filter_field()
|
||||||
|
rear_port_position: FilterLookup[int] | None = strawberry_django.filter_field()
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.filter_type(models.MACAddress, lookups=True)
|
@strawberry_django.filter_type(models.MACAddress, lookups=True)
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ class PlatformType(NestedGroupObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.PortMapping,
|
models.PortMapping,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
# filters=PortMappingFilter,
|
filters=PortMappingFilter,
|
||||||
pagination=True
|
pagination=True
|
||||||
)
|
)
|
||||||
class PortMappingType(ModularComponentTemplateType):
|
class PortMappingType(ModularComponentTemplateType):
|
||||||
@@ -652,12 +652,12 @@ class PortMappingType(ModularComponentTemplateType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.PortTemplateMapping,
|
models.PortTemplateMapping,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
# filters=PortMappingTemplateFilter,
|
filters=PortTemplateMappingFilter,
|
||||||
pagination=True
|
pagination=True
|
||||||
)
|
)
|
||||||
class PortMappingTemplateType(ModularComponentTemplateType):
|
class PortMappingTemplateType(ModularComponentTemplateType):
|
||||||
front_port_template: Annotated["FrontPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
front_port: Annotated["FrontPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
||||||
rear_port_template: Annotated["RearPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
rear_port: Annotated["RearPortTemplateType", strawberry.lazy('dcim.graphql.types')]
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
|||||||
Reference in New Issue
Block a user