Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 模板文件多个资源模块表单添加默认值 #3658

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bcs-services/cluster-resources/pkg/i18n/locale/lc_msgs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
en: "value required"
- msgID: "仅支持小写字母,数字及 '-' 且需以字母数字开头和结尾"
en: "only lowercase letters, numbers and '-' are supported and must start and end with an alphanumeric"
- msgID: "必须由小写字母数字字符或'-'组成,并且必须以字母数字字符开头和结尾"
en: "must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character"
- msgID: 仅可包含数字字符与小数点
en: "can only contain numeric characters and decimal points"
- msgID: 超过长度限制(64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func genSchemaRules(ctx context.Context) map[string]interface{} {
"validator": "/^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*|{{.*}})$/",
"message": i18n.GetMsg(ctx, "仅支持小写字母,数字及 '-' 且需以字母数字开头和结尾"),
},
"rfc1123LabelRegex": map[string]interface{}{
"validator": "/^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/",
"message": i18n.GetMsg(ctx, "必须由小写字母数字字符或'-'组成,并且必须以字母数字字符开头和结尾"),
},
"numberRegex": map[string]interface{}{
"validator": "/^[0-9]+(\\.[0-9])?[0-9]*$/",
"message": i18n.GetMsg(ctx, "仅可包含数字字符与小数点"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ properties:
accessModes:
title: {{ i18n "访问模式" .lang }}
type: array
default: ["ReadWriteOnce"]
items:
type: string
ui:component:
Expand All @@ -99,6 +100,7 @@ properties:
message: {{ i18n "至少选择一个 AccessMode" .lang }}
scName:
title: {{ i18n "存储类名称" .lang }}
default: fast-storage
type: string
storageSize:
title: {{ i18n "容量" .lang }}
Expand All @@ -113,6 +115,7 @@ properties:
localPath:
title: Path
type: string
default: /tmp/data
ui:rules:
- validator: "{{`{{`}} $self.getValue('spec.type') !== 'local' || $self.value {{`}}`}}"
message: {{ i18n "值不能为空" .lang }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ properties:
accessModes:
title: {{ i18n "访问模式" .lang }}
type: array
default: ["ReadWriteOnce"]
items:
type: string
ui:component:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ref:
resName:
title: {{ i18n "资源名称" .lang }}
type: string
default: deployment-test
ui:rules:
- required
minReplicas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ruleConf:
path:
title: {{ i18n "路径" .lang }}
type: string
default: /testpath
ui:rules:
- required
- maxLength128
Expand All @@ -67,11 +68,13 @@ ruleConf:
targetSVC:
title: {{ i18n "目标 Service" .lang }}
type: string
default: test
ui:rules:
- required
port:
title: {{ i18n "端口" .lang }}
type: integer
default: 80
ui:component:
props:
min: 1
Expand Down Expand Up @@ -136,6 +139,7 @@ network:
existLBID:
title: "CLB ID"
type: string
default: lb-c5xxxxd6
ui:component:
props:
placeholder: {{ i18n "例如:lb-c5xxxxd6" .lang | quote }}
Expand Down Expand Up @@ -334,9 +338,11 @@ portConf:
type: string
ui:rules:
- maxLength64
- rfc1123LabelRegex
port:
title: {{ i18n "监听端口" .lang }}
type: integer
default: 80
ui:component:
props:
min: 1
Expand All @@ -360,6 +366,7 @@ portConf:
targetPort:
title: {{ i18n "目标端口" .lang }}
type: string
default: "80"
ui:rules:
- validator: "{{`{{`}} $self.value {{`}}`}}"
message: {{ i18n "值不能为空" .lang }}
Expand Down Expand Up @@ -399,10 +406,6 @@ portConf:
selector:
title: {{ i18n "选择器" .lang }}
type: object
required:
- associatedResources
- associatedApplications
- labels
properties:
associatedResources:
title: {{ i18n "关联资源" .lang }}
Expand Down Expand Up @@ -437,8 +440,6 @@ selector:
value: ""
actions:
- "{{`{{`}} $loadDataSource {{`}}`}}"
ui:rules:
- required
labels:
title: {{ i18n "标签选择器" .lang }}
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pvc:
ui:rules:
- required
- maxLength64
- nameRegexWithVar
- rfc1123LabelRegex
pvcName:
title: PersistentVolumeClaim
type: string
Expand Down Expand Up @@ -53,7 +53,7 @@ hostPath:
ui:rules:
- required
- maxLength128
- nameRegexWithVar
- rfc1123LabelRegex
path:
title: {{ i18n "路径或节点" .lang }}
type: string
Expand Down Expand Up @@ -105,7 +105,7 @@ configMap:
ui:rules:
- required
- maxLength128
- nameRegexWithVar
- rfc1123LabelRegex
defaultMode:
title: {{ i18n "默认模式" .lang }}
type: string
Expand Down Expand Up @@ -168,7 +168,7 @@ secret:
ui:rules:
- required
- maxLength128
- nameRegexWithVar
- rfc1123LabelRegex
defaultMode:
title: {{ i18n "默认模式" .lang }}
type: string
Expand Down Expand Up @@ -228,7 +228,7 @@ emptyDir:
ui:rules:
- required
- maxLength128
- nameRegexWithVar
- rfc1123LabelRegex
ui:component:
name: bfArray
ui:props:
Expand All @@ -248,7 +248,7 @@ nfs:
ui:rules:
- required
- maxLength128
- nameRegexWithVar
- rfc1123LabelRegex
path:
title: {{ i18n "路径" .lang }}
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ metadata:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
namespace:
title: {{ i18n "命名空间" .lang }}
type: string
Expand All @@ -63,7 +63,7 @@ metadata:
ui:rules:
- required
- maxLength64
- nameRegex
- rfc1123LabelRegex
labels:
title: {{ i18n "标签" .lang }}
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ portConf:
type: string
ui:rules:
- maxLength64
- rfc1123LabelRegex
port:
title: {{ i18n "监听端口" .lang }}
type: integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pvc:
ui:rules:
- required
- maxLength64
- nameRegex
- rfc1123LabelRegex
pvcName:
title: PersistentVolumeClaim
type: string
Expand Down Expand Up @@ -59,7 +59,7 @@ hostPath:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
path:
title: {{ i18n "路径或节点" .lang }}
type: string
Expand Down Expand Up @@ -111,7 +111,7 @@ configMap:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
defaultMode:
title: {{ i18n "默认模式" .lang }}
type: string
Expand Down Expand Up @@ -189,7 +189,7 @@ secret:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
defaultMode:
title: {{ i18n "默认模式" .lang }}
type: string
Expand Down Expand Up @@ -264,7 +264,7 @@ emptyDir:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
ui:component:
name: bfArray
ui:props:
Expand All @@ -284,7 +284,7 @@ nfs:
ui:rules:
- required
- maxLength128
- nameRegex
- rfc1123LabelRegex
path:
title: {{ i18n "路径" .lang }}
type: string
Expand Down
Loading