perf: Translate account history

pull/14297/head
wangruidong 1 month ago committed by w940853815
parent 7a528b499a
commit 31f8a19392

@ -53,7 +53,8 @@ class Account(AbsConnectivity, LabeledMixin, BaseAccount):
on_delete=models.SET_NULL, verbose_name=_("Su from") on_delete=models.SET_NULL, verbose_name=_("Su from")
) )
version = models.IntegerField(default=0, verbose_name=_('Version')) version = models.IntegerField(default=0, verbose_name=_('Version'))
history = AccountHistoricalRecords(included_fields=['id', '_secret', 'secret_type', 'version']) history = AccountHistoricalRecords(included_fields=['id', '_secret', 'secret_type', 'version'],
verbose_name=_("historical Account"))
source = models.CharField(max_length=30, default=Source.LOCAL, verbose_name=_('Source')) source = models.CharField(max_length=30, default=Source.LOCAL, verbose_name=_('Source'))
source_id = models.CharField(max_length=128, null=True, blank=True, verbose_name=_('Source ID')) source_id = models.CharField(max_length=128, null=True, blank=True, verbose_name=_('Source ID'))

@ -18,7 +18,7 @@ from common.serializers.fields import LabeledChoiceField
from labels.models import Label from labels.models import Label
from orgs.mixins.serializers import BulkOrgResourceModelSerializer from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from ...const import Category, AllTypes from ...const import Category, AllTypes
from ...models import Asset, Node, Platform, Protocol from ...models import Asset, Node, Platform, Protocol, Host, Device, Database, Cloud, Web, Custom
__all__ = [ __all__ = [
'AssetSerializer', 'AssetSimpleSerializer', 'MiniAssetSerializer', 'AssetSerializer', 'AssetSimpleSerializer', 'MiniAssetSerializer',
@ -310,9 +310,13 @@ class AssetSerializer(BulkOrgResourceModelSerializer, ResourceLabelsMixin, Writa
return protocols_data_map.values() return protocols_data_map.values()
def validate_platform(self, platform_data): def validate_platform(self, platform_data):
if self.Meta.model.__name__.lower() != platform_data.category: check_models = {Host, Device, Database, Cloud, Web, Custom}
if self.Meta.model not in check_models:
return platform_data
model_name = self.Meta.model.__name__.lower()
if model_name != platform_data.category:
raise serializers.ValidationError({ raise serializers.ValidationError({
'platform': f"platform is not match: {platform_data.name}" 'platform': f"Platform does not match: {platform_data.name}"
}) })
return platform_data return platform_data

@ -74,6 +74,9 @@ class OperateLogStore(object):
@classmethod @classmethod
def convert_diff_friendly(cls, op_log): def convert_diff_friendly(cls, op_log):
diff_list = list() diff_list = list()
# 标记翻译字符串
labels = _("labels")
operate_log_id = _("operate_log_id")
handler = cls._get_special_handler(op_log.resource_type) handler = cls._get_special_handler(op_log.resource_type)
for k, v in op_log.diff.items(): for k, v in op_log.diff.items():
before_value, after_value = cls.split_value(v) before_value, after_value = cls.split_value(v)

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n" "Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-12 11:30+0800\n" "POT-Creation-Date: 2024-10-14 15:06+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n" "Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n" "Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -376,16 +376,20 @@ msgstr "切换自"
msgid "Version" msgid "Version"
msgstr "版本" msgstr "版本"
#: accounts/models/account.py:57 accounts/serializers/account/account.py:228 #: accounts/models/account.py:57
msgid "historical Account"
msgstr "账号历史"
#: accounts/models/account.py:58 accounts/serializers/account/account.py:228
#: users/models/user/__init__.py:119 #: users/models/user/__init__.py:119
msgid "Source" msgid "Source"
msgstr "来源" msgstr "来源"
#: accounts/models/account.py:58 #: accounts/models/account.py:59
msgid "Source ID" msgid "Source ID"
msgstr "来源 ID" msgstr "来源 ID"
#: accounts/models/account.py:61 #: accounts/models/account.py:62
#: accounts/serializers/automations/change_secret.py:113 #: accounts/serializers/automations/change_secret.py:113
#: accounts/serializers/automations/change_secret.py:144 #: accounts/serializers/automations/change_secret.py:144
#: accounts/templates/accounts/change_secret_failed_info.html:12 #: accounts/templates/accounts/change_secret_failed_info.html:12
@ -403,27 +407,27 @@ msgstr "来源 ID"
msgid "Account" msgid "Account"
msgstr "账号" msgstr "账号"
#: accounts/models/account.py:67 #: accounts/models/account.py:68
msgid "Can view asset account secret" msgid "Can view asset account secret"
msgstr "可以查看资产账号密码" msgstr "可以查看资产账号密码"
#: accounts/models/account.py:68 #: accounts/models/account.py:69
msgid "Can view asset history account" msgid "Can view asset history account"
msgstr "可以查看资产历史账号" msgstr "可以查看资产历史账号"
#: accounts/models/account.py:69 #: accounts/models/account.py:70
msgid "Can view asset history account secret" msgid "Can view asset history account secret"
msgstr "可以查看资产历史账号密码" msgstr "可以查看资产历史账号密码"
#: accounts/models/account.py:70 #: accounts/models/account.py:71
msgid "Can verify account" msgid "Can verify account"
msgstr "可以验证账号" msgstr "可以验证账号"
#: accounts/models/account.py:71 #: accounts/models/account.py:72
msgid "Can push account" msgid "Can push account"
msgstr "可以推送账号" msgstr "可以推送账号"
#: accounts/models/account.py:72 #: accounts/models/account.py:73
msgid "Can remove account" msgid "Can remove account"
msgstr "可以移除账号" msgstr "可以移除账号"
@ -934,7 +938,7 @@ msgstr "账号已存在"
#: accounts/serializers/account/account.py:459 #: accounts/serializers/account/account.py:459
#: accounts/serializers/account/base.py:93 #: accounts/serializers/account/base.py:93
#: accounts/serializers/account/template.py:83 #: accounts/serializers/account/template.py:83
#: assets/serializers/asset/common.py:407 #: assets/serializers/asset/common.py:418
msgid "Spec info" msgid "Spec info"
msgstr "特殊信息" msgstr "特殊信息"
@ -1392,7 +1396,7 @@ msgstr "用户"
#: acls/models/base.py:98 assets/models/automations/base.py:17 #: acls/models/base.py:98 assets/models/automations/base.py:17
#: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:148 #: assets/models/cmd_filter.py:38 assets/serializers/asset/common.py:148
#: assets/serializers/asset/common.py:406 perms/serializers/permission.py:55 #: assets/serializers/asset/common.py:417 perms/serializers/permission.py:55
#: perms/serializers/user_permission.py:75 rbac/tree.py:35 #: perms/serializers/user_permission.py:75 rbac/tree.py:35
msgid "Accounts" msgid "Accounts"
msgstr "账号" msgstr "账号"
@ -1980,7 +1984,7 @@ msgstr "平台"
msgid "Zone" msgid "Zone"
msgstr "网域" msgstr "网域"
#: assets/models/asset/common.py:179 assets/serializers/asset/common.py:408 #: assets/models/asset/common.py:179 assets/serializers/asset/common.py:419
#: assets/serializers/asset/host.py:11 #: assets/serializers/asset/host.py:11
msgid "Gathered info" msgid "Gathered info"
msgstr "收集资产硬件信息" msgstr "收集资产硬件信息"
@ -2163,7 +2167,7 @@ msgstr "我的资产"
msgid "New node" msgid "New node"
msgstr "新节点" msgstr "新节点"
#: assets/models/node.py:467 audits/backends/db.py:82 audits/backends/db.py:83 #: assets/models/node.py:467 audits/backends/db.py:85 audits/backends/db.py:86
msgid "empty" msgid "empty"
msgstr "空" msgstr "空"
@ -2367,7 +2371,7 @@ msgid "Node path"
msgstr "节点路径" msgstr "节点路径"
#: assets/serializers/asset/common.py:168 #: assets/serializers/asset/common.py:168
#: assets/serializers/asset/common.py:409 #: assets/serializers/asset/common.py:420
msgid "Auto info" msgid "Auto info"
msgstr "自动化信息" msgstr "自动化信息"
@ -2383,7 +2387,7 @@ msgstr "端口超出范围 (0-65535)"
msgid "Protocol is required: {}" msgid "Protocol is required: {}"
msgstr "协议是必填的: {}" msgstr "协议是必填的: {}"
#: assets/serializers/asset/common.py:336 #: assets/serializers/asset/common.py:347
msgid "Invalid data" msgid "Invalid data"
msgstr "无效的数据" msgstr "无效的数据"
@ -2401,9 +2405,12 @@ msgstr ""
msgid "Postgresql ssl model help text" msgid "Postgresql ssl model help text"
msgstr "" msgstr ""
"Prefer我不关心加密但如果服务器支持加密我愿意支付加密的开销。\n" "Prefer我不关心加密但如果服务器支持加密我愿意支付加密的开销。\n"
"Require我希望我的数据被加密我接受开销。我相信网络将确保我始终连接到我想要的服务器。\n" "Require我希望我的数据被加密我接受开销。我相信网络将确保我始终连接到我想要"
"Verify CA我希望我的数据被加密我接受开销。我想确保我连接到我信任的服务器。\n" "的服务器。\n"
"Verify Full我希望我的数据被加密我接受开销。我想确保我连接到我信任的服务器并且它是我指定的服务器。" "Verify CA我希望我的数据被加密我接受开销。我想确保我连接到我信任的服务"
"器。\n"
"Verify Full我希望我的数据被加密我接受开销。我想确保我连接到我信任的服务"
"器,并且它是我指定的服务器。"
#: assets/serializers/asset/gpt.py:20 #: assets/serializers/asset/gpt.py:20
msgid "" msgid ""
@ -2719,7 +2726,15 @@ msgstr "日志审计"
msgid "The text content is too long. Use Elasticsearch to store operation logs" msgid "The text content is too long. Use Elasticsearch to store operation logs"
msgstr "文字内容太长。请使用 Elasticsearch 存储操作日志" msgstr "文字内容太长。请使用 Elasticsearch 存储操作日志"
#: audits/backends/db.py:108 #: audits/backends/db.py:78
msgid "labels"
msgstr "标签"
#: audits/backends/db.py:79
msgid "operate_log_id"
msgstr "操作日志ID"
#: audits/backends/db.py:111
msgid "Tips" msgid "Tips"
msgstr "提示" msgstr "提示"
@ -4989,7 +5004,7 @@ msgstr "Material"
msgid "Material Type" msgid "Material Type"
msgstr "Material 类型" msgstr "Material 类型"
#: ops/models/job.py:548 #: ops/models/job.py:558
msgid "Job Execution" msgid "Job Execution"
msgstr "作业执行" msgstr "作业执行"

Loading…
Cancel
Save