mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-29 21:02:46 +00:00
* perf: initial * perf: basic finished * perf: depend * perf: Update Dockerfile with new base image tag * perf: Add user report api * perf: Update Dockerfile with new base image tag * perf: Use user report api * perf: Update Dockerfile with new base image tag * perf: user login report * perf: Update Dockerfile with new base image tag * perf: user change password * perf: change password dashboard * perf: Update Dockerfile with new base image tag * perf: Translate * perf: asset api * perf: asset activity * perf: Asset report * perf: add charts_map * perf: account report * perf: Translate * perf: account automation * perf: Account automation * perf: title * perf: Update Dockerfile with new base image tag --------- Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: feng <1304903146@qq.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: wangruidong <940853815@qq.com> Co-authored-by: feng626 <57284900+feng626@users.noreply.github.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from django.db.models import TextChoices
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
class Connectivity(TextChoices):
|
|
UNKNOWN = '-', _('Unknown')
|
|
NA = 'na', _('N/A')
|
|
OK = 'ok', _('OK')
|
|
ERR = 'err', _('Error')
|
|
RDP_ERR = 'rdp_err', _('RDP error')
|
|
AUTH_ERR = 'auth_err', _('Authentication error')
|
|
PASSWORD_ERR = 'password_err', _('Invalid password error')
|
|
OPENSSH_KEY_ERR = 'openssh_key_err', _('OpenSSH key error')
|
|
NTLM_ERR = 'ntlm_err', _('NTLM credentials rejected error')
|
|
CREATE_TEMPORARY_ERR = 'create_temp_err', _('Create temporary error')
|
|
|
|
@classmethod
|
|
def as_dict(cls):
|
|
return {choice.value: choice.label for choice in cls}
|
|
|
|
|
|
class AutomationTypes(TextChoices):
|
|
ping = 'ping', _('Ping')
|
|
ping_gateway = 'ping_gateway', _('Ping gateway')
|
|
gather_facts = 'gather_facts', _('Gather facts')
|
|
|
|
@classmethod
|
|
def get_type_model(cls, tp):
|
|
from assets.models import (
|
|
PingAutomation, GatherFactsAutomation,
|
|
)
|
|
type_model_dict = {
|
|
cls.ping: PingAutomation,
|
|
cls.gather_facts: GatherFactsAutomation,
|
|
}
|
|
return type_model_dict.get(tp)
|