mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
9856 update strawberry types
This commit is contained in:
parent
663af64ec1
commit
fb4d63f8a2
@ -1,7 +1,7 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
import strawberry_django
|
import strawberry_django
|
||||||
|
|
||||||
from circuits import filtersets, models
|
from circuits import models
|
||||||
from dcim.graphql.mixins import CabledObjectMixin
|
from dcim.graphql.mixins import CabledObjectMixin
|
||||||
from extras.graphql.mixins import CustomFieldsMixin, TagsMixin, ContactsMixin
|
from extras.graphql.mixins import CustomFieldsMixin, TagsMixin, ContactsMixin
|
||||||
from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObjectType
|
from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObjectType
|
||||||
|
@ -94,8 +94,8 @@ class ComponentTemplateObjectType(
|
|||||||
filters=CableFilter
|
filters=CableFilter
|
||||||
)
|
)
|
||||||
class CableType(NetBoxObjectType):
|
class CableType(NetBoxObjectType):
|
||||||
a_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
# a_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
||||||
b_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
# b_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Cable
|
model = models.Cable
|
||||||
@ -121,7 +121,8 @@ class CableType(NetBoxObjectType):
|
|||||||
filters=CableTerminationFilter
|
filters=CableTerminationFilter
|
||||||
)
|
)
|
||||||
class CableTerminationType(NetBoxObjectType):
|
class CableTerminationType(NetBoxObjectType):
|
||||||
termination = graphene.Field('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
# termination = graphene.Field('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
@ -206,7 +207,8 @@ class DeviceBayTemplateType(ComponentTemplateObjectType):
|
|||||||
filters=InventoryItemTemplateFilter
|
filters=InventoryItemTemplateFilter
|
||||||
)
|
)
|
||||||
class InventoryItemTemplateType(ComponentTemplateObjectType):
|
class InventoryItemTemplateType(ComponentTemplateObjectType):
|
||||||
component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemTemplateComponentType')
|
# component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemTemplateComponentType')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
@ -299,7 +301,8 @@ class InterfaceTemplateType(ComponentTemplateObjectType):
|
|||||||
filters=InventoryItemFilter
|
filters=InventoryItemFilter
|
||||||
)
|
)
|
||||||
class InventoryItemType(ComponentObjectType):
|
class InventoryItemType(ComponentObjectType):
|
||||||
component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemComponentType')
|
# component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemComponentType')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
@ -512,7 +515,8 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
|
|||||||
filters=SiteFilter
|
filters=SiteFilter
|
||||||
)
|
)
|
||||||
class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
|
class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
|
||||||
asn = graphene.Field(BigInt)
|
# asn = graphene.Field(BigInt)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
@ -28,8 +28,8 @@ __all__ = (
|
|||||||
|
|
||||||
class IPAddressFamilyType(graphene.ObjectType):
|
class IPAddressFamilyType(graphene.ObjectType):
|
||||||
|
|
||||||
value = graphene.Int()
|
# value = graphene.Int()
|
||||||
label = graphene.String()
|
# label = graphene.String()
|
||||||
|
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
@ -40,7 +40,7 @@ class BaseIPAddressFamilyType:
|
|||||||
"""
|
"""
|
||||||
Base type for models that need to expose their IPAddress family type.
|
Base type for models that need to expose their IPAddress family type.
|
||||||
"""
|
"""
|
||||||
family = graphene.Field(IPAddressFamilyType)
|
# family = graphene.Field(IPAddressFamilyType)
|
||||||
|
|
||||||
def resolve_family(self, _):
|
def resolve_family(self, _):
|
||||||
# Note that self, is an instance of models.IPAddress
|
# Note that self, is an instance of models.IPAddress
|
||||||
@ -54,7 +54,8 @@ class BaseIPAddressFamilyType:
|
|||||||
filters=ProviderFilter
|
filters=ProviderFilter
|
||||||
)
|
)
|
||||||
class ASNType(NetBoxObjectType):
|
class ASNType(NetBoxObjectType):
|
||||||
asn = graphene.Field(BigInt)
|
# asn = graphene.Field(BigInt)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
@ -92,7 +93,8 @@ class FHRPGroupType(NetBoxObjectType):
|
|||||||
filters=FHRPGroupAssignmentFilter
|
filters=FHRPGroupAssignmentFilter
|
||||||
)
|
)
|
||||||
class FHRPGroupAssignmentType(BaseObjectType):
|
class FHRPGroupAssignmentType(BaseObjectType):
|
||||||
interface = graphene.Field('ipam.graphql.gfk_mixins.FHRPGroupInterfaceType')
|
# interface = graphene.Field('ipam.graphql.gfk_mixins.FHRPGroupInterfaceType')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
@ -101,7 +103,7 @@ class FHRPGroupAssignmentType(BaseObjectType):
|
|||||||
filters=IPAddressFilter
|
filters=IPAddressFilter
|
||||||
)
|
)
|
||||||
class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
|
class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
|
||||||
assigned_object = graphene.Field('ipam.graphql.gfk_mixins.IPAddressAssignmentType')
|
# assigned_object = graphene.Field('ipam.graphql.gfk_mixins.IPAddressAssignmentType')
|
||||||
|
|
||||||
def resolve_role(self, info):
|
def resolve_role(self, info):
|
||||||
return self.role or None
|
return self.role or None
|
||||||
@ -187,7 +189,8 @@ class VLANType(NetBoxObjectType):
|
|||||||
filters=VLANGroupFilter
|
filters=VLANGroupFilter
|
||||||
)
|
)
|
||||||
class VLANGroupType(OrganizationalObjectType):
|
class VLANGroupType(OrganizationalObjectType):
|
||||||
scope = graphene.Field('ipam.graphql.gfk_mixins.VLANGroupScopeType')
|
# scope = graphene.Field('ipam.graphql.gfk_mixins.VLANGroupScopeType')
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
@ -11,7 +11,7 @@ from users.graphql.schema import UsersQuery
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class Query(
|
class Query(
|
||||||
UsersQuery,
|
UsersQuery,
|
||||||
# CircuitsQuery,
|
CircuitsQuery,
|
||||||
# CoreQuery,
|
# CoreQuery,
|
||||||
# DCIMQuery,
|
# DCIMQuery,
|
||||||
# ExtrasQuery,
|
# ExtrasQuery,
|
||||||
|
@ -17,7 +17,7 @@ __all__ = (
|
|||||||
|
|
||||||
|
|
||||||
class ContactAssignmentsMixin:
|
class ContactAssignmentsMixin:
|
||||||
assignments = graphene.List('tenancy.graphql.types.ContactAssignmentType')
|
# assignments = graphene.List('tenancy.graphql.types.ContactAssignmentType')
|
||||||
|
|
||||||
def resolve_assignments(self, info):
|
def resolve_assignments(self, info):
|
||||||
return self.assignments.restrict(info.context.user, 'view')
|
return self.assignments.restrict(info.context.user, 'view')
|
||||||
@ -30,7 +30,7 @@ class ContactAssignmentsMixin:
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.Tenant,
|
models.Tenant,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=TenantFilter
|
# filters=TenantFilter
|
||||||
)
|
)
|
||||||
class TenantType(NetBoxObjectType):
|
class TenantType(NetBoxObjectType):
|
||||||
pass
|
pass
|
||||||
@ -39,7 +39,7 @@ class TenantType(NetBoxObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.TenantGroup,
|
models.TenantGroup,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=TenantGroupFilter
|
# filters=TenantGroupFilter
|
||||||
)
|
)
|
||||||
class TenantGroupType(OrganizationalObjectType):
|
class TenantGroupType(OrganizationalObjectType):
|
||||||
pass
|
pass
|
||||||
@ -52,7 +52,7 @@ class TenantGroupType(OrganizationalObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.Contact,
|
models.Contact,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ContactFilter
|
# filters=ContactFilter
|
||||||
)
|
)
|
||||||
class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
|
class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
|
||||||
pass
|
pass
|
||||||
@ -61,7 +61,7 @@ class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.ContactRole,
|
models.ContactRole,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ContactRoleFilter
|
# filters=ContactRoleFilter
|
||||||
)
|
)
|
||||||
class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
|
class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
|
||||||
pass
|
pass
|
||||||
@ -70,7 +70,7 @@ class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.ContactGroup,
|
models.ContactGroup,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ContactGroupFilter
|
# filters=ContactGroupFilter
|
||||||
)
|
)
|
||||||
class ContactGroupType(OrganizationalObjectType):
|
class ContactGroupType(OrganizationalObjectType):
|
||||||
pass
|
pass
|
||||||
@ -79,7 +79,7 @@ class ContactGroupType(OrganizationalObjectType):
|
|||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
models.ContactAssignment,
|
models.ContactAssignment,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ContactAssignmentFilter
|
# filters=ContactAssignmentFilter
|
||||||
)
|
)
|
||||||
class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType):
|
class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType):
|
||||||
pass
|
pass
|
||||||
|
@ -107,4 +107,5 @@ class L2VPNType(ContactsMixin, NetBoxObjectType):
|
|||||||
filters=L2VPNTerminationFilter
|
filters=L2VPNTerminationFilter
|
||||||
)
|
)
|
||||||
class L2VPNTerminationType(NetBoxObjectType):
|
class L2VPNTerminationType(NetBoxObjectType):
|
||||||
assigned_object = graphene.Field('vpn.graphql.gfk_mixins.L2VPNAssignmentType')
|
# assigned_object = graphene.Field('vpn.graphql.gfk_mixins.L2VPNAssignmentType')
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user