Skip to content

Commit

Permalink
feat: APPID 最小字符数为 3&国际化问题修复 (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayuan929 authored Apr 20, 2023
1 parent 9c3a8e4 commit 14e90ac
Show file tree
Hide file tree
Showing 9 changed files with 701 additions and 405 deletions.
Binary file modified apiserver/paasng/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
1,065 changes: 671 additions & 394 deletions apiserver/paasng/locale/en/LC_MESSAGES/django.po

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class AppIDField(serializers.RegexField):
def __init__(self, regex=RE_APP_CODE, *args, **kwargs):
preset_kwargs = dict(
max_length=16,
min_length=3,
required=True,
help_text='应用 ID',
validators=[
Expand Down
13 changes: 13 additions & 0 deletions apiserver/paasng/paasng/publish/market/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from enum import Enum

from blue_krill.data_types.enum import EnumField, StructuredEnum
from django.utils.translation import gettext_lazy as _

from paasng.platform.core.region import RegionType

Expand Down Expand Up @@ -69,3 +70,15 @@ class OpenMode(str, StructuredEnum):

DESKTOP = EnumField(real_value='desktop', label="桌面")
NEW_TAB = EnumField(real_value='new_tab', label="新标签页")


class TagName(str, StructuredEnum):
"""应用分类名称"""

OPSTOOlS = EnumField("OpsTools", label=_("运维工具"))
MONITORAlARM = EnumField("MonitorAlarm", label=_("监控告警"))
CONFMANAGE = EnumField("ConfManage", label=_("配置管理"))
DEVTOOLS = EnumField("DevTools", label=_("开发工具"))
ENTERPRISEIT = EnumField("EnterpriseIT", label=_("企业IT"))
OFFICEAPP = EnumField("OfficeApp", label=_("办公应用"))
OTHER = EnumField("Other", label=_("其它"))
7 changes: 4 additions & 3 deletions webfe/package_vue/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ export default {
'天前': 'Days ago',
'小时前': 'Hours ago',
'分钟前': 'Minutes ago',
'刚刚': 'Just',
'刚刚': 'Just now',
'部署阶段': 'Deployment phase',
'无执行中的进程': 'No running process',
'暂无日志': 'No log yet',
Expand Down Expand Up @@ -1322,8 +1322,8 @@ export default {
'你可以根据以下操作解决此类问题': 'You can solve this kind of problem by doing the following',
'平台为该类应用提供应用引擎、增强服务、云API 权限、应用市场等功能。': 'The platform provides app engines, Add-ons, cloud API permissions, app market and other features for such apps.',
'应用 ID': 'APP ID',
'格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符': 'Incorrect format, can only contain: lowercase letters, numbers, hyphens (-), initial letter must be a letter, length less than 16 characters',
'由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符': 'Consists of lowercase letters, numbers, hyphens (-), the first letter must be a letter and less than 16 characters long',
'格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头': 'Incorrect format, 3-16 Characters with lowercase letters, numbers, hyphens (-), beginning with lowercase letters',
'请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头': 'Please enter 3-16 characters in lowercase letters, numbers, hyphens (-), starting with a lowercase letter',
'应用的唯一标识,创建后不可修改': 'The unique identifier of the app, which cannot be modified after creation',
'格式不正确,只能包含:汉字、英文字母、数字,长度小于 20 个字符': 'The format is incorrect, it can only contain: Chinese characters, English letters, numbers, and the length is less than 20 characters',
'由汉字、英文字母、数字组成,长度小于 20 个字符': 'Composed of Chinese characters, English letters and numbers, the length is less than 20 characters',
Expand Down Expand Up @@ -2117,6 +2117,7 @@ export default {
'离开': 'Leave',
'应用市场信息请在“app_desc.yaml”文件中配置': 'Please configure the application market information in the "app_desc.yaml" file',
'web进程的容器镜像地址': 'The container image address of the web process',
'每个镜像版本默认仅拉取一次,如版本内容有更新,请勾选该项': 'Each image version is only pulled once by default, please check this box if there are updates to the version.'
'共享实例': 'Shared',
'独占实例': 'Exclusive'
};
5 changes: 3 additions & 2 deletions webfe/package_vue/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,8 +1330,8 @@ export default {
'你可以根据以下操作解决此类问题': '你可以根据以下操作解决此类问题',
'平台为该类应用提供应用引擎、增强服务、云API 权限、应用市场等功能。': '平台为该类应用提供应用引擎、增强服务、云API 权限、应用市场等功能。',
'应用 ID': '应用 ID',
'格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符': '格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符',
'由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符': '由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符',
'格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头': '格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头',
'请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头': '请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头',
'应用的唯一标识,创建后不可修改': '应用的唯一标识,创建后不可修改',
'格式不正确,只能包含:汉字、英文字母、数字,长度小于 20 个字符': '格式不正确,只能包含:汉字、英文字母、数字,长度小于 20 个字符',
'由汉字、英文字母、数字组成,长度小于 20 个字符': '由汉字、英文字母、数字组成,长度小于 20 个字符',
Expand Down Expand Up @@ -2118,6 +2118,7 @@ export default {
'离开将会导致未保存信息丢失': '离开将会导致未保存信息丢失',
'离开': '离开',
'web进程的容器镜像地址': 'web进程的容器镜像地址',
'每个镜像版本默认仅拉取一次,如版本内容有更新,请勾选该项': '每个镜像版本默认仅拉取一次,如版本内容有更新,请勾选该项'
'共享实例': '共享实例',
'独占实例': '独占实例'
};
5 changes: 3 additions & 2 deletions webfe/package_vue/src/views/dev-center/create-app/cloud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
name="code"
data-parsley-required="true"
:data-parsley-required-message="$t('该字段是必填项')"
data-parsley-minlength="3"
data-parsley-maxlength="16"
data-parsley-pattern="[a-z][a-z0-9-]+"
:data-parsley-pattern-message="$t('格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符')"
:data-parsley-pattern-message="$t('格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
data-parsley-trigger="input blur"
class="ps-form-control"
:placeholder="$t('由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符')"
:placeholder="$t('请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
>
</p>
<p class="whole-item-tips">
Expand Down
5 changes: 3 additions & 2 deletions webfe/package_vue/src/views/dev-center/create-app/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
name="code"
data-parsley-required="true"
:data-parsley-required-message="$t('该字段是必填项')"
data-parsley-minlength="3"
data-parsley-maxlength="16"
:data-parsley-pattern="isLessCodeRule ? '[a-z]+' : '[a-z][a-z0-9-]+'"
:data-parsley-pattern-message="isLessCodeRule ? $t('格式不正确,由小写字母组成,长度小于 16 个字符') : $t('格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符')"
:data-parsley-pattern-message="isLessCodeRule ? $t('格式不正确,由小写字母组成,长度小于 16 个字符') : $t('格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
data-parsley-trigger="input blur"
class="ps-form-control"
:placeholder="isLessCodeRule ? $t('由小写字母组成,长度小于 16 个字符') : $t('由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符')"
:placeholder="isLessCodeRule ? $t('由小写字母组成,长度小于 16 个字符') : $t('请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
>
</p>
<p class="whole-item-tips">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
name="code"
data-parsley-required="true"
:data-parsley-required-message="$t('该字段是必填项')"
data-parsley-minlength="3"
data-parsley-maxlength="16"
data-parsley-pattern="[a-z][a-z0-9-]+"
:data-parsley-pattern-message="$t('格式不正确,只能包含:小写字母、数字、连字符(-),首字母必须是字母,长度小于 16 个字符')"
:data-parsley-pattern-message="$t('格式不正确,只能包含:3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
data-parsley-trigger="input blur"
class="ps-form-control"
:placeholder="$t('由小写字母、数字、连字符(-)组成,首字母必须是字母,长度小于 16 个字符')"
:placeholder="$t('请输入 3-16 字符的小写字母、数字、连字符(-),以小写字母开头')"
>
</p>
<p class="whole-item-tips">
Expand Down

0 comments on commit 14e90ac

Please sign in to comment.