2017-12-12 04:19:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2023-07-11 04:06:11 +00:00
|
|
|
from django.db.models import TextChoices, IntegerChoices
|
2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2019-12-05 07:09:25 +00:00
|
|
|
|
|
|
|
|
2023-07-11 04:06:11 +00:00
|
|
|
class RiskLevelChoices(IntegerChoices):
|
|
|
|
accept = 0, _('Accept')
|
|
|
|
warning = 4, _('Warning')
|
|
|
|
reject = 5, _('Reject')
|
|
|
|
review_reject = 6, _('Review & Reject')
|
|
|
|
review_accept = 7, _('Review & Accept')
|
|
|
|
review_cancel = 8, _('Review & Cancel')
|
|
|
|
|
2023-07-19 02:11:47 +00:00
|
|
|
@classmethod
|
2023-07-19 03:00:58 +00:00
|
|
|
def get_label(cls, level):
|
|
|
|
label = dict(cls.choices).get(level)
|
|
|
|
return label
|
2023-07-19 02:11:47 +00:00
|
|
|
|
2023-07-11 04:06:11 +00:00
|
|
|
|
2022-11-04 03:40:16 +00:00
|
|
|
class ReplayStorageType(TextChoices):
|
2021-01-12 10:06:42 +00:00
|
|
|
null = 'null', 'Null',
|
|
|
|
server = 'server', 'Server'
|
|
|
|
s3 = 's3', 'S3'
|
|
|
|
ceph = 'ceph', 'Ceph'
|
|
|
|
swift = 'swift', 'Swift'
|
|
|
|
oss = 'oss', 'OSS'
|
|
|
|
azure = 'azure', 'Azure'
|
2021-04-12 11:37:04 +00:00
|
|
|
obs = 'obs', 'OBS'
|
2022-02-28 11:28:58 +00:00
|
|
|
cos = 'cos', 'COS'
|
2023-11-07 07:10:46 +00:00
|
|
|
sftp = 'sftp', 'SFTP'
|
2019-12-05 07:09:25 +00:00
|
|
|
|
|
|
|
|
2022-11-04 03:40:16 +00:00
|
|
|
class CommandStorageType(TextChoices):
|
2021-01-12 10:06:42 +00:00
|
|
|
null = 'null', 'Null',
|
|
|
|
server = 'server', 'Server'
|
|
|
|
es = 'es', 'Elasticsearch'
|
2020-12-10 12:50:22 +00:00
|
|
|
|
|
|
|
|
2021-01-12 10:06:42 +00:00
|
|
|
# Component Status Choices
|
|
|
|
# ------------------------
|
2020-12-10 12:50:22 +00:00
|
|
|
|
2022-11-04 03:40:16 +00:00
|
|
|
class ComponentLoad(TextChoices):
|
2020-12-10 12:50:22 +00:00
|
|
|
critical = 'critical', _('Critical')
|
|
|
|
high = 'high', _('High')
|
|
|
|
normal = 'normal', _('Normal')
|
2021-03-26 11:09:34 +00:00
|
|
|
offline = 'offline', _('Offline')
|
2020-12-10 12:50:22 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def status(cls):
|
|
|
|
return set(dict(cls.choices).keys())
|
|
|
|
|
|
|
|
|
2022-11-17 12:48:50 +00:00
|
|
|
class TerminalType(TextChoices):
|
|
|
|
koko = 'koko', 'KoKo'
|
|
|
|
guacamole = 'guacamole', 'Guacamole'
|
|
|
|
omnidb = 'omnidb', 'OmniDB'
|
|
|
|
xrdp = 'xrdp', 'Xrdp'
|
|
|
|
lion = 'lion', 'Lion'
|
|
|
|
core = 'core', 'Core'
|
|
|
|
celery = 'celery', 'Celery'
|
|
|
|
magnus = 'magnus', 'Magnus'
|
|
|
|
razor = 'razor', 'Razor'
|
|
|
|
tinker = 'tinker', 'Tinker'
|
2023-04-27 11:31:58 +00:00
|
|
|
video_worker = 'video_worker', 'Video Worker'
|
2023-06-19 10:06:23 +00:00
|
|
|
chen = 'chen', 'Chen'
|
2023-07-11 02:31:36 +00:00
|
|
|
kael = 'kael', 'Kael'
|
2023-12-05 08:52:11 +00:00
|
|
|
panda = 'panda', 'Panda'
|
2022-11-16 13:05:15 +00:00
|
|
|
|
|
|
|
@classmethod
|
2022-11-17 12:48:50 +00:00
|
|
|
def types(cls):
|
|
|
|
return set(dict(cls.choices).keys())
|
2023-01-16 11:02:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PublishStatus(TextChoices):
|
|
|
|
pending = 'pending', _('Pending')
|
|
|
|
success = 'success', _("Success")
|
|
|
|
failed = 'failed', _("Failed")
|
|
|
|
mismatch = 'mismatch', _("Mismatch")
|
2023-02-17 12:10:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SessionType(TextChoices):
|
|
|
|
normal = 'normal', _('Normal')
|
|
|
|
tunnel = 'tunnel', _('Tunnel')
|
|
|
|
command = 'command', _('Command')
|
2023-07-04 09:04:25 +00:00
|
|
|
sftp = 'sftp', _('SFTP')
|
2023-04-03 05:55:27 +00:00
|
|
|
|
|
|
|
|
2023-04-03 07:01:48 +00:00
|
|
|
class ActionPermission(TextChoices):
|
2023-10-11 02:31:57 +00:00
|
|
|
readonly = "readonly", _('Read only')
|
2023-04-03 07:01:48 +00:00
|
|
|
writable = "writable", _('Writable')
|
2023-08-01 08:40:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TaskNameType(TextChoices):
|
2023-10-11 02:31:57 +00:00
|
|
|
kill_session = "kill_session", _('Kill session')
|
|
|
|
lock_session = "lock_session", _('Lock session')
|
|
|
|
unlock_session = "unlock_session", _('Unlock session')
|
2023-10-09 11:04:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SessionErrorReason(TextChoices):
|
2023-10-11 02:31:57 +00:00
|
|
|
connect_failed = 'connect_failed', _('Connect failed')
|
|
|
|
replay_create_failed = 'replay_create_failed', _('Replay create failed')
|
|
|
|
replay_upload_failed = 'replay_upload_failed', _('Replay upload failed')
|
|
|
|
replay_convert_failed = 'replay_convert_failed', _('Replay convert failed')
|
2023-12-12 06:25:53 +00:00
|
|
|
replay_unsupported = 'replay_unsupported', _('Replay unsupported')
|