diff --git a/apps/assets/models/asset/common.py b/apps/assets/models/asset/common.py index 255a7ac2e..9676c3db0 100644 --- a/apps/assets/models/asset/common.py +++ b/apps/assets/models/asset/common.py @@ -162,7 +162,7 @@ class Asset(NodesRelationMixin, LabeledMixin, AbsConnectivity, JSONFilterMixin, domain = models.ForeignKey("assets.Domain", null=True, blank=True, related_name='assets', verbose_name=_("Zone"), on_delete=models.SET_NULL) nodes = models.ManyToManyField('assets.Node', default=default_node, related_name='assets', verbose_name=_("Nodes")) - is_active = models.BooleanField(default=True, verbose_name=_('Is active')) + is_active = models.BooleanField(default=True, verbose_name=_('Active')) gathered_info = models.JSONField(verbose_name=_('Gathered info'), default=dict, blank=True) # 资产的一些信息,如 硬件信息 custom_info = models.JSONField(verbose_name=_('Custom info'), default=dict) diff --git a/apps/authentication/backends/saml2/views.py b/apps/authentication/backends/saml2/views.py index aa676bef4..bbc3b600b 100644 --- a/apps/authentication/backends/saml2/views.py +++ b/apps/authentication/backends/saml2/views.py @@ -231,7 +231,7 @@ class Saml2EndSessionView(View, PrepareRequestMixin): if settings.SAML2_LOGOUT_COMPLETELY: saml_instance = self.init_saml_auth(request) - logger.debug(log_prompt.format('Log out IDP user session synchronously')) + logger.debug(log_prompt.format('Logout IDP user session synchronously')) return HttpResponseRedirect(saml_instance.logout()) logger.debug(log_prompt.format('Redirect logout url')) diff --git a/apps/i18n/core/en/LC_MESSAGES/django.po b/apps/i18n/core/en/LC_MESSAGES/django.po index ad0ef1467..238e55a65 100644 --- a/apps/i18n/core/en/LC_MESSAGES/django.po +++ b/apps/i18n/core/en/LC_MESSAGES/django.po @@ -5731,7 +5731,7 @@ msgstr "" #: terminal/models/virtualapp/virtualapp.py:36 #: terminal/models/virtualapp/virtualapp.py:97 #: terminal/serializers/virtualapp.py:32 -msgid "Virtual app" +msgid "Virtual App" msgstr "" #: settings/serializers/feature.py:148 @@ -5938,7 +5938,7 @@ msgid "Only admin users" msgstr "" #: settings/serializers/security.py:120 -msgid "Global MFA auth" +msgid "Global MFA" msgstr "" #: settings/serializers/security.py:124 @@ -6019,7 +6019,7 @@ msgstr "" #: settings/serializers/security.py:171 msgid "" "Detect infrequent users daily and disable them if they exceed the " -"predetermined time limit." +"predetermined time limit" msgstr "" #: settings/serializers/security.py:191 @@ -6942,7 +6942,7 @@ msgid "App Provider" msgstr "" #: terminal/models/virtualapp/virtualapp.py:102 -msgid "Virtual app publication" +msgid "Virtual App publication" msgstr "" #: terminal/notifications.py:25 diff --git a/apps/i18n/core/ja/LC_MESSAGES/django.po b/apps/i18n/core/ja/LC_MESSAGES/django.po index 8359ebc8c..0fbd71d98 100644 --- a/apps/i18n/core/ja/LC_MESSAGES/django.po +++ b/apps/i18n/core/ja/LC_MESSAGES/django.po @@ -5951,7 +5951,7 @@ msgstr "コマンドフィルタリング" #: terminal/models/virtualapp/virtualapp.py:36 #: terminal/models/virtualapp/virtualapp.py:97 #: terminal/serializers/virtualapp.py:32 -msgid "Virtual app" +msgid "Virtual App" msgstr "仮想アプリケーション" #: settings/serializers/feature.py:148 @@ -6184,7 +6184,7 @@ msgid "Only admin users" msgstr "管理者のみ" #: settings/serializers/security.py:120 -msgid "Global MFA auth" +msgid "Global MFA" msgstr "グローバル有効化MFA認証" #: settings/serializers/security.py:124 @@ -6271,10 +6271,10 @@ msgstr "未使用のユーザータイムアウト(日)" #: settings/serializers/security.py:171 msgid "" "Detect infrequent users daily and disable them if they exceed the " -"predetermined time limit." +"predetermined time limit" msgstr "" "毎日、頻度の低いユーザーを検出し、予め決められた時間制限を超えた場合は無効に" -"します。" +"します" #: settings/serializers/security.py:191 msgid "Watermark" @@ -7237,7 +7237,7 @@ msgid "App Provider" msgstr "アプリケーションプロバイダ" #: terminal/models/virtualapp/virtualapp.py:102 -msgid "Virtual app publication" +msgid "Virtual App publication" msgstr "仮想アプリケーションの公開" #: terminal/notifications.py:25 diff --git a/apps/i18n/core/zh/LC_MESSAGES/django.po b/apps/i18n/core/zh/LC_MESSAGES/django.po index 4a3f46321..69f0fa73f 100644 --- a/apps/i18n/core/zh/LC_MESSAGES/django.po +++ b/apps/i18n/core/zh/LC_MESSAGES/django.po @@ -5821,7 +5821,7 @@ msgstr "作业中心命令黑名单" #: terminal/models/virtualapp/virtualapp.py:36 #: terminal/models/virtualapp/virtualapp.py:97 #: terminal/serializers/virtualapp.py:32 -msgid "Virtual app" +msgid "Virtual App" msgstr "虚拟应用" #: settings/serializers/feature.py:148 @@ -6037,7 +6037,7 @@ msgid "Only admin users" msgstr "仅管理员" #: settings/serializers/security.py:120 -msgid "Global MFA auth" +msgid "Global MFA" msgstr "全局启用 MFA 认证" #: settings/serializers/security.py:124 @@ -6122,7 +6122,7 @@ msgstr "不活跃用户自动禁用 (天)" #: settings/serializers/security.py:171 msgid "" "Detect infrequent users daily and disable them if they exceed the " -"predetermined time limit." +"predetermined time limit" msgstr "每天检测一次,超过预设时间的用户自动禁用" #: settings/serializers/security.py:191 @@ -7069,7 +7069,7 @@ msgid "App Provider" msgstr "应用提供商" #: terminal/models/virtualapp/virtualapp.py:102 -msgid "Virtual app publication" +msgid "Virtual App publication" msgstr "虚拟应用发布" #: terminal/notifications.py:25 diff --git a/apps/i18n/lina/en.json b/apps/i18n/lina/en.json index 79ba431d0..4e1b4e66a 100644 --- a/apps/i18n/lina/en.json +++ b/apps/i18n/lina/en.json @@ -93,15 +93,15 @@ "AppOps": "Job center", "AppProvider": "Application providers", "AppProviderDetail": "Application provider details", - "AppletDetail": "Remoteapp", + "AppletDetail": "RemoteApp", "AppletHelpText": "In the upload process, if the application does not exist, create the application; if it exists, update the application.", - "AppletHostCreate": "Add remote application release machine", - "AppletHostDetail": "Remote application publishing machine details", + "AppletHostCreate": "Add RemoteApp machine", + "AppletHostDetail": "RemoteApp machine", "AppletHostSelectHelpMessage": "When connecting to an asset, the selection of the application publishing machine is random (but the last used one is preferred). if you want to assign a specific publishing machine to an asset, you can tag it as or ;
when selecting an account for the publishing machine, the following situations will choose the user's own account with the same name or proprietary account (starting with js), otherwise use a public account (starting with jms):
  1. both the publishing machine and application support concurrent;
  2. the publishing machine supports concurrent, but the application does not, and the current application does not use a proprietary account;
  3. the publishing machine does not support concurrent, the application either supports or does not support concurrent, and no application uses a proprietary account;
note: whether the application supports concurrent connections is decided by the developer, and whether the host supports concurrent connections is decided by the single user single session setting in the publishing machine configuration", "AppletHostUpdate": "Update the remote app publishing machine", "AppletHostZoneHelpText": "This domain belongs to the system organization", - "AppletHosts": "Remoteapp machine", - "Applets": "Remoteapp", + "AppletHosts": "RemoteApp machine", + "Applets": "RemoteApp", "Applicant": "Applicant", "Applications": "Assets", "ApplyAsset": "Apply for assets", @@ -422,10 +422,10 @@ "Empty": "Empty", "Enable": "Enable", "EnableKoKoSSHHelpText": "When switched on, connecting to the asset will display ssh client pull-up method", - "Endpoint": "Service endpoints", + "Endpoint": "Endpoint", "EndpointListHelpMessage": "The service endpoint is the address (port) for users to access the service. when users connect to assets, they choose service endpoints based on endpoint rules and asset labels, using them as access points to establish connections and achieve distributed connections to assets", "EndpointRule": "Endpoint rules", - "EndpointRuleListHelpMessage": "For the server endpoint selection strategy, there are currently two options:
1、specify the endpoint according to the endpoint rule (current page);
2、choose the endpoint through asset labels, with the fixed label name being 'endpoint' and the value being the name of the endpoint.
the tag matching method is preferred for both methods, as the ip range may conflict, and the tag method exists as a supplement to the rules.", + "EndpointRuleListHelpMessage": "For the server endpoint selection strategy, there are currently two options:
1. specify the endpoint according to the endpoint rule (current page);
2. choose the endpoint through asset labels, with the fixed label name being 'endpoint' and the value being the name of the endpoint.
the tag matching method is preferred for both methods, as the ip range may conflict, and the tag method exists as a supplement to the rules.", "Endswith": "Ending with...", "EnsureThisValueIsGreaterThanOrEqualTo1": "Please make sure this number is greater than or equal to 1", "EnterForSearch": "Press enter to search", @@ -1038,7 +1038,6 @@ "SetMFA": "Multi-factor authentication", "SetSuccess": "Successfully set", "SetToDefault": "Set as default", - "SetToDefaultStorage": "Set as default storage", "Setting": "Setting", "SettingInEndpointHelpText": "Configure service address and port in system settings / component settings / server endpoints", "Settings": "System settings", @@ -1259,7 +1258,6 @@ "VerifySignTmpl": "Sms template", "Version": "Version", "View": "View", - "ViewBlockedIPSHelpText": "View list of locked ips", "ViewMore": "View more", "ViewPerm": "View", "ViewSecret": "View ciphertext", @@ -1267,9 +1265,9 @@ "VirtualAccountHelpMsg": "Virtual accounts are specialized accounts with specific purposes when connecting assets.", "VirtualAccountUpdate": "Virtual account update", "VirtualAccounts": "Virtual accounts", - "VirtualApp": "Virtual App", - "VirtualAppDetail": "Virtual app details", - "VirtualApps": "VApp", + "VirtualApp": "VirtualApp", + "VirtualAppDetail": "Virtual App details", + "VirtualApps": "VirtualApp", "Volcengine": "Volcengine", "Warning": "Warning", "WeCom": "WeCom", @@ -1304,5 +1302,6 @@ "Settings...": "Settings...", "EmailTemplate": "Template", "EmailTemplateHelpTip": "Email template is used for sending emails and includes the email subject prefix and email content", - "ForgotPasswordURL": "Forgot password URL" + "ForgotPasswordURL": "Forgot password URL", + "ObjectStorage": "Object Storage" } diff --git a/apps/i18n/lina/ja.json b/apps/i18n/lina/ja.json index a6b1f96ab..cc7e434ce 100644 --- a/apps/i18n/lina/ja.json +++ b/apps/i18n/lina/ja.json @@ -1044,7 +1044,6 @@ "SetMFA": "MFA 認証", "SetSuccess": "設定成功", "SetToDefault": "デフォルトに設定", - "SetToDefaultStorage": "デフォルトのストレージとして設定", "Setting": "設定", "SettingInEndpointHelpText": "システム設定/コンポーネント設定/サーバーエンドポイントでサービスのアドレスとポートを設定してください", "Settings": "システム設定", @@ -1267,7 +1266,6 @@ "VerifySignTmpl": "認証コードのSMSテンプレート", "Version": "バージョン", "View": "閲覧", - "ViewBlockedIPSHelpText": "ロック済みIPリストを表示する", "ViewMore": "もっと見る", "ViewPerm": "認可を表示", "ViewSecret": "暗号文を見る", diff --git a/apps/i18n/lina/zh.json b/apps/i18n/lina/zh.json index 218d920fd..6efbba8cf 100644 --- a/apps/i18n/lina/zh.json +++ b/apps/i18n/lina/zh.json @@ -1023,7 +1023,6 @@ "Configured": "已配置", "SetSuccess": "设置成功", "SetToDefault": "设为默认", - "SetToDefaultStorage": "设置为默认存储", "WeComOAuth": "企业微信认证", "Setting": "设置", "SettingInEndpointHelpText": "在 系统设置 / 组件设置 / 服务端点 中配置服务地址和端口", @@ -1252,7 +1251,6 @@ "VerifySignTmpl": "验证码短信模板", "Version": "版本", "View": "查看", - "ViewBlockedIPSHelpText": "查看已被锁定的 IP 列表", "ViewMore": "查看更多", "ViewPerm": "查看授权", "ViewSecret": "查看密文", diff --git a/apps/i18n/lina/zh_hant.json b/apps/i18n/lina/zh_hant.json index 23db586b7..a1a7ea79f 100644 --- a/apps/i18n/lina/zh_hant.json +++ b/apps/i18n/lina/zh_hant.json @@ -1202,7 +1202,6 @@ "SetStatus": "設置狀態", "SetSuccess": "設置成功", "SetToDefault": "設為默認", - "SetToDefaultStorage": "設置為默認儲存", "Setting": "設置", "SettingInEndpointHelpText": "在 系統設置 / 組件設置 / 服務端點 中配置服務地址和埠", "Settings": "系統設置", @@ -1465,7 +1464,6 @@ "VerifySignTmpl": "驗證碼簡訊模板", "Version": "版本", "View": "查看", - "ViewBlockedIPSHelpText": "查看已被鎖定的 IP 列表", "ViewMore": "查看更多", "ViewPerm": "查看授權", "ViewSecret": "查看密文", diff --git a/apps/settings/serializers/auth/cas.py b/apps/settings/serializers/auth/cas.py index 4ab017eaf..73b3f4736 100644 --- a/apps/settings/serializers/auth/cas.py +++ b/apps/settings/serializers/auth/cas.py @@ -17,7 +17,7 @@ class CASSettingSerializer(serializers.Serializer): ) CAS_LOGOUT_COMPLETELY = serializers.BooleanField( required=False, label=_('Logout completely'), - help_text=_('When the user signs out, they also be logged out from the CAS Server') + help_text=_('When the user signs out, they also be logged out from the CAS server') ) CAS_VERSION = serializers.IntegerField( required=False, label=_('Version'), min_value=1, max_value=3 diff --git a/apps/settings/serializers/auth/feishu.py b/apps/settings/serializers/auth/feishu.py index 187f2642f..771a7997c 100644 --- a/apps/settings/serializers/auth/feishu.py +++ b/apps/settings/serializers/auth/feishu.py @@ -9,6 +9,6 @@ __all__ = ['FeiShuSettingSerializer'] class FeiShuSettingSerializer(serializers.Serializer): PREFIX_TITLE = _('FeiShu') - AUTH_FEISHU = serializers.BooleanField(default=False, label=_('Enable FeiShu Auth')) + AUTH_FEISHU = serializers.BooleanField(default=False, label=_('FeiShu')) FEISHU_APP_ID = serializers.CharField(max_length=256, required=True, label='App ID') FEISHU_APP_SECRET = EncryptedField(max_length=256, required=False, label='App Secret') diff --git a/apps/settings/serializers/auth/lark.py b/apps/settings/serializers/auth/lark.py index 4b2143fe1..36b493ab0 100644 --- a/apps/settings/serializers/auth/lark.py +++ b/apps/settings/serializers/auth/lark.py @@ -9,6 +9,6 @@ __all__ = ['LarkSettingSerializer'] class LarkSettingSerializer(serializers.Serializer): PREFIX_TITLE = 'Lark' - AUTH_LARK = serializers.BooleanField(default=False, label=_('Enable Lark Auth')) + AUTH_LARK = serializers.BooleanField(default=False, label=_('Lark')) LARK_APP_ID = serializers.CharField(max_length=256, required=True, label='App ID') LARK_APP_SECRET = EncryptedField(max_length=256, required=False, label='App Secret') diff --git a/apps/settings/serializers/auth/oauth2.py b/apps/settings/serializers/auth/oauth2.py index d554c03ad..997bfc4a3 100644 --- a/apps/settings/serializers/auth/oauth2.py +++ b/apps/settings/serializers/auth/oauth2.py @@ -27,7 +27,7 @@ class OAuth2SettingSerializer(serializers.Serializer): required=True, max_length=16, label=_('Service provider') ) AUTH_OAUTH2_CLIENT_ID = serializers.CharField( - required=True, max_length=1024, label=_('Client Id') + required=True, max_length=1024, label=_('Client ID') ) AUTH_OAUTH2_CLIENT_SECRET = EncryptedField( required=False, max_length=1024, label=_('Client Secret') @@ -51,9 +51,16 @@ class OAuth2SettingSerializer(serializers.Serializer): AUTH_OAUTH2_PROVIDER_END_SESSION_ENDPOINT = serializers.CharField( required=False, allow_blank=True, max_length=1024, label=_('End session endpoint') ) - AUTH_OAUTH2_LOGOUT_COMPLETELY = serializers.BooleanField(required=False, label=_('Logout completely')) + AUTH_OAUTH2_LOGOUT_COMPLETELY = serializers.BooleanField( + required=False, label=_('Logout completely'), + help_text=_('When the user signs out, they also be logged out from the OAuth2 server') + ) AUTH_OAUTH2_USER_ATTR_MAP = serializers.JSONField( - required=True, label=_('User attribute') + required=True, label=_('User attribute'), + help_text=_( + 'User attribute mapping, where the `key` is the JumpServer user attribute name and the ' + '`value` is the OAuth2 service user attribute name' + ) ) AUTH_OAUTH2_ALWAYS_UPDATE_USER = serializers.BooleanField( default=True, label=_('Always update user') diff --git a/apps/settings/serializers/auth/radius.py b/apps/settings/serializers/auth/radius.py index 859f577e4..56746f65a 100644 --- a/apps/settings/serializers/auth/radius.py +++ b/apps/settings/serializers/auth/radius.py @@ -18,4 +18,7 @@ class RadiusSettingSerializer(serializers.Serializer): RADIUS_SECRET = EncryptedField( required=False, max_length=1024, allow_null=True, label=_('Secret'), ) - OTP_IN_RADIUS = serializers.BooleanField(required=False, label=_('OTP in Radius')) + OTP_IN_RADIUS = serializers.BooleanField( + required=False, label=_('OTP in RADIUS'), + help_text=_('* Using OTP in RADIUS means users can employ RADIUS as a method for MFA') + ) diff --git a/apps/settings/serializers/auth/saml2.py b/apps/settings/serializers/auth/saml2.py index 7e49a3895..b54118b16 100644 --- a/apps/settings/serializers/auth/saml2.py +++ b/apps/settings/serializers/auth/saml2.py @@ -29,6 +29,15 @@ class SAML2SettingSerializer(serializers.Serializer): allow_blank=True, required=False, write_only=True, label=_('SP cert') ) - SAML2_RENAME_ATTRIBUTES = serializers.JSONField(required=False, label=_('User attribute')) - SAML2_LOGOUT_COMPLETELY = serializers.BooleanField(required=False, label=_('Logout completely')) + SAML2_RENAME_ATTRIBUTES = serializers.JSONField( + required=False, label=_('User attribute'), + help_text=_( + "User attribute mapping, where the `key` is the SAML2 service user attribute name " + "and the `value` is the JumpServer user attribute name" + ) + ) + SAML2_LOGOUT_COMPLETELY = serializers.BooleanField( + required=False, label=_('Logout completely'), + help_text=_('When the user signs out, they also be logged out from the SAML2 server') + ) AUTH_SAML2_ALWAYS_UPDATE_USER = serializers.BooleanField(required=False, label=_('Always update user')) diff --git a/apps/settings/serializers/security.py b/apps/settings/serializers/security.py index 689786f96..7d7290c96 100644 --- a/apps/settings/serializers/security.py +++ b/apps/settings/serializers/security.py @@ -117,7 +117,7 @@ class SecurityAuthSerializer(serializers.Serializer): [1, _('All users')], [2, _('Only admin users')], ), - required=False, label=_("Global MFA auth") + required=False, label=_("Global MFA") ) SECURITY_MFA_AUTH_ENABLED_FOR_THIRD_PARTY = serializers.BooleanField( required=False, default=True, @@ -168,7 +168,7 @@ class SecurityAuthSerializer(serializers.Serializer): SECURITY_UNCOMMON_USERS_TTL = serializers.IntegerField( min_value=30, max_value=99999, required=False, label=_('Auto Disable Threshold (day)'), - help_text=_("Detect infrequent users daily and disable them if they exceed the predetermined time limit.") + help_text=_("Detect infrequent users daily and disable them if they exceed the predetermined time limit") ) def validate(self, attrs): diff --git a/apps/settings/serializers/terminal.py b/apps/settings/serializers/terminal.py index 0a2c55046..09defd38f 100644 --- a/apps/settings/serializers/terminal.py +++ b/apps/settings/serializers/terminal.py @@ -19,23 +19,54 @@ class TerminalSettingSerializer(serializers.Serializer): ('50', '50'), ) SECURITY_SERVICE_ACCOUNT_REGISTRATION = serializers.BooleanField( - required=True, label=_('Terminal registration'), + required=True, label=_('Registration'), help_text=_( - "Allow terminal register, after all terminal setup, you should disable this for security" + "Allow component register, after all component setup, you should disable this for security" + ) + ) + TERMINAL_PASSWORD_AUTH = serializers.BooleanField( + required=False, label=_("Password"), + help_text=_( + '* Allow users to log in to the KoKo component via password authentication' ) ) - TERMINAL_PASSWORD_AUTH = serializers.BooleanField(required=False, label=_("Password auth")) TERMINAL_PUBLIC_KEY_AUTH = serializers.BooleanField( - required=False, label=_("Public key auth"), - help_text=_('Information: If use other auth method, like AD/LDAP, you should disable this to ' - 'avoid being able to log in after deleting') + required=False, label=_("Public key"), + help_text=_( + '* Allow users to log in to the KoKo component via Public key authentication' + '
' + 'If third-party authentication services, such as AD/LDAP, are enabled, you should ' + 'disable this option to prevent users from logging in after being deleted from the AD/LDAP server' + ) ) TERMINAL_ASSET_LIST_SORT_BY = serializers.ChoiceField( - SORT_BY_CHOICES, required=False, label=_('Asset list sorting') + SORT_BY_CHOICES, required=False, label=_('Asset sorting') ) TERMINAL_ASSET_LIST_PAGE_SIZE = serializers.ChoiceField( - PAGE_SIZE_CHOICES, required=False, label=_('Asset list page size') + PAGE_SIZE_CHOICES, required=False, label=_('Asset page size') + ) + TERMINAL_MAGNUS_ENABLED = serializers.BooleanField( + label="Magnus", + help_text=_( + '* You can individually configure the service address and port in the service endpoint' + '
' + 'If enabled, the Luna page will display the DB client launch method when connecting to assets' + ) + ) + TERMINAL_RAZOR_ENABLED = serializers.BooleanField( + label="Razor", + help_text=_( + '* You can individually configure the service address and port in the service endpoint' + '
' + 'If enabled, the Luna page will display the download rdp file button ' + 'and RDP Client launch method when connecting to assets' + ) + ) + TERMINAL_KOKO_SSH_ENABLED = serializers.BooleanField( + label="Client connection", + help_text=_( + '* Allow connecting to the KoKo component via SSH client' + '
' + 'If enabled, the Luna page will display the SSH client launch method when connecting to assets' + ) ) - TERMINAL_MAGNUS_ENABLED = serializers.BooleanField(label="Magnus") - TERMINAL_RAZOR_ENABLED = serializers.BooleanField(label="Razor") - TERMINAL_KOKO_SSH_ENABLED = serializers.BooleanField(label="SSH Client") diff --git a/apps/terminal/models/component/endpoint.py b/apps/terminal/models/component/endpoint.py index cdb9b0135..b347dd12e 100644 --- a/apps/terminal/models/component/endpoint.py +++ b/apps/terminal/models/component/endpoint.py @@ -117,7 +117,7 @@ class EndpointRule(JMSBaseModel): on_delete=models.SET_NULL, verbose_name=_("Endpoint"), ) comment = models.TextField(default='', blank=True, verbose_name=_('Comment')) - is_active = models.BooleanField(default=True, verbose_name=_('Is active')) + is_active = models.BooleanField(default=True, verbose_name=_('Active')) class Meta: verbose_name = _('Endpoint rule') diff --git a/apps/terminal/serializers/storage.py b/apps/terminal/serializers/storage.py index ed75c22ef..11dbc3e00 100644 --- a/apps/terminal/serializers/storage.py +++ b/apps/terminal/serializers/storage.py @@ -259,6 +259,13 @@ class BaseStorageSerializer(serializers.ModelSerializer): return instance +meta_is_default = { + 'help_text': _( + 'set as the default storage, will make new Component use the current ' + 'storage by default, without affecting existing Component' + ) +} + # CommandStorageSerializer class CommandStorageSerializer(BaseStorageSerializer): type = LabeledChoiceField(choices=const.CommandStorageType.choices, label=_('Type')) @@ -267,7 +274,8 @@ class CommandStorageSerializer(BaseStorageSerializer): class Meta(BaseStorageSerializer.Meta): model = CommandStorage extra_kwargs = { - 'name': {'validators': [UniqueValidator(queryset=CommandStorage.objects.all())]} + 'name': {'validators': [UniqueValidator(queryset=CommandStorage.objects.all())]}, + 'is_default': meta_is_default } @@ -278,8 +286,9 @@ class ReplayStorageSerializer(BaseStorageSerializer): class Meta(BaseStorageSerializer.Meta): model = ReplayStorage - extra_kwargs = { - 'name': {'validators': [UniqueValidator(queryset=ReplayStorage.objects.all())]} + extra_kwargs ={ + 'name': {'validators': [UniqueValidator(queryset=ReplayStorage.objects.all())]}, + 'is_default': meta_is_default } def validate_is_default(self, value):