mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 19:08:38 -06:00
Update extras enums
This commit is contained in:
parent
90c3822ea9
commit
65d0014369
@ -38,7 +38,6 @@ __all__ = (
|
|||||||
'SiteStatusEnum',
|
'SiteStatusEnum',
|
||||||
'SubdeviceRoleEnum',
|
'SubdeviceRoleEnum',
|
||||||
'VirtualDeviceContextStatusEnum',
|
'VirtualDeviceContextStatusEnum',
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
CableEndEnum = strawberry.enum(CableEndChoices.as_enum())
|
CableEndEnum = strawberry.enum(CableEndChoices.as_enum())
|
||||||
|
@ -1,188 +1,26 @@
|
|||||||
from enum import Enum
|
|
||||||
import strawberry
|
import strawberry
|
||||||
|
|
||||||
__all__ = [
|
from extras.choices import *
|
||||||
'CustomFieldTypeEnum',
|
|
||||||
'CustomFieldFilterLogicEnum',
|
__all__ = (
|
||||||
'CustomFieldUIVisibleEnum',
|
|
||||||
'CustomFieldUIEditableEnum',
|
|
||||||
'CustomFieldChoiceSetBaseEnum',
|
'CustomFieldChoiceSetBaseEnum',
|
||||||
|
'CustomFieldFilterLogicEnum',
|
||||||
|
'CustomFieldTypeEnum',
|
||||||
|
'CustomFieldUIEditableEnum',
|
||||||
|
'CustomFieldUIVisibleEnum',
|
||||||
'CustomLinkButtonClassEnum',
|
'CustomLinkButtonClassEnum',
|
||||||
'BookmarkOrderingEnum',
|
|
||||||
'JournalEntryKindEnum',
|
|
||||||
'LogLevelEnum',
|
|
||||||
'DurationEnum',
|
|
||||||
'WebhookHttpMethodEnum',
|
|
||||||
'ChangeActionEnum',
|
|
||||||
'DashboardWidgetColorEnum',
|
|
||||||
'EventRuleActionEnum',
|
'EventRuleActionEnum',
|
||||||
]
|
'JournalEntryKindEnum',
|
||||||
|
'WebhookHttpMethodEnum',
|
||||||
#
|
)
|
||||||
# CustomFields
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
CustomFieldChoiceSetBaseEnum = strawberry.enum(CustomFieldChoiceSetBaseChoices.as_enum())
|
||||||
class CustomFieldTypeEnum(Enum):
|
CustomFieldFilterLogicEnum = strawberry.enum(CustomFieldFilterLogicChoices.as_enum())
|
||||||
TYPE_TEXT = 'text'
|
CustomFieldTypeEnum = strawberry.enum(CustomFieldTypeChoices.as_enum())
|
||||||
TYPE_LONGTEXT = 'longtext'
|
CustomFieldUIEditableEnum = strawberry.enum(CustomFieldUIEditableChoices.as_enum())
|
||||||
TYPE_INTEGER = 'integer'
|
CustomFieldUIVisibleEnum = strawberry.enum(CustomFieldUIVisibleChoices.as_enum())
|
||||||
TYPE_DECIMAL = 'decimal'
|
CustomLinkButtonClassEnum = strawberry.enum(CustomLinkButtonClassChoices.as_enum())
|
||||||
TYPE_BOOLEAN = 'boolean'
|
EventRuleActionEnum = strawberry.enum(EventRuleActionChoices.as_enum())
|
||||||
TYPE_DATE = 'date'
|
JournalEntryKindEnum = strawberry.enum(JournalEntryKindChoices.as_enum())
|
||||||
TYPE_DATETIME = 'datetime'
|
WebhookHttpMethodEnum = strawberry.enum(WebhookHttpMethodChoices.as_enum())
|
||||||
TYPE_URL = 'url'
|
|
||||||
TYPE_JSON = 'json'
|
|
||||||
TYPE_SELECT = 'select'
|
|
||||||
TYPE_MULTISELECT = 'multiselect'
|
|
||||||
TYPE_OBJECT = 'object'
|
|
||||||
TYPE_MULTIOBJECT = 'multiobject'
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class CustomFieldFilterLogicEnum(Enum):
|
|
||||||
FILTER_DISABLED = 'disabled'
|
|
||||||
FILTER_LOOSE = 'loose'
|
|
||||||
FILTER_EXACT = 'exact'
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class CustomFieldUIVisibleEnum(Enum):
|
|
||||||
ALWAYS = 'always'
|
|
||||||
IF_SET = 'if-set'
|
|
||||||
HIDDEN = 'hidden'
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class CustomFieldUIEditableEnum(Enum):
|
|
||||||
YES = 'yes'
|
|
||||||
NO = 'no'
|
|
||||||
HIDDEN = 'hidden'
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class CustomFieldChoiceSetBaseEnum(Enum):
|
|
||||||
IATA = 'IATA'
|
|
||||||
ISO_3166 = 'ISO_3166'
|
|
||||||
UN_LOCODE = 'UN_LOCODE'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# CustomLinks
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class CustomLinkButtonClassEnum(Enum):
|
|
||||||
LINK = 'ghost-dark'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Bookmarks
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class BookmarkOrderingEnum(Enum):
|
|
||||||
ORDERING_NEWEST = '-created'
|
|
||||||
ORDERING_OLDEST = 'created'
|
|
||||||
ORDERING_ALPHABETICAL_AZ = 'name'
|
|
||||||
ORDERING_ALPHABETICAL_ZA = '-name'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Journal entries
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class JournalEntryKindEnum(Enum):
|
|
||||||
KIND_INFO = 'info'
|
|
||||||
KIND_SUCCESS = 'success'
|
|
||||||
KIND_WARNING = 'warning'
|
|
||||||
KIND_DANGER = 'danger'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Reports and Scripts
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class LogLevelEnum(Enum):
|
|
||||||
LOG_DEBUG = 'debug'
|
|
||||||
LOG_DEFAULT = 'default'
|
|
||||||
LOG_INFO = 'info'
|
|
||||||
LOG_SUCCESS = 'success'
|
|
||||||
LOG_WARNING = 'warning'
|
|
||||||
LOG_FAILURE = 'failure'
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class DurationEnum(Enum):
|
|
||||||
HOURLY = 60
|
|
||||||
TWELVE_HOURS = 720
|
|
||||||
DAILY = 1440
|
|
||||||
WEEKLY = 10080
|
|
||||||
THIRTY_DAYS = 43200
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Webhooks
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class WebhookHttpMethodEnum(Enum):
|
|
||||||
METHOD_GET = 'GET'
|
|
||||||
METHOD_POST = 'POST'
|
|
||||||
METHOD_PUT = 'PUT'
|
|
||||||
METHOD_PATCH = 'PATCH'
|
|
||||||
METHOD_DELETE = 'DELETE'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Staging
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class ChangeActionEnum(Enum):
|
|
||||||
ACTION_CREATE = 'create'
|
|
||||||
ACTION_UPDATE = 'update'
|
|
||||||
ACTION_DELETE = 'delete'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Dashboard widgets
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class DashboardWidgetColorEnum(Enum):
|
|
||||||
BLUE = 'blue'
|
|
||||||
INDIGO = 'indigo'
|
|
||||||
PURPLE = 'purple'
|
|
||||||
PINK = 'pink'
|
|
||||||
RED = 'red'
|
|
||||||
ORANGE = 'orange'
|
|
||||||
YELLOW = 'yellow'
|
|
||||||
GREEN = 'green'
|
|
||||||
TEAL = 'teal'
|
|
||||||
CYAN = 'cyan'
|
|
||||||
GRAY = 'gray'
|
|
||||||
BLACK = 'black'
|
|
||||||
WHITE = 'white'
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Event Rules
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.enum
|
|
||||||
class EventRuleActionEnum(Enum):
|
|
||||||
WEBHOOK = 'webhook'
|
|
||||||
SCRIPT = 'script'
|
|
||||||
NOTIFICATION = 'notification'
|
|
||||||
|
@ -184,7 +184,9 @@ class CustomLinkFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin):
|
|||||||
strawberry_django.filter_field()
|
strawberry_django.filter_field()
|
||||||
)
|
)
|
||||||
group_name: FilterLookup[str] | None = strawberry_django.filter_field()
|
group_name: FilterLookup[str] | None = strawberry_django.filter_field()
|
||||||
button_class: FilterLookup[str] | None = strawberry_django.filter_field()
|
button_class: Annotated['CustomLinkButtonClassEnum', strawberry.lazy('extras.graphql.enums')] | None = (
|
||||||
|
strawberry_django.filter_field()
|
||||||
|
)
|
||||||
new_window: FilterLookup[bool] | None = strawberry_django.filter_field()
|
new_window: FilterLookup[bool] | None = strawberry_django.filter_field()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user