Skip to content

Commit

Permalink
cleanup enums, enable strawberry-django optimizer, extra line
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypng committed Feb 12, 2025
1 parent 03be7d2 commit 489b084
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 27 deletions.
9 changes: 0 additions & 9 deletions netbox/dcim/graphql/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ class DeviceAirflowEnum(Enum):

@strawberry.enum
class ModuleStatusEnum(Enum):
key = 'Module.status'

STATUS_OFFLINE = 'offline'
STATUS_ACTIVE = 'active'
STATUS_PLANNED = 'planned'
Expand Down Expand Up @@ -800,8 +798,6 @@ class CableEndEnum(Enum):

@strawberry.enum
class PowerFeedStatusEnum(Enum):
key = 'PowerFeed.status'

STATUS_OFFLINE = 'offline'
STATUS_ACTIVE = 'active'
STATUS_PLANNED = 'planned'
Expand All @@ -810,7 +806,6 @@ class PowerFeedStatusEnum(Enum):

@strawberry.enum
class PowerFeedTypeEnum(Enum):

TYPE_PRIMARY = 'primary'
TYPE_REDUNDANT = 'redundant'

Expand All @@ -834,8 +829,6 @@ class PowerFeedPhaseEnum(Enum):
#
@strawberry.enum
class VirtualDeviceContextStatusEnum(Enum):
key = 'VirtualDeviceContext.status'

STATUS_ACTIVE = 'active'
STATUS_PLANNED = 'planned'
STATUS_OFFLINE = 'offline'
Expand All @@ -847,8 +840,6 @@ class VirtualDeviceContextStatusEnum(Enum):

@strawberry.enum
class InventoryItemStatusEnum(Enum):
key = 'InventoryItem.status'

STATUS_OFFLINE = 'offline'
STATUS_ACTIVE = 'active'
STATUS_PLANNED = 'planned'
Expand Down
2 changes: 0 additions & 2 deletions netbox/extras/graphql/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ class BookmarkOrderingEnum(Enum):

@strawberry.enum
class JournalEntryKindEnum(Enum):
key = 'JournalEntry.kind'

KIND_INFO = 'info'
KIND_SUCCESS = 'success'
KIND_WARNING = 'warning'
Expand Down
9 changes: 0 additions & 9 deletions netbox/ipam/graphql/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ class IPAddressFamilyEnum(Enum):

@strawberry.enum
class PrefixStatusEnum(Enum):
key = 'Prefix.status'

STATUS_CONTAINER = 'container'
STATUS_ACTIVE = 'active'
STATUS_RESERVED = 'reserved'
Expand All @@ -43,8 +41,6 @@ class PrefixStatusEnum(Enum):

@strawberry.enum
class IPRangeStatusEnum(Enum):
key = 'IPRange.status'

STATUS_ACTIVE = 'active'
STATUS_RESERVED = 'reserved'
STATUS_DEPRECATED = 'deprecated'
Expand All @@ -57,8 +53,6 @@ class IPRangeStatusEnum(Enum):

@strawberry.enum
class IPAddressStatusEnum(Enum):
key = 'IPAddress.status'

STATUS_ACTIVE = 'active'
STATUS_RESERVED = 'reserved'
STATUS_DEPRECATED = 'deprecated'
Expand Down Expand Up @@ -107,8 +101,6 @@ class FHRPGroupAuthTypeEnum(Enum):

@strawberry.enum
class VLANStatusEnum(Enum):
key = 'VLAN.status'

STATUS_ACTIVE = 'active'
STATUS_RESERVED = 'reserved'
STATUS_DEPRECATED = 'deprecated'
Expand All @@ -119,7 +111,6 @@ class VLANQinQRoleEnum(Enum):
ROLE_SERVICE = 'svlan'
ROLE_CUSTOMER = 'cvlan'


#
# Services
#
Expand Down
3 changes: 1 addition & 2 deletions netbox/netbox/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class Query(
query=Query,
config=StrawberryConfig(auto_camel_case=False),
extensions=[
# DjangoOptimizerExtension(prefetch_custom_queryset=True),
DjangoOptimizerExtension(prefetch_custom_queryset=True, enable_prefetch_related_optimization=False),
DjangoOptimizerExtension(prefetch_custom_queryset=True),
MaxAliasesLimiter(max_alias_count=settings.GRAPHQL_MAX_ALIASES),
]
)
1 change: 0 additions & 1 deletion netbox/netbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,6 @@ def _setting(name, default=None):
STRAWBERRY_DJANGO = {
"DEFAULT_PK_FIELD_NAME": "id",
"TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING": True,
"USE_DEPRECATED_FILTERS": False,
}

#
Expand Down
2 changes: 0 additions & 2 deletions netbox/vpn/graphql/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

@strawberry.enum
class TunnelStatusEnum(Enum):
key = 'Tunnel.status'

STATUS_PLANNED = 'planned'
STATUS_ACTIVE = 'active'
STATUS_DISABLED = 'disabled'
Expand Down
2 changes: 0 additions & 2 deletions netbox/wireless/graphql/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class WirelessRoleEnum(Enum):

@strawberry.enum
class WirelessLANStatusEnum(Enum):
key = 'WirelessLAN.status'

STATUS_ACTIVE = 'active'
STATUS_RESERVED = 'reserved'
STATUS_DISABLED = 'disabled'
Expand Down

0 comments on commit 489b084

Please sign in to comment.