Просмотр исходного кода

Fixes #18949: Add missing GraphQL ContactsMixin in types with ContactAssignments

Yi 10 месяцев назад
Родитель
Сommit
b1d014b520

+ 1 - 1
netbox/circuits/graphql/types.py

@@ -43,7 +43,7 @@ class ProviderType(NetBoxObjectType, ContactsMixin):
     fields='__all__',
     fields='__all__',
     filters=ProviderAccountFilter
     filters=ProviderAccountFilter
 )
 )
-class ProviderAccountType(NetBoxObjectType):
+class ProviderAccountType(ContactsMixin, NetBoxObjectType):
     provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
     provider: Annotated["ProviderType", strawberry.lazy('circuits.graphql.types')]
 
 
     circuits: List[Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')]]
     circuits: List[Annotated["CircuitType", strawberry.lazy('circuits.graphql.types')]]

+ 6 - 5
netbox/ipam/graphql/types.py

@@ -5,6 +5,7 @@ import strawberry_django
 
 
 from circuits.graphql.types import ProviderType
 from circuits.graphql.types import ProviderType
 from dcim.graphql.types import SiteType
 from dcim.graphql.types import SiteType
+from extras.graphql.mixins import ContactsMixin
 from ipam import models
 from ipam import models
 from netbox.graphql.scalars import BigInt
 from netbox.graphql.scalars import BigInt
 from netbox.graphql.types import BaseObjectType, NetBoxObjectType, OrganizationalObjectType
 from netbox.graphql.types import BaseObjectType, NetBoxObjectType, OrganizationalObjectType
@@ -83,7 +84,7 @@ class ASNRangeType(NetBoxObjectType):
     fields='__all__',
     fields='__all__',
     filters=AggregateFilter
     filters=AggregateFilter
 )
 )
-class AggregateType(NetBoxObjectType, BaseIPAddressFamilyType):
+class AggregateType(NetBoxObjectType, ContactsMixin, BaseIPAddressFamilyType):
     prefix: str
     prefix: str
     rir: Annotated["RIRType", strawberry.lazy('ipam.graphql.types')] | None
     rir: Annotated["RIRType", strawberry.lazy('ipam.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@@ -120,7 +121,7 @@ class FHRPGroupAssignmentType(BaseObjectType):
     exclude=('assigned_object_type', 'assigned_object_id', 'address'),
     exclude=('assigned_object_type', 'assigned_object_id', 'address'),
     filters=IPAddressFilter
     filters=IPAddressFilter
 )
 )
-class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
+class IPAddressType(NetBoxObjectType, ContactsMixin, BaseIPAddressFamilyType):
     address: str
     address: str
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@@ -144,7 +145,7 @@ class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
     fields='__all__',
     fields='__all__',
     filters=IPRangeFilter
     filters=IPRangeFilter
 )
 )
-class IPRangeType(NetBoxObjectType):
+class IPRangeType(NetBoxObjectType, ContactsMixin):
     start_address: str
     start_address: str
     end_address: str
     end_address: str
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
@@ -157,7 +158,7 @@ class IPRangeType(NetBoxObjectType):
     exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'),
     exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'),
     filters=PrefixFilter
     filters=PrefixFilter
 )
 )
-class PrefixType(NetBoxObjectType, BaseIPAddressFamilyType):
+class PrefixType(NetBoxObjectType, ContactsMixin, BaseIPAddressFamilyType):
     prefix: str
     prefix: str
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
     vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@@ -217,7 +218,7 @@ class RouteTargetType(NetBoxObjectType):
     fields='__all__',
     fields='__all__',
     filters=ServiceFilter
     filters=ServiceFilter
 )
 )
-class ServiceType(NetBoxObjectType):
+class ServiceType(NetBoxObjectType, ContactsMixin):
     ports: List[int]
     ports: List[int]
     device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None
     device: Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')] | None
     virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] | None
     virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] | None

+ 2 - 2
netbox/tenancy/graphql/types.py

@@ -3,7 +3,7 @@ from typing import Annotated, List
 import strawberry
 import strawberry
 import strawberry_django
 import strawberry_django
 
 
-from extras.graphql.mixins import CustomFieldsMixin, TagsMixin
+from extras.graphql.mixins import CustomFieldsMixin, TagsMixin, ContactsMixin
 from netbox.graphql.types import BaseObjectType, OrganizationalObjectType, NetBoxObjectType
 from netbox.graphql.types import BaseObjectType, OrganizationalObjectType, NetBoxObjectType
 from tenancy import models
 from tenancy import models
 from .mixins import ContactAssignmentsMixin
 from .mixins import ContactAssignmentsMixin
@@ -28,7 +28,7 @@ __all__ = (
     fields='__all__',
     fields='__all__',
     filters=TenantFilter
     filters=TenantFilter
 )
 )
-class TenantType(NetBoxObjectType):
+class TenantType(ContactsMixin, NetBoxObjectType):
     group: Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')] | None
     group: Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')] | None
 
 
     asns: List[Annotated["ASNType", strawberry.lazy('ipam.graphql.types')]]
     asns: List[Annotated["ASNType", strawberry.lazy('ipam.graphql.types')]]

+ 2 - 2
netbox/virtualization/graphql/types.py

@@ -33,7 +33,7 @@ class ComponentType(NetBoxObjectType):
     exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'),
     exclude=('scope_type', 'scope_id', '_location', '_region', '_site', '_site_group'),
     filters=ClusterFilter
     filters=ClusterFilter
 )
 )
-class ClusterType(VLANGroupsMixin, NetBoxObjectType):
+class ClusterType(ContactsMixin, VLANGroupsMixin, NetBoxObjectType):
     type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None
     type: Annotated["ClusterTypeType", strawberry.lazy('virtualization.graphql.types')] | None
     group: Annotated["ClusterGroupType", strawberry.lazy('virtualization.graphql.types')] | None
     group: Annotated["ClusterGroupType", strawberry.lazy('virtualization.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@@ -55,7 +55,7 @@ class ClusterType(VLANGroupsMixin, NetBoxObjectType):
     fields='__all__',
     fields='__all__',
     filters=ClusterGroupFilter
     filters=ClusterGroupFilter
 )
 )
-class ClusterGroupType(VLANGroupsMixin, OrganizationalObjectType):
+class ClusterGroupType(ContactsMixin, VLANGroupsMixin, OrganizationalObjectType):
 
 
     clusters: List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]
     clusters: List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]
 
 

+ 2 - 2
netbox/vpn/graphql/types.py

@@ -27,7 +27,7 @@ __all__ = (
     fields='__all__',
     fields='__all__',
     filters=TunnelGroupFilter
     filters=TunnelGroupFilter
 )
 )
-class TunnelGroupType(OrganizationalObjectType):
+class TunnelGroupType(ContactsMixin, OrganizationalObjectType):
 
 
     tunnels: List[Annotated["TunnelType", strawberry.lazy('vpn.graphql.types')]]
     tunnels: List[Annotated["TunnelType", strawberry.lazy('vpn.graphql.types')]]
 
 
@@ -48,7 +48,7 @@ class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
     fields='__all__',
     fields='__all__',
     filters=TunnelFilter
     filters=TunnelFilter
 )
 )
-class TunnelType(NetBoxObjectType):
+class TunnelType(ContactsMixin, NetBoxObjectType):
     group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None
     group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None
     ipsec_profile: Annotated["IPSecProfileType", strawberry.lazy('vpn.graphql.types')] | None
     ipsec_profile: Annotated["IPSecProfileType", strawberry.lazy('vpn.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
     tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None