16244 add pagination

This commit is contained in:
Arthur 2025-03-13 21:57:43 -07:00
parent 03a0b1749c
commit 0754c85715
12 changed files with 213 additions and 201 deletions

View File

@ -8,35 +8,35 @@ from .types import *
@strawberry.type(name="Query")
class CircuitsQuery:
circuit: CircuitType = strawberry_django.field(pagination=True)
circuit_list: List[CircuitType] = strawberry_django.field(pagination=True)
circuit: CircuitType = strawberry_django.field()
circuit_list: List[CircuitType] = strawberry_django.field()
circuit_termination: CircuitTerminationType = strawberry_django.field(pagination=True)
circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field(pagination=True)
circuit_termination: CircuitTerminationType = strawberry_django.field()
circuit_termination_list: List[CircuitTerminationType] = strawberry_django.field()
circuit_type: CircuitTypeType = strawberry_django.field(pagination=True)
circuit_type_list: List[CircuitTypeType] = strawberry_django.field(pagination=True)
circuit_type: CircuitTypeType = strawberry_django.field()
circuit_type_list: List[CircuitTypeType] = strawberry_django.field()
circuit_group: CircuitGroupType = strawberry_django.field(pagination=True)
circuit_group_list: List[CircuitGroupType] = strawberry_django.field(pagination=True)
circuit_group: CircuitGroupType = strawberry_django.field()
circuit_group_list: List[CircuitGroupType] = strawberry_django.field()
circuit_group_assignment: CircuitGroupAssignmentType = strawberry_django.field(pagination=True)
circuit_group_assignment_list: List[CircuitGroupAssignmentType] = strawberry_django.field(pagination=True)
circuit_group_assignment: CircuitGroupAssignmentType = strawberry_django.field()
circuit_group_assignment_list: List[CircuitGroupAssignmentType] = strawberry_django.field()
provider: ProviderType = strawberry_django.field(pagination=True)
provider_list: List[ProviderType] = strawberry_django.field(pagination=True)
provider: ProviderType = strawberry_django.field()
provider_list: List[ProviderType] = strawberry_django.field()
provider_account: ProviderAccountType = strawberry_django.field(pagination=True)
provider_account_list: List[ProviderAccountType] = strawberry_django.field(pagination=True)
provider_account: ProviderAccountType = strawberry_django.field()
provider_account_list: List[ProviderAccountType] = strawberry_django.field()
provider_network: ProviderNetworkType = strawberry_django.field(pagination=True)
provider_network_list: List[ProviderNetworkType] = strawberry_django.field(pagination=True)
provider_network: ProviderNetworkType = strawberry_django.field()
provider_network_list: List[ProviderNetworkType] = strawberry_django.field()
virtual_circuit: VirtualCircuitType = strawberry_django.field(pagination=True)
virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field(pagination=True)
virtual_circuit: VirtualCircuitType = strawberry_django.field()
virtual_circuit_list: List[VirtualCircuitType] = strawberry_django.field()
virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field(pagination=True)
virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field(pagination=True)
virtual_circuit_termination: VirtualCircuitTerminationType = strawberry_django.field()
virtual_circuit_termination_list: List[VirtualCircuitTerminationType] = strawberry_django.field()
virtual_circuit_type: VirtualCircuitTypeType = strawberry_django.field(pagination=True)
virtual_circuit_type_list: List[VirtualCircuitTypeType] = strawberry_django.field(pagination=True)
virtual_circuit_type: VirtualCircuitTypeType = strawberry_django.field()
virtual_circuit_type_list: List[VirtualCircuitTypeType] = strawberry_django.field()

View File

@ -48,7 +48,6 @@ class ProviderType(NetBoxObjectType, ContactsMixin):
fields='__all__',
filters=ProviderAccountFilter,
pagination=True
)
class ProviderAccountType(NetBoxObjectType):
provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
@ -61,7 +60,6 @@ class ProviderAccountType(NetBoxObjectType):
fields='__all__',
filters=ProviderNetworkFilter,
pagination=True
)
class ProviderNetworkType(NetBoxObjectType):
provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
@ -74,7 +72,6 @@ class ProviderNetworkType(NetBoxObjectType):
exclude=['termination_type', 'termination_id', '_location', '_region', '_site', '_site_group', '_provider_network'],
filters=CircuitTerminationFilter,
pagination=True
)
class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, ObjectType):
circuit: Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')]
@ -95,7 +92,6 @@ class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, Ob
fields='__all__',
filters=CircuitTypeFilter,
pagination=True
)
class CircuitTypeType(OrganizationalObjectType):
color: str
@ -108,7 +104,6 @@ class CircuitTypeType(OrganizationalObjectType):
fields='__all__',
filters=CircuitFilter,
pagination=True
)
class CircuitType(NetBoxObjectType, ContactsMixin):
provider: ProviderType
@ -126,7 +121,6 @@ class CircuitType(NetBoxObjectType, ContactsMixin):
fields='__all__',
filters=CircuitGroupFilter,
pagination=True
)
class CircuitGroupType(OrganizationalObjectType):
tenant: TenantType | None
@ -137,7 +131,6 @@ class CircuitGroupType(OrganizationalObjectType):
exclude=['member_type', 'member_id'],
filters=CircuitGroupAssignmentFilter,
pagination=True
)
class CircuitGroupAssignmentType(TagsMixin, BaseObjectType):
group: Annotated["CircuitGroupType", strawberry.lazy('circuits.graphql.types')]
@ -155,7 +148,6 @@ class CircuitGroupAssignmentType(TagsMixin, BaseObjectType):
fields='__all__',
filters=VirtualCircuitTypeFilter,
pagination=True
)
class VirtualCircuitTypeType(OrganizationalObjectType):
color: str
@ -168,7 +160,6 @@ class VirtualCircuitTypeType(OrganizationalObjectType):
fields='__all__',
filters=VirtualCircuitTerminationFilter,
pagination=True
)
class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
virtual_circuit: Annotated[
@ -186,7 +177,6 @@ class VirtualCircuitTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
fields='__all__',
filters=VirtualCircuitFilter,
pagination=True
)
class VirtualCircuitType(NetBoxObjectType):
provider_network: ProviderNetworkType = strawberry_django.field(select_related=["provider_network"])

