perf: add charset control

pull/8931/head
ibuler 2022-09-21 19:03:06 +08:00
parent e498a645d3
commit ea1cb158b5
8 changed files with 18 additions and 9 deletions

View File

@ -10,6 +10,7 @@ class CloudTypes(BaseType):
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': False,
'domain_enabled': False,
'su_enabled': False,
}
@ -32,7 +33,7 @@ class CloudTypes(BaseType):
def _get_protocol_constrains(cls) -> dict:
return {
'*': {
'choices': ['http', 'api'],
'choices': ['http'],
},
cls.K8S: {
'choices': ['k8s']

View File

@ -15,6 +15,7 @@ class DatabaseTypes(BaseType):
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': False,
'domain_enabled': True,
'su_enabled': False,
}

View File

@ -4,7 +4,7 @@ from .base import BaseType
class DeviceTypes(BaseType):
GENERAL = 'general', _("General device")
GENERAL = 'general', _("General")
SWITCH = 'switch', _("Switch")
ROUTER = 'router', _("Router")
FIREWALL = 'firewall', _("Firewall")
@ -13,6 +13,7 @@ class DeviceTypes(BaseType):
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': False,
'domain_enabled': True,
'su_enabled': False,
}

View File

@ -11,6 +11,7 @@ class HostTypes(BaseType):
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': True,
'domain_enabled': True,
'su_enabled': True,
},

View File

@ -96,9 +96,9 @@ class Protocol(ChoicesMixin, models.TextChoices):
'port': 80,
'secret_types': ['password'],
'setting': {
'username_selector': '',
'password_selector': '',
'submit_selector': '',
'username_selector': 'input[type=text]',
'password_selector': 'input[type=password]',
'submit_selector': 'button[type=submit]',
}
},
}

View File

@ -4,12 +4,13 @@ from .base import BaseType
class WebTypes(BaseType):
WEBSITE = 'website', _('General website')
WEBSITE = 'website', _('Website')
@classmethod
def _get_base_constrains(cls) -> dict:
return {
'*': {
'charset_enabled': False,
'domain_enabled': False,
'su_enabled': False,
}
@ -32,6 +33,6 @@ class WebTypes(BaseType):
def _get_protocol_constrains(cls) -> dict:
return {
'*': {
'choices': ['http', 'api'],
'choices': ['http'],
}
}

View File

@ -25,7 +25,11 @@ class ProtocolSettingSerializer(serializers.Serializer):
sftp_enabled = serializers.BooleanField(default=True, label=_("SFTP enabled"))
sftp_home = serializers.CharField(default='/tmp', label=_("SFTP home"))
via_http = serializers.BooleanField(default=False, label=_("Via HTTP"))
# HTTP
auto_fill = serializers.BooleanField(default=False, label=_("Auto fill"))
username_selector = serializers.CharField(default='', label=_("Username selector"))
password_selector = serializers.CharField(default='', label=_("Password selector"))
submit_selector = serializers.CharField(default='', label=_("Submit selector"))
class PlatformAutomationSerializer(serializers.ModelSerializer):

View File

@ -526,7 +526,7 @@ msgstr "内部的"
#: perms/serializers/asset/user_permission.py:43
#: xpack/plugins/cloud/serializers/account_attrs.py:162
msgid "Platform"
msgstr "系统平台"
msgstr "资产平台"
#: assets/models/asset.py:168
msgid "Vendor"