mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-10 09:38:15 -06:00
add cursor pagin to interfaces and devices + offset paging to device roles
This commit is contained in:
parent
cca1b0a897
commit
9b7f9c9e28
@ -38,6 +38,8 @@ class DCIMQuery:
|
|||||||
def device(self, id: int) -> DeviceType:
|
def device(self, id: int) -> DeviceType:
|
||||||
return models.Device.objects.get(pk=id)
|
return models.Device.objects.get(pk=id)
|
||||||
device_list: List[DeviceType] = strawberry_django.field()
|
device_list: List[DeviceType] = strawberry_django.field()
|
||||||
|
device_connection: strawberry.relay.ListConnection[DeviceType] = strawberry_django.connection()
|
||||||
|
|
||||||
|
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def device_bay(self, id: int) -> DeviceBayType:
|
def device_bay(self, id: int) -> DeviceBayType:
|
||||||
@ -72,7 +74,7 @@ class DCIMQuery:
|
|||||||
@strawberry.field
|
@strawberry.field
|
||||||
def interface(self, id: int) -> InterfaceType:
|
def interface(self, id: int) -> InterfaceType:
|
||||||
return models.Interface.objects.get(pk=id)
|
return models.Interface.objects.get(pk=id)
|
||||||
interface_list: List[InterfaceType] = strawberry_django.field()
|
interface_list: strawberry.relay.ListConnection[InterfaceType] = strawberry_django.connection()
|
||||||
|
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def interface_template(self, id: int) -> InterfaceTemplateType:
|
def interface_template(self, id: int) -> InterfaceTemplateType:
|
||||||
|
@ -210,7 +210,8 @@ class ConsoleServerPortTemplateType(ModularComponentTemplateType):
|
|||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=DeviceFilter
|
filters=DeviceFilter
|
||||||
)
|
)
|
||||||
class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
|
class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType, strawberry.relay.Node):
|
||||||
|
id: strawberry.relay.GlobalID
|
||||||
_name: str
|
_name: str
|
||||||
console_port_count: BigInt
|
console_port_count: BigInt
|
||||||
console_server_port_count: BigInt
|
console_server_port_count: BigInt
|
||||||
@ -308,7 +309,8 @@ class InventoryItemTemplateType(ComponentTemplateType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.DeviceRole,
|
models.DeviceRole,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=DeviceRoleFilter
|
filters=DeviceRoleFilter,
|
||||||
|
pagination=True
|
||||||
)
|
)
|
||||||
class DeviceRoleType(OrganizationalObjectType):
|
class DeviceRoleType(OrganizationalObjectType):
|
||||||
color: str
|
color: str
|
||||||
@ -378,7 +380,8 @@ class FrontPortTemplateType(ModularComponentTemplateType):
|
|||||||
exclude=('_path',),
|
exclude=('_path',),
|
||||||
filters=InterfaceFilter
|
filters=InterfaceFilter
|
||||||
)
|
)
|
||||||
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin):
|
class InterfaceType(IPAddressesMixin, ModularComponentType, CabledObjectMixin, PathEndpointMixin, strawberry.relay.Node):
|
||||||
|
id: strawberry.relay.GlobalID
|
||||||
mac_address: str | None
|
mac_address: str | None
|
||||||
wwn: str | None
|
wwn: str | None
|
||||||
parent: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
parent: Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')] | None
|
||||||
|
Loading…
Reference in New Issue
Block a user