mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 10:58:37 -06:00
Update extras enums
This commit is contained in:
parent
90c3822ea9
commit
65d0014369
@ -38,7 +38,6 @@ __all__ = (
|
||||
'SiteStatusEnum',
|
||||
'SubdeviceRoleEnum',
|
||||
'VirtualDeviceContextStatusEnum',
|
||||
|
||||
)
|
||||
|
||||
CableEndEnum = strawberry.enum(CableEndChoices.as_enum())
|
||||
|
@ -1,188 +1,26 @@
|
||||
from enum import Enum
|
||||
import strawberry
|
||||
|
||||
__all__ = [
|
||||
'CustomFieldTypeEnum',
|
||||
'CustomFieldFilterLogicEnum',
|
||||
'CustomFieldUIVisibleEnum',
|
||||
'CustomFieldUIEditableEnum',
|
||||
from extras.choices import *
|
||||
|
||||
__all__ = (
|
||||
'CustomFieldChoiceSetBaseEnum',
|
||||
'CustomFieldFilterLogicEnum',
|
||||
'CustomFieldTypeEnum',
|
||||
'CustomFieldUIEditableEnum',
|
||||
'CustomFieldUIVisibleEnum',
|
||||
'CustomLinkButtonClassEnum',
|
||||
'BookmarkOrderingEnum',
|
||||
'JournalEntryKindEnum',
|
||||
'LogLevelEnum',
|
||||
'DurationEnum',
|
||||
'WebhookHttpMethodEnum',
|
||||
'ChangeActionEnum',
|
||||
'DashboardWidgetColorEnum',
|
||||
'EventRuleActionEnum',
|
||||
]
|
||||
|
||||
#
|
||||
# CustomFields
|
||||
#
|
||||
'JournalEntryKindEnum',
|
||||
'WebhookHttpMethodEnum',
|
||||
)
|
||||
|
||||
|
||||
@strawberry.enum
|
||||
class CustomFieldTypeEnum(Enum):
|
||||
TYPE_TEXT = 'text'
|
||||
TYPE_LONGTEXT = 'longtext'
|
||||
TYPE_INTEGER = 'integer'
|
||||
TYPE_DECIMAL = 'decimal'
|
||||
TYPE_BOOLEAN = 'boolean'
|
||||
TYPE_DATE = 'date'
|
||||
TYPE_DATETIME = 'datetime'
|
||||
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'
|
||||
CustomFieldChoiceSetBaseEnum = strawberry.enum(CustomFieldChoiceSetBaseChoices.as_enum())
|
||||
CustomFieldFilterLogicEnum = strawberry.enum(CustomFieldFilterLogicChoices.as_enum())
|
||||
CustomFieldTypeEnum = strawberry.enum(CustomFieldTypeChoices.as_enum())
|
||||
CustomFieldUIEditableEnum = strawberry.enum(CustomFieldUIEditableChoices.as_enum())
|
||||
CustomFieldUIVisibleEnum = strawberry.enum(CustomFieldUIVisibleChoices.as_enum())
|
||||
CustomLinkButtonClassEnum = strawberry.enum(CustomLinkButtonClassChoices.as_enum())
|
||||
EventRuleActionEnum = strawberry.enum(EventRuleActionChoices.as_enum())
|
||||
JournalEntryKindEnum = strawberry.enum(JournalEntryKindChoices.as_enum())
|
||||
WebhookHttpMethodEnum = strawberry.enum(WebhookHttpMethodChoices.as_enum())
|
||||
|
@ -184,7 +184,9 @@ class CustomLinkFilter(BaseObjectTypeFilterMixin, ChangeLogFilterMixin):
|
||||
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()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user