Skip to content

Commit

Permalink
7699 review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arthanson committed Oct 25, 2024
1 parent 277b175 commit 62358f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/models/virtualization/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ The cluster's operational status.

### Scope

The [region](../dcim/region.md), [site](../dcim/site.md) or [location](../dcim/location.md) with which this cluster is associated.
The [region](../dcim/region.md), [site](../dcim/site.md), [site group](../dcim/sitegroup.md) or [location](../dcim/location.md) with which this cluster is associated.
12 changes: 12 additions & 0 deletions netbox/dcim/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ class LocationType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, Organi
devices: List[Annotated["DeviceType", strawberry.lazy('dcim.graphql.types')]]
children: List[Annotated["LocationType", strawberry.lazy('dcim.graphql.types')]]

@strawberry_django.field
def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]:
return self._clusters.all()


@strawberry_django.type(
models.Manufacturer,
Expand Down Expand Up @@ -704,6 +708,10 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
def parent(self) -> Annotated["RegionType", strawberry.lazy('dcim.graphql.types')] | None:
return self.parent

@strawberry_django.field
def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]:
return self._clusters.all()


@strawberry_django.type(
models.Site,
Expand Down Expand Up @@ -748,6 +756,10 @@ class SiteGroupType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
def parent(self) -> Annotated["SiteGroupType", strawberry.lazy('dcim.graphql.types')] | None:
return self.parent

@strawberry_django.field
def clusters(self) -> List[Annotated["ClusterType", strawberry.lazy('virtualization.graphql.types')]]:
return self._clusters.all()


@strawberry_django.type(
models.VirtualChassis,
Expand Down
2 changes: 1 addition & 1 deletion netbox/virtualization/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# models values for ContentTypes which may be CircuitTermination scope types
# models values for ContentTypes which may be Cluster scope types
CLUSTER_SCOPE_TYPES = (
'region', 'sitegroup', 'site', 'location',
)

0 comments on commit 62358f6

Please sign in to comment.