View File

@ -8,128 +8,128 @@ from .types import *
@strawberry.type(name="Query")
class DCIMQuery:
cable: CableType = strawberry_django.field(pagination=True)
cable_list: List[CableType] = strawberry_django.field(pagination=True)
cable: CableType = strawberry_django.field()
cable_list: List[CableType] = strawberry_django.field()
console_port: ConsolePortType = strawberry_django.field(pagination=True)
console_port_list: List[ConsolePortType] = strawberry_django.field(pagination=True)
console_port: ConsolePortType = strawberry_django.field()
console_port_list: List[ConsolePortType] = strawberry_django.field()
console_port_template: ConsolePortTemplateType = strawberry_django.field(pagination=True)
console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field(pagination=True)
console_port_template: ConsolePortTemplateType = strawberry_django.field()
console_port_template_list: List[ConsolePortTemplateType] = strawberry_django.field()
console_server_port: ConsoleServerPortType = strawberry_django.field(pagination=True)
console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field(pagination=True)
console_server_port: ConsoleServerPortType = strawberry_django.field()
console_server_port_list: List[ConsoleServerPortType] = strawberry_django.field()
console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field(pagination=True)
console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field(pagination=True)
console_server_port_template: ConsoleServerPortTemplateType = strawberry_django.field()
console_server_port_template_list: List[ConsoleServerPortTemplateType] = strawberry_django.field()
device: DeviceType = strawberry_django.field(pagination=True)
device_list: List[DeviceType] = strawberry_django.field(pagination=True)
device: DeviceType = strawberry_django.field()
device_list: List[DeviceType] = strawberry_django.field()
device_bay: DeviceBayType = strawberry_django.field(pagination=True)
device_bay_list: List[DeviceBayType] = strawberry_django.field(pagination=True)
device_bay: DeviceBayType = strawberry_django.field()
device_bay_list: List[DeviceBayType] = strawberry_django.field()
device_bay_template: DeviceBayTemplateType = strawberry_django.field(pagination=True)
device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field(pagination=True)
device_bay_template: DeviceBayTemplateType = strawberry_django.field()
device_bay_template_list: List[DeviceBayTemplateType] = strawberry_django.field()
device_role: DeviceRoleType = strawberry_django.field(pagination=True)
device_role_list: List[DeviceRoleType] = strawberry_django.field(pagination=True)
device_role: DeviceRoleType = strawberry_django.field()
device_role_list: List[DeviceRoleType] = strawberry_django.field()
device_type: DeviceTypeType = strawberry_django.field(pagination=True)
device_type_list: List[DeviceTypeType] = strawberry_django.field(pagination=True)
device_type: DeviceTypeType = strawberry_django.field()
device_type_list: List[DeviceTypeType] = strawberry_django.field()
front_port: FrontPortType = strawberry_django.field(pagination=True)
front_port_list: List[FrontPortType] = strawberry_django.field(pagination=True)
front_port: FrontPortType = strawberry_django.field()
front_port_list: List[FrontPortType] = strawberry_django.field()
front_port_template: FrontPortTemplateType = strawberry_django.field(pagination=True)
front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field(pagination=True)
front_port_template: FrontPortTemplateType = strawberry_django.field()
front_port_template_list: List[FrontPortTemplateType] = strawberry_django.field()
mac_address: MACAddressType = strawberry_django.field(pagination=True)
mac_address_list: List[MACAddressType] = strawberry_django.field(pagination=True)
mac_address: MACAddressType = strawberry_django.field()
mac_address_list: List[MACAddressType] = strawberry_django.field()
interface: InterfaceType = strawberry_django.field(pagination=True)
interface_list: List[InterfaceType] = strawberry_django.field(pagination=True)
interface: InterfaceType = strawberry_django.field()
interface_list: List[InterfaceType] = strawberry_django.field()
interface_template: InterfaceTemplateType = strawberry_django.field(pagination=True)
interface_template_list: List[InterfaceTemplateType] = strawberry_django.field(pagination=True)
interface_template: InterfaceTemplateType = strawberry_django.field()
interface_template_list: List[InterfaceTemplateType] = strawberry_django.field()
inventory_item: InventoryItemType = strawberry_django.field(pagination=True)
inventory_item_list: List[InventoryItemType] = strawberry_django.field(pagination=True)
inventory_item: InventoryItemType = strawberry_django.field()
inventory_item_list: List[InventoryItemType] = strawberry_django.field()
inventory_item_role: InventoryItemRoleType = strawberry_django.field(pagination=True)
inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field(pagination=True)
inventory_item_role: InventoryItemRoleType = strawberry_django.field()
inventory_item_role_list: List[InventoryItemRoleType] = strawberry_django.field()
inventory_item_template: InventoryItemTemplateType = strawberry_django.field(pagination=True)
inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field(pagination=True)
inventory_item_template: InventoryItemTemplateType = strawberry_django.field()
inventory_item_template_list: List[InventoryItemTemplateType] = strawberry_django.field()
location: LocationType = strawberry_django.field(pagination=True)
location_list: List[LocationType] = strawberry_django.field(pagination=True)
location: LocationType = strawberry_django.field()
location_list: List[LocationType] = strawberry_django.field()
manufacturer: ManufacturerType = strawberry_django.field(pagination=True)
manufacturer_list: List[ManufacturerType] = strawberry_django.field(pagination=True)
manufacturer: ManufacturerType = strawberry_django.field()
manufacturer_list: List[ManufacturerType] = strawberry_django.field()
module: ModuleType = strawberry_django.field(pagination=True)
module_list: List[ModuleType] = strawberry_django.field(pagination=True)
module: ModuleType = strawberry_django.field()
module_list: List[ModuleType] = strawberry_django.field()
module_bay: ModuleBayType = strawberry_django.field(pagination=True)
module_bay_list: List[ModuleBayType] = strawberry_django.field(pagination=True)
module_bay: ModuleBayType = strawberry_django.field()
module_bay_list: List[ModuleBayType] = strawberry_django.field()
module_bay_template: ModuleBayTemplateType = strawberry_django.field(pagination=True)
module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field(pagination=True)
module_bay_template: ModuleBayTemplateType = strawberry_django.field()
module_bay_template_list: List[ModuleBayTemplateType] = strawberry_django.field()
module_type: ModuleTypeType = strawberry_django.field(pagination=True)
module_type_list: List[ModuleTypeType] = strawberry_django.field(pagination=True)
module_type: ModuleTypeType = strawberry_django.field()
module_type_list: List[ModuleTypeType] = strawberry_django.field()
platform: PlatformType = strawberry_django.field(pagination=True)
platform_list: List[PlatformType] = strawberry_django.field(pagination=True)
platform: PlatformType = strawberry_django.field()
platform_list: List[PlatformType] = strawberry_django.field()
power_feed: PowerFeedType = strawberry_django.field(pagination=True)
power_feed_list: List[PowerFeedType] = strawberry_django.field(pagination=True)
power_feed: PowerFeedType = strawberry_django.field()
power_feed_list: List[PowerFeedType] = strawberry_django.field()
power_outlet: PowerOutletType = strawberry_django.field(pagination=True)
power_outlet_list: List[PowerOutletType] = strawberry_django.field(pagination=True)
power_outlet: PowerOutletType = strawberry_django.field()
power_outlet_list: List[PowerOutletType] = strawberry_django.field()
power_outlet_template: PowerOutletTemplateType = strawberry_django.field(pagination=True)
power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field(pagination=True)
power_outlet_template: PowerOutletTemplateType = strawberry_django.field()
power_outlet_template_list: List[PowerOutletTemplateType] = strawberry_django.field()
power_panel: PowerPanelType = strawberry_django.field(pagination=True)
power_panel_list: List[PowerPanelType] = strawberry_django.field(pagination=True)
power_panel: PowerPanelType = strawberry_django.field()
power_panel_list: List[PowerPanelType] = strawberry_django.field()
power_port: PowerPortType = strawberry_django.field(pagination=True)
power_port_list: List[PowerPortType] = strawberry_django.field(pagination=True)
power_port: PowerPortType = strawberry_django.field()
power_port_list: List[PowerPortType] = strawberry_django.field()
power_port_template: PowerPortTemplateType = strawberry_django.field(pagination=True)
power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field(pagination=True)
power_port_template: PowerPortTemplateType = strawberry_django.field()
power_port_template_list: List[PowerPortTemplateType] = strawberry_django.field()
rack_type: RackTypeType = strawberry_django.field(pagination=True)
rack_type_list: List[RackTypeType] = strawberry_django.field(pagination=True)
rack_type: RackTypeType = strawberry_django.field()
rack_type_list: List[RackTypeType] = strawberry_django.field()
rack: RackType = strawberry_django.field(pagination=True)
rack_list: List[RackType] = strawberry_django.field(pagination=True)
rack: RackType = strawberry_django.field()
rack_list: List[RackType] = strawberry_django.field()
rack_reservation: RackReservationType = strawberry_django.field(pagination=True)
rack_reservation_list: List[RackReservationType] = strawberry_django.field(pagination=True)
rack_reservation: RackReservationType = strawberry_django.field()
rack_reservation_list: List[RackReservationType] = strawberry_django.field()
rack_role: RackRoleType = strawberry_django.field(pagination=True)
rack_role_list: List[RackRoleType] = strawberry_django.field(pagination=True)
rack_role: RackRoleType = strawberry_django.field()
rack_role_list: List[RackRoleType] = strawberry_django.field()
rear_port: RearPortType = strawberry_django.field(pagination=True)
rear_port_list: List[RearPortType] = strawberry_django.field(pagination=True)
rear_port: RearPortType = strawberry_django.field()
rear_port_list: List[RearPortType] = strawberry_django.field()
rear_port_template: RearPortTemplateType = strawberry_django.field(pagination=True)
rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field(pagination=True)
rear_port_template: RearPortTemplateType = strawberry_django.field()
rear_port_template_list: List[RearPortTemplateType] = strawberry_django.field()
region: RegionType = strawberry_django.field(pagination=True)
region_list: List[RegionType] = strawberry_django.field(pagination=True)
region: RegionType = strawberry_django.field()
region_list: List[RegionType] = strawberry_django.field()
site: SiteType = strawberry_django.field(pagination=True)
site_list: List[SiteType] = strawberry_django.field(pagination=True)
site: SiteType = strawberry_django.field()
site_list: List[SiteType] = strawberry_django.field()
site_group: SiteGroupType = strawberry_django.field(pagination=True)
site_group_list: List[SiteGroupType] = strawberry_django.field(pagination=True)
site_group: SiteGroupType = strawberry_django.field()
site_group_list: List[SiteGroupType] = strawberry_django.field()
virtual_chassis: VirtualChassisType = strawberry_django.field(pagination=True)
virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field(pagination=True)
virtual_chassis: VirtualChassisType = strawberry_django.field()
virtual_chassis_list: List[VirtualChassisType] = strawberry_django.field()
virtual_device_context: VirtualDeviceContextType = strawberry_django.field(pagination=True)
virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field(pagination=True)
virtual_device_context: VirtualDeviceContextType = strawberry_django.field()
virtual_device_context_list: List[VirtualDeviceContextType] = strawberry_django.field()

