Merge "fix: i18n and validator for zun"

This commit is contained in:
Zuul 2022-06-09 03:42:02 +00:00 committed by Gerrit Code Review
commit 902491651e
6 changed files with 55 additions and 28 deletions

View File

@ -1670,6 +1670,7 @@
"Please input key size": "Please input key size",
"Please input metadata": "Please input metadata",
"Please input name": "Please input name",
"Please input or load Template from a file": "Please input or load Template from a file",
"Please input port range": "Please input port range",
"Please input prefix": "Please input prefix",
"Please input protocol number if it absent in select list.": "Please input protocol number if it absent in select list.",

View File

@ -292,9 +292,9 @@
"Cancel upload successfully.": "取消上传成功。",
"Capacity (GiB)": "容量(GiB)",
"Cape Verde": "佛得角",
"Capsule Detail": "Capsule 详情",
"Capsule Type": "Capsule 类型",
"Capsules": "Capsules",
"Capsule Detail": "集合详情",
"Capsule Type": "集合类型",
"Capsules": "集合",
"Cast Rules To Read Only": "规则强制只读",
"Category": "类别",
"Cayman Islands": "开曼群岛",
@ -450,7 +450,7 @@
"Create Backups": "创建备份",
"Create Bandwidth Limit Rule": "创建带宽限制规则",
"Create Bare Metal Node": "创建裸机节点",
"Create Capsule": "创建 Capsule",
"Create Capsule": "创建集合",
"Create Certificate": "创建证书",
"Create Cluster": "创建集群",
"Create Cluster Template": "创建集群模板",
@ -604,7 +604,7 @@
"Delete Backup": "删除备份",
"Delete Bandwidth Egress Rules": "删除带宽出方向限制",
"Delete Bandwidth Ingress Rules": "删除带宽入方向限制",
"Delete Capsule": "删除 Capsule",
"Delete Capsule": "删除集合",
"Delete Certificate": "删除证书",
"Delete Clusters": "删除集群",
"Delete Clusters Templates": "删除集群模板",
@ -1412,7 +1412,7 @@
"Min. Disk": "最小硬盘大小",
"Min. RAM": "最小内存",
"Minimum value is 68 for IPv4, and 1280 for IPv6.": "对于IPv4最小值是68对于IPv6最小值是1280。",
"Miscellaneous": "Miscellaneous",
"Miscellaneous": "杂项",
"Missing IP Address": "缺少IP地址",
"Missing Port": "未填写端口号",
"Missing Subnet": "未填写子网",
@ -1670,6 +1670,7 @@
"Please input key size": "请输入密钥大小",
"Please input metadata": "请输入元数据",
"Please input name": "请输入名称",
"Please input or load Template from a file": "请输入或者从文件加载模板",
"Please input port range": "请输入端口范围",
"Please input prefix": "请输入前缀",
"Please input protocol number if it absent in select list.": "如果选择列表中没有,请输入协议号。",
@ -2529,7 +2530,7 @@
"be soft rebooted": "软重启",
"be started": "启动",
"be stopped": "关闭",
"capsules": "capsules",
"capsules": "集合",
"certificate": "证书",
"cidr": "CIDR",
"cinder services": "存储服务",

View File

@ -55,7 +55,7 @@ export class BaseDetail extends Base {
value.map((it) => {
return (
<div key={it.uuid}>
<b>{t('Name')}</b> : {it.name}
<b>{t('Container Name')}</b> : {it.name}
<br />
<b>{t('Container ID')}</b>: {it.uuid}
</div>
@ -67,6 +67,8 @@ export class BaseDetail extends Base {
return {
title: t('Containers'),
options,
labelCol: 0,
contentCol: 24,
};
}

View File

@ -1,4 +1,4 @@
// Copyright 2021 99cloud
// Copyright 2022 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -24,7 +24,6 @@ export class Create extends ModalAction {
init() {
this.store = globalCapsulesStore;
this.maxSize = 1;
}
static allowed = () => Promise.resolve(true);
@ -41,37 +40,33 @@ export class Create extends ModalAction {
static policy = 'container:capsule:create';
sizeValidate = (rule, value) => {
if (!value) {
return Promise.reject(t('Please select a file'));
}
const { size } = value;
if (size <= this.maxSize * 1024 * 1024 * 1024) {
return Promise.resolve();
}
return Promise.reject(
t(
'Please upload files smaller than { size }G on the page. It is recommended to upload files over { size }G using API.',
{ size: this.maxSize }
)
);
};
get formItems() {
return [
{
name: 'template_file',
label: t('Load Template from a file'),
type: 'textarea-from-file',
rows: 6,
required: true,
accept: '.yaml',
validator: (rule, value) => {
if (!value) {
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject(
t('Please input or load Template from a file')
);
}
return Promise.resolve();
},
},
];
}
onSubmit = (values) => {
const y = getYaml(values.template_file);
const template = getYaml(values.template_file);
return this.store.create({
template: y,
template,
});
};
}

View File

@ -1,3 +1,17 @@
// Copyright 2022 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export const capsuleStatus = {
Creating: t('Creating'),
Pending: t('Pending'),

View File

@ -1,3 +1,17 @@
// Copyright 2022 99cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export const containerStatus = {
Creating: t('Creating'),
Created: t('Created'),