Merge "fix: fix the error messages for required fields in forms"
This commit is contained in:
commit
06c53e1731
@ -33,7 +33,7 @@ export default class index extends Component {
|
||||
render() {
|
||||
const { componentProps, formItemProps } = this.props;
|
||||
const { required, label } = componentProps || {};
|
||||
const placeholder = t('Please input') + label;
|
||||
const placeholder = t('Please input {label}', { label });
|
||||
const props = {
|
||||
placeholder,
|
||||
...componentProps,
|
||||
|
@ -265,7 +265,9 @@ export default class FormItem extends React.Component {
|
||||
const { selectedRowKeys = [] } = value || {};
|
||||
if (selectedRowKeys.length === 0) {
|
||||
return Promise.reject(
|
||||
new Error(rule.placeholder || `${t('Please select')}${rule.label}!`)
|
||||
new Error(
|
||||
rule.placeholder || t('Please select {label}!', { label: rule.label })
|
||||
)
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
@ -313,10 +315,12 @@ export default class FormItem extends React.Component {
|
||||
this.getSelectTableValidator({ ...rule, ...this.props }, value);
|
||||
} else if (type && type.includes('select')) {
|
||||
requiredRule.required = true;
|
||||
requiredRule.message = placeholder || `${t('Please select') + label}!`;
|
||||
requiredRule.message =
|
||||
placeholder || t('Please select {label}!', { label });
|
||||
} else if (hasRequiredCheck) {
|
||||
requiredRule.required = true;
|
||||
requiredRule.message = placeholder || `${t('Please input') + label}!`;
|
||||
requiredRule.message =
|
||||
placeholder || t('Please input {label}!', { label });
|
||||
} else if (validator) {
|
||||
newRule.required = required;
|
||||
}
|
||||
|
@ -917,7 +917,6 @@
|
||||
"External Network Info": "External Network Info",
|
||||
"External Networks": "External Networks",
|
||||
"External Port": "External Port",
|
||||
"External Port Range": "External Port Range",
|
||||
"External Port/Port Range": "External Port/Port Range",
|
||||
"Extra Infos": "Extra Infos",
|
||||
"Extra Specs": "Extra Specs",
|
||||
@ -1750,6 +1749,8 @@
|
||||
"Please input your Username!": "Please input your Username!",
|
||||
"Please input your current password!": "Please input your current password!",
|
||||
"Please input your password!": "Please input your password!",
|
||||
"Please input {label}": "Please input {label}",
|
||||
"Please input {label}!": "Please input {label}!",
|
||||
"Please make sure this IP address be available to avoid creating VM failure.": "Please make sure this IP address be available to avoid creating VM failure.",
|
||||
"Please make sure this IP address be available.": "Please make sure this IP address be available.",
|
||||
"Please reasonably plan the network and subnet to which the virtual network card belongs.": "Please reasonably plan the network and subnet to which the virtual network card belongs.",
|
||||
@ -1770,6 +1771,7 @@
|
||||
"Please select volume type": "Please select volume type",
|
||||
"Please select your Domain!": "Please select your Domain!",
|
||||
"Please select your Region!": "Please select your Region!",
|
||||
"Please select {label}!": "Please select {label}!",
|
||||
"Please select {name} first": "Please select {name} first",
|
||||
"Please set CPU && Ram first.": "Please set CPU && Ram first.",
|
||||
"Please set MUNA": "Please set MUNA",
|
||||
@ -2350,7 +2352,6 @@
|
||||
"The selected VPC/ subnet does not have IPv6 enabled.": "The selected VPC/ subnet does not have IPv6 enabled.",
|
||||
"The selected network has no subnet": "The selected network has no subnet",
|
||||
"The selected project is different from the project to which the network belongs. That is, the subnet to be created is not under the same project as the network. Please do not continue unless you are quit sure what you are doing.": "The selected project is different from the project to which the network belongs. That is, the subnet to be created is not under the same project as the network. Please do not continue unless you are quit sure what you are doing.",
|
||||
"The server {name} is locked. Please unlock first.": "The server {name} is locked. Please unlock first.",
|
||||
"The session has expired, please log in again.": "The session has expired, please log in again.",
|
||||
"The shelved offloaded instance only supports immediate deletion": "The shelved offloaded instance only supports immediate deletion",
|
||||
"The size of the external port range is required to be the same as the size of the internal port range": "The size of the external port range is required to be the same as the size of the internal port range",
|
||||
|
@ -917,7 +917,6 @@
|
||||
"External Network Info": "外部网络信息",
|
||||
"External Networks": "外部网络",
|
||||
"External Port": "源端口",
|
||||
"External Port Range": "源端口范围",
|
||||
"External Port/Port Range": "源端口/端口范围",
|
||||
"Extra Infos": "额外信息",
|
||||
"Extra Specs": "额外规格",
|
||||
@ -1750,6 +1749,8 @@
|
||||
"Please input your Username!": "请输入用户名",
|
||||
"Please input your current password!": "请输入当前密码!",
|
||||
"Please input your password!": "请输入密码!",
|
||||
"Please input {label}": "请输入{label}",
|
||||
"Please input {label}!": "请输入{label}!",
|
||||
"Please make sure this IP address be available to avoid creating VM failure.": "需检查此 IP 是否已被占用,否则可能创建失败。",
|
||||
"Please make sure this IP address be available.": "需确保此IP未被占用。",
|
||||
"Please reasonably plan the network and subnet to which the virtual network card belongs.": "请合理规划虚拟网卡所属的网络和子网。",
|
||||
@ -1770,6 +1771,7 @@
|
||||
"Please select volume type": "请选择云硬盘类型",
|
||||
"Please select your Domain!": "请选择Domain!",
|
||||
"Please select your Region!": "请选择Region!",
|
||||
"Please select {label}!": "请选择{label}!",
|
||||
"Please select {name} first": "请先选择{name}",
|
||||
"Please set CPU && Ram first.": "请先设置CPU、内存。",
|
||||
"Please set MUNA": "请设置NUMA节点",
|
||||
@ -2350,7 +2352,6 @@
|
||||
"The selected VPC/ subnet does not have IPv6 enabled.": "所选的VPC/子网未开通IPv6",
|
||||
"The selected network has no subnet": "选择的网络没有子网",
|
||||
"The selected project is different from the project to which the network belongs. That is, the subnet to be created is not under the same project as the network. Please do not continue unless you are quit sure what you are doing.": "您选择的项目与网络所属项目不一致,即您将创建的子网与网络不在同一项目下。除非你非常确认自己在做什么,否则请不要继续。",
|
||||
"The server {name} is locked. Please unlock first.": "云主机{name}已被锁定,请先解锁。",
|
||||
"The session has expired, please log in again.": "会话已过期,请重新登录。",
|
||||
"The shelved offloaded instance only supports immediate deletion": "已归档的云主机仅支持立即删除",
|
||||
"The size of the external port range is required to be the same as the size of the internal port range": "源端口范围的大小要与目标端口范围的大小相同",
|
||||
|
@ -196,10 +196,10 @@ export class Edit extends Base {
|
||||
hasRequiredCheck: true,
|
||||
};
|
||||
Object.assign(externalPortItem, inputConfig, {
|
||||
placeholder: t('Please input') + externalPortItem.label,
|
||||
placeholder: t('Please input {label}', { label: externalPortItem.label }),
|
||||
});
|
||||
Object.assign(internalPortItem, inputConfig, {
|
||||
placeholder: t('Please input') + internalPortItem.label,
|
||||
placeholder: t('Please input {label}', { label: internalPortItem.label }),
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user