View File

@ -135,7 +135,6 @@ class ModularComponentTemplateType(ComponentTemplateType):
exclude=['termination_type', 'termination_id', '_device', '_rack', '_location', '_site'],
filters=CableTerminationFilter,
pagination=True
)
class CableTerminationType(NetBoxObjectType):
cable: Annotated["CableType", strawberry.lazy('dcim.graphql.types')] | None
@ -157,7 +156,6 @@ class CableTerminationType(NetBoxObjectType):
fields='__all__',
filters=CableFilter,
pagination=True
)
class CableType(NetBoxObjectType):
color: str
@ -195,7 +193,6 @@ class CableType(NetBoxObjectType):
exclude=['_path'],
filters=ConsolePortFilter,
pagination=True
)
class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
pass
@ -206,7 +203,6 @@ class ConsolePortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin
fields='__all__',
filters=ConsolePortTemplateFilter,
pagination=True
)
class ConsolePortTemplateType(ModularComponentTemplateType):
pass
@ -217,7 +213,6 @@ class ConsolePortTemplateType(ModularComponentTemplateType):
exclude=['_path'],
filters=ConsoleServerPortFilter,
pagination=True
)
class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
pass
@ -228,7 +223,6 @@ class ConsoleServerPortType(ModularComponentType, CabledObjectMixin, PathEndpoin
fields='__all__',
filters=ConsoleServerPortTemplateFilter,
pagination=True
)
class ConsoleServerPortTemplateType(ModularComponentTemplateType):
pass
@ -239,7 +233,6 @@ class ConsoleServerPortTemplateType(ModularComponentTemplateType):
fields='__all__',
filters=DeviceFilter,
pagination=True
)
class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
console_port_count: BigInt
@ -296,7 +289,6 @@ class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBo
fields='__all__',
filters=DeviceBayFilter,
pagination=True
)
class DeviceBayType(ComponentType):
installed_device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None
@ -307,7 +299,6 @@ class DeviceBayType(ComponentType):
fields='__all__',
filters=DeviceBayTemplateFilter,
pagination=True
)
class DeviceBayTemplateType(ComponentTemplateType):
pass
@ -318,7 +309,6 @@ class DeviceBayTemplateType(ComponentTemplateType):
exclude=['component_type', 'component_id', 'parent'],
filters=InventoryItemTemplateFilter,
pagination=True
)
class InventoryItemTemplateType(ComponentTemplateType):
role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None
@ -346,7 +336,6 @@ class InventoryItemTemplateType(ComponentTemplateType):
fields='__all__',
filters=DeviceRoleFilter,
pagination=True
)
class DeviceRoleType(OrganizationalObjectType):
color: str
@ -361,7 +350,6 @@ class DeviceRoleType(OrganizationalObjectType):
fields='__all__',
filters=DeviceTypeFilter,
pagination=True
)
class DeviceTypeType(NetBoxObjectType):
console_port_template_count: BigInt
@ -397,7 +385,6 @@ class DeviceTypeType(NetBoxObjectType):
fields='__all__',
filters=FrontPortFilter,
pagination=True
)
class FrontPortType(ModularComponentType, CabledObjectMixin):
color: str
@ -409,7 +396,6 @@ class FrontPortType(ModularComponentType, CabledObjectMixin):
fields='__all__',
filters=FrontPortTemplateFilter,
pagination=True
)
class FrontPortTemplateType(ModularComponentTemplateType):
color: str
@ -421,7 +407,6 @@ class FrontPortTemplateType(ModularComponentTemplateType):
exclude=['assigned_object_type', 'assigned_object_id'],
filters=MACAddressFilter,
pagination=True
)
class MACAddressType(NetBoxObjectType):
mac_address: str
@ -439,7 +424,6 @@ class MACAddressType(NetBoxObjectType):
exclude=['_path'],
filters=InterfaceFilter,
pagination=True
)
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin):
_name: str
@ -482,7 +466,6 @@ class InterfaceTemplateType(ModularComponentTemplateType):
exclude=['component_type', 'component_id', 'parent'],
filters=InventoryItemFilter,
pagination=True
)
class InventoryItemType(ComponentType):
role: Annotated["InventoryItemRoleType", strawberry.lazy('dcim.graphql.types')] | None
@ -510,7 +493,6 @@ class InventoryItemType(ComponentType):
fields='__all__',
filters=InventoryItemRoleFilter,
pagination=True
)
class InventoryItemRoleType(OrganizationalObjectType):
color: str
@ -525,7 +507,6 @@ class InventoryItemRoleType(OrganizationalObjectType):
exclude=['parent'], # bug - temp
filters=LocationFilter,
pagination=True
)
class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, OrganizationalObjectType):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -554,7 +535,6 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi
fields='__all__',
filters=ManufacturerFilter,
pagination=True
)
class ManufacturerType(OrganizationalObjectType, ContactsMixin):
@ -570,7 +550,6 @@ class ManufacturerType(OrganizationalObjectType, ContactsMixin):
fields='__all__',
filters=ModuleFilter,
pagination=True
)
class ModuleType(NetBoxObjectType):
device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]
@ -592,7 +571,6 @@ class ModuleType(NetBoxObjectType):
exclude=['parent'],
filters=ModuleBayFilter,
pagination=True
)
class ModuleBayType(ModularComponentType):
@ -609,7 +587,6 @@ class ModuleBayType(ModularComponentType):
fields='__all__',
filters=ModuleBayTemplateFilter,
pagination=True
)
class ModuleBayTemplateType(ModularComponentTemplateType):
pass
@ -620,7 +597,6 @@ class ModuleBayTemplateType(ModularComponentTemplateType):
fields='__all__',
filters=ModuleTypeFilter,
pagination=True
)
class ModuleTypeType(NetBoxObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
@ -640,7 +616,6 @@ class ModuleTypeType(NetBoxObjectType):
fields='__all__',
filters=PlatformFilter,
pagination=True
)
class PlatformType(OrganizationalObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')] | None
@ -655,7 +630,6 @@ class PlatformType(OrganizationalObjectType):
exclude=['_path'],
filters=PowerFeedFilter,
pagination=True
)
class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin):
power_panel: Annotated["PowerPanelType", strawberry.lazy('dcim.graphql.types')]
@ -668,7 +642,6 @@ class PowerFeedType(NetBoxObjectType, CabledObjectMixin, PathEndpointMixin):
exclude=['_path'],
filters=PowerOutletFilter,
pagination=True
)
class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
power_port: Annotated["PowerPortType", strawberry.lazy('dcim.graphql.types')] | None
@ -680,7 +653,6 @@ class PowerOutletType(ModularComponentType, CabledObjectMixin, PathEndpointMixin
fields='__all__',
filters=PowerOutletTemplateFilter,
pagination=True
)
class PowerOutletTemplateType(ModularComponentTemplateType):
power_port: Annotated["PowerPortTemplateType", strawberry.lazy('dcim.graphql.types')] | None
@ -691,7 +663,6 @@ class PowerOutletTemplateType(ModularComponentTemplateType):
fields='__all__',
filters=PowerPanelFilter,
pagination=True
)
class PowerPanelType(NetBoxObjectType, ContactsMixin):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -705,7 +676,6 @@ class PowerPanelType(NetBoxObjectType, ContactsMixin):
exclude=['_path'],
filters=PowerPortFilter,
pagination=True
)
class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
@ -717,7 +687,6 @@ class PowerPortType(ModularComponentType, CabledObjectMixin, PathEndpointMixin):
fields='__all__',
filters=PowerPortTemplateFilter,
pagination=True
)
class PowerPortTemplateType(ModularComponentTemplateType):
poweroutlet_templates: List[Annotated["PowerOutletTemplateType", strawberry.lazy('dcim.graphql.types')]]
@ -728,7 +697,6 @@ class PowerPortTemplateType(ModularComponentTemplateType):
fields='__all__',
filters=RackTypeFilter,
pagination=True
)
class RackTypeType(NetBoxObjectType):
manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
@ -739,7 +707,6 @@ class RackTypeType(NetBoxObjectType):
fields='__all__',
filters=RackFilter,
pagination=True
)
class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
site: Annotated["SiteType", strawberry.lazy('dcim.graphql.types')]
@ -759,7 +726,6 @@ class RackType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje
fields='__all__',
filters=RackReservationFilter,
pagination=True
)
class RackReservationType(NetBoxObjectType):
units: List[int]
@ -773,7 +739,6 @@ class RackReservationType(NetBoxObjectType):
fields='__all__',
filters=RackRoleFilter,
pagination=True
)
class RackRoleType(OrganizationalObjectType):
color: str
@ -786,7 +751,6 @@ class RackRoleType(OrganizationalObjectType):
fields='__all__',
filters=RearPortFilter,
pagination=True
)
class RearPortType(ModularComponentType, CabledObjectMixin):
color: str
@ -799,7 +763,6 @@ class RearPortType(ModularComponentType, CabledObjectMixin):
fields='__all__',
filters=RearPortTemplateFilter,
pagination=True
)
class RearPortTemplateType(ModularComponentTemplateType):
color: str
@ -812,7 +775,6 @@ class RearPortTemplateType(ModularComponentTemplateType):
exclude=['parent'],
filters=RegionFilter,
pagination=True
)
class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
@ -839,7 +801,6 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
fields='__all__',
filters=SiteFilter,
pagination=True
)
class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
time_zone: str | None
@ -875,7 +836,6 @@ class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObje
exclude=['parent'], # bug - temp
filters=SiteGroupFilter,
pagination=True
)
class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
@ -902,7 +862,6 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
fields='__all__',
filters=VirtualChassisFilter,
pagination=True
)
class VirtualChassisType(NetBoxObjectType):
member_count: BigInt
@ -916,7 +875,6 @@ class VirtualChassisType(NetBoxObjectType):
fields='__all__',
filters=VirtualDeviceContextFilter,
pagination=True
)
class VirtualDeviceContextType(NetBoxObjectType):
device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None

View File

@ -46,7 +46,8 @@ __all__ = (
@strawberry_django.type(
models.ConfigContext,
fields='__all__',
filters=ConfigContextFilter
filters=ConfigContextFilter,
pagination=True
)
class ConfigContextType(ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -69,7 +70,8 @@ class ConfigContextType(ObjectType):
@strawberry_django.type(
models.ConfigTemplate,
fields='__all__',
filters=ConfigTemplateFilter
filters=ConfigTemplateFilter,
pagination=True
)
class ConfigTemplateType(TagsMixin, ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -84,7 +86,8 @@ class ConfigTemplateType(TagsMixin, ObjectType):
@strawberry_django.type(
models.CustomField,
fields='__all__',
filters=CustomFieldFilter
filters=CustomFieldFilter,
pagination=True
)
class CustomFieldType(ObjectType):
related_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -94,7 +97,8 @@ class CustomFieldType(ObjectType):
@strawberry_django.type(
models.CustomFieldChoiceSet,
exclude=['extra_choices'],
filters=CustomFieldChoiceSetFilter
filters=CustomFieldChoiceSetFilter,
pagination=True
)
class CustomFieldChoiceSetType(ObjectType):
@ -105,7 +109,8 @@ class CustomFieldChoiceSetType(ObjectType):
@strawberry_django.type(
models.CustomLink,
fields='__all__',
filters=CustomLinkFilter
filters=CustomLinkFilter,
pagination=True
)
class CustomLinkType(ObjectType):
pass
@ -114,7 +119,8 @@ class CustomLinkType(ObjectType):
@strawberry_django.type(
models.ExportTemplate,
fields='__all__',
filters=ExportTemplateFilter
filters=ExportTemplateFilter,
pagination=True
)
class ExportTemplateType(ObjectType):
data_source: Annotated["DataSourceType", strawberry.lazy('core.graphql.types')] | None
@ -124,7 +130,8 @@ class ExportTemplateType(ObjectType):
@strawberry_django.type(
models.ImageAttachment,
fields='__all__',
filters=ImageAttachmentFilter
filters=ImageAttachmentFilter,
pagination=True
)
class ImageAttachmentType(BaseObjectType):
object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -133,7 +140,8 @@ class ImageAttachmentType(BaseObjectType):
@strawberry_django.type(
models.JournalEntry,
fields='__all__',
filters=JournalEntryFilter
filters=JournalEntryFilter,
pagination=True
)
class JournalEntryType(CustomFieldsMixin, TagsMixin, ObjectType):
assigned_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None
@ -150,7 +158,8 @@ class NotificationType(ObjectType):
@strawberry_django.type(
models.NotificationGroup,
filters=NotificationGroupFilter
filters=NotificationGroupFilter,
pagination=True
)
class NotificationGroupType(ObjectType):
users: List[Annotated["UserType", strawberry.lazy('users.graphql.types')]]
@ -160,7 +169,8 @@ class NotificationGroupType(ObjectType):
@strawberry_django.type(
models.SavedFilter,
exclude=['content_types',],
filters=SavedFilterFilter
filters=SavedFilterFilter,
pagination=True
)
class SavedFilterType(ObjectType):
user: Annotated["UserType", strawberry.lazy('users.graphql.types')] | None
@ -177,7 +187,8 @@ class SubscriptionType(ObjectType):
@strawberry_django.type(
models.Tag,
exclude=['extras_taggeditem_items', ],
filters=TagFilter
filters=TagFilter,
pagination=True
)
class TagType(ObjectType):
color: str
@ -188,7 +199,8 @@ class TagType(ObjectType):
@strawberry_django.type(
models.Webhook,
exclude=['content_types',],
filters=WebhookFilter
filters=WebhookFilter,
pagination=True
)
class WebhookType(OrganizationalObjectType):
pass
@ -197,7 +209,8 @@ class WebhookType(OrganizationalObjectType):
@strawberry_django.type(
models.EventRule,
exclude=['content_types',],
filters=EventRuleFilter
filters=EventRuleFilter,
pagination=True
)
class EventRuleType(OrganizationalObjectType):
action_object_type: Annotated["ContentTypeType", strawberry.lazy('netbox.graphql.types')] | None

View File

@ -145,7 +145,6 @@ class FHRPGroupAssignmentType(BaseObjectType):
exclude=['assigned_object_type', 'assigned_object_id', 'address'],
filters=IPAddressFilter,
pagination=True
)
class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
address: str
@ -354,7 +353,8 @@ class VLANTranslationRuleType(NetBoxObjectType):
@strawberry_django.type(
models.VRF,
fields='__all__',
filters=VRFFilter
filters=VRFFilter,
pagination=True
)
class VRFType(NetBoxObjectType):
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None

View File

@ -788,7 +788,7 @@ LOCALE_PATHS = (
STRAWBERRY_DJANGO = {
"DEFAULT_PK_FIELD_NAME": "id",
"TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING": True,
"PAGINATION_DEFAULT_LIMIT": 11,
"PAGINATION_DEFAULT_LIMIT": 100,
}
#

View File

@ -52,7 +52,12 @@ __all__ = (
#
@strawberry_django.type(models.Tenant, fields='__all__', filters=TenantFilter)
@strawberry_django.type(
models.Tenant,
fields='__all__',
filters=TenantFilter,
pagination=True
)
class TenantType(NetBoxObjectType):
group: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None
contacts: List[Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')]]
@ -82,7 +87,12 @@ class TenantType(NetBoxObjectType):
l2vpns: List[Annotated['L2VPNType', strawberry.lazy('vpn.graphql.types')]]
@strawberry_django.type(models.TenantGroup, fields='__all__', filters=TenantGroupFilter)
@strawberry_django.type(
models.TenantGroup,
fields='__all__',
filters=TenantGroupFilter,
pagination=True
)
class TenantGroupType(OrganizationalObjectType):
parent: Annotated['TenantGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@ -95,17 +105,32 @@ class TenantGroupType(OrganizationalObjectType):
#
@strawberry_django.type(models.Contact, fields='__all__', filters=ContactFilter)
@strawberry_django.type(
models.Contact,
fields='__all__',
filters=ContactFilter,
pagination=True
)
class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
group: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@strawberry_django.type(models.ContactRole, fields='__all__', filters=ContactRoleFilter)
@strawberry_django.type(
models.ContactRole,
fields='__all__',
filters=ContactRoleFilter,
pagination=True
)
class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
pass
@strawberry_django.type(models.ContactGroup, fields='__all__', filters=ContactGroupFilter)
@strawberry_django.type(
models.ContactGroup,
fields='__all__',
filters=ContactGroupFilter,
pagination=True
)
class ContactGroupType(OrganizationalObjectType):
parent: Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')] | None
@ -113,7 +138,12 @@ class ContactGroupType(OrganizationalObjectType):
children: List[Annotated['ContactGroupType', strawberry.lazy('tenancy.graphql.types')]]
@strawberry_django.type(models.ContactAssignment, fields='__all__', filters=ContactAssignmentFilter)
@strawberry_django.type(
models.ContactAssignment,
fields='__all__',
filters=ContactAssignmentFilter,
pagination=True
)
class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType):
object_type: Annotated['ContentTypeType', strawberry.lazy('netbox.graphql.types')] | None
contact: Annotated['ContactType', strawberry.lazy('tenancy.graphql.types')] | None

View File

@ -15,7 +15,8 @@ __all__ = (
@strawberry_django.type(
Group,
fields=['id', 'name'],
filters=GroupFilter
filters=GroupFilter,
pagination=True
)
class GroupType(BaseObjectType):
pass
@ -26,7 +27,8 @@ class GroupType(BaseObjectType):
fields=[
'id', 'username', 'first_name', 'last_name', 'email', 'is_staff', 'is_active', 'date_joined', 'groups',
],
filters=UserFilter
filters=UserFilter,
pagination=True
)
class UserType(BaseObjectType):
groups: List[GroupType]

View File

@ -46,7 +46,8 @@ class ComponentType(NetBoxObjectType):
@strawberry_django.type(
models.Cluster,
exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'],
filters=ClusterFilter
filters=ClusterFilter,
pagination=True
)
class ClusterType(VLANGroupsMixin, NetBoxObjectType):
type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None
@ -68,7 +69,8 @@ class ClusterType(VLANGroupsMixin, NetBoxObjectType):
@strawberry_django.type(
models.ClusterGroup,
fields='__all__',
filters=ClusterGroupFilter
filters=ClusterGroupFilter,
pagination=True
)
class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType):
@ -78,7 +80,8 @@ class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType):
@strawberry_django.type(
models.ClusterType,
fields='__all__',
filters=ClusterTypeFilter
filters=ClusterTypeFilter,
pagination=True
)
class ClusterTypeType(OrganizationalObjectType):
@ -88,7 +91,8 @@ class ClusterTypeType(OrganizationalObjectType):
@strawberry_django.type(
models.VirtualMachine,
fields='__all__',
filters=VirtualMachineFilter
filters=VirtualMachineFilter,
pagination=True
)
class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType):
interface_count: BigInt
@ -112,7 +116,8 @@ class VirtualMachineType(ConfigContextMixin, ContactsMixin, NetBoxObjectType):
@strawberry_django.type(
models.VMInterface,
fields='__all__',
filters=VMInterfaceFilter
filters=VMInterfaceFilter,
pagination=True
)
class VMInterfaceType(IPAddressesMixin, ComponentType):
_name: str
@ -134,7 +139,8 @@ class VMInterfaceType(IPAddressesMixin, ComponentType):
@strawberry_django.type(
models.VirtualDisk,
fields='__all__',
filters=VirtualDiskFilter
filters=VirtualDiskFilter,
pagination=True
)
class VirtualDiskType(ComponentType):
pass

View File

@ -32,7 +32,8 @@ __all__ = (
@strawberry_django.type(
models.TunnelGroup,
fields='__all__',
filters=TunnelGroupFilter
filters=TunnelGroupFilter,
pagination=True
)
class TunnelGroupType(OrganizationalObjectType):
@ -42,7 +43,8 @@ class TunnelGroupType(OrganizationalObjectType):
@strawberry_django.type(
models.TunnelTermination,
fields='__all__',
filters=TunnelTerminationFilter
filters=TunnelTerminationFilter,
pagination=True
)
class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
tunnel: Annotated["TunnelType", strawberry.lazy('vpn.graphql.types')]
@ -53,7 +55,8 @@ class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
@strawberry_django.type(
models.Tunnel,
fields='__all__',
filters=TunnelFilter
filters=TunnelFilter,
pagination=True
)
class TunnelType(NetBoxObjectType):
group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None
@ -66,7 +69,8 @@ class TunnelType(NetBoxObjectType):
@strawberry_django.type(
models.IKEProposal,
fields='__all__',
filters=IKEProposalFilter
filters=IKEProposalFilter,
pagination=True
)
class IKEProposalType(OrganizationalObjectType):
@ -76,7 +80,8 @@ class IKEProposalType(OrganizationalObjectType):
@strawberry_django.type(
models.IKEPolicy,
fields='__all__',
filters=IKEPolicyFilter
filters=IKEPolicyFilter,
pagination=True
)
class IKEPolicyType(OrganizationalObjectType):
@ -87,7 +92,8 @@ class IKEPolicyType(OrganizationalObjectType):
@strawberry_django.type(
models.IPSecProposal,
fields='__all__',
filters=IPSecProposalFilter
filters=IPSecProposalFilter,
pagination=True
)
class IPSecProposalType(OrganizationalObjectType):
@ -97,7 +103,8 @@ class IPSecProposalType(OrganizationalObjectType):
@strawberry_django.type(
models.IPSecPolicy,
fields='__all__',
filters=IPSecPolicyFilter
filters=IPSecPolicyFilter,
pagination=True
)
class IPSecPolicyType(OrganizationalObjectType):
@ -108,7 +115,8 @@ class IPSecPolicyType(OrganizationalObjectType):
@strawberry_django.type(
models.IPSecProfile,
fields='__all__',
filters=IPSecProfileFilter
filters=IPSecProfileFilter,
pagination=True
)
class IPSecProfileType(OrganizationalObjectType):
ike_policy: Annotated["IKEPolicyType", strawberry.lazy('vpn.graphql.types')]
@ -120,7 +128,8 @@ class IPSecProfileType(OrganizationalObjectType):
@strawberry_django.type(
models.L2VPN,
fields='__all__',
filters=L2VPNFilter
filters=L2VPNFilter,
pagination=True
)
class L2VPNType(ContactsMixin, NetBoxObjectType):
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@ -133,7 +142,8 @@ class L2VPNType(ContactsMixin, NetBoxObjectType):
@strawberry_django.type(
models.L2VPNTermination,
exclude=['assigned_object_type', 'assigned_object_id'],
filters=L2VPNTerminationFilter
filters=L2VPNTerminationFilter,
pagination=True
)
class L2VPNTerminationType(NetBoxObjectType):
l2vpn: Annotated["L2VPNType", strawberry.lazy('vpn.graphql.types')]

View File

@ -22,7 +22,8 @@ __all__ = (
@strawberry_django.type(
models.WirelessLANGroup,
fields='__all__',
filters=WirelessLANGroupFilter
filters=WirelessLANGroupFilter,
pagination=True
)
class WirelessLANGroupType(OrganizationalObjectType):
parent: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None
@ -34,7 +35,8 @@ class WirelessLANGroupType(OrganizationalObjectType):
@strawberry_django.type(
models.WirelessLAN,
exclude=['scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'],
filters=WirelessLANFilter
filters=WirelessLANFilter,
pagination=True
)
class WirelessLANType(NetBoxObjectType):
group: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None
@ -56,7 +58,8 @@ class WirelessLANType(NetBoxObjectType):
@strawberry_django.type(
models.WirelessLink,
fields='__all__',
filters=WirelessLinkFilter
filters=WirelessLinkFilter,
pagination=True
)
class WirelessLinkType(NetBoxObjectType):
interface_a: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]