Merge "fix: fix some parmas when create magnum template"

This commit is contained in:
Zuul 2022-07-05 11:23:55 +00:00 committed by Gerrit Code Review
commit 09714ca08d
7 changed files with 125 additions and 97 deletions

View File

@ -698,6 +698,7 @@
"Details *": "Details *", "Details *": "Details *",
"Device ID": "Device ID", "Device ID": "Device ID",
"Device Owner": "Device Owner", "Device Owner": "Device Owner",
"Devicemapper": "Devicemapper",
"Direct": "Direct", "Direct": "Direct",
"Direction": "Direction", "Direction": "Direction",
"Disable": "Disable", "Disable": "Disable",
@ -2023,6 +2024,7 @@
"Share Type ID": "Share Type ID", "Share Type ID": "Share Type ID",
"Share Type Name": "Share Type Name", "Share Type Name": "Share Type Name",
"Share Types": "Share Types", "Share Types": "Share Types",
"Share group": "Share group",
"Shared": "Shared", "Shared": "Shared",
"Shared Image": "Shared Image", "Shared Image": "Shared Image",
"Shared Network": "Shared Network", "Shared Network": "Shared Network",
@ -2234,6 +2236,7 @@
"The ip of external members can be any, including the public network ip.": "The ip of external members can be any, including the public network ip.", "The ip of external members can be any, including the public network ip.": "The ip of external members can be any, including the public network ip.",
"The kill signal to send": "The kill signal to send", "The kill signal to send": "The kill signal to send",
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.", "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.",
"The min size is {size} GiB": "The min size is {size} GiB",
"The name cannot be modified after creation": "The name cannot be modified after creation", "The name cannot be modified after creation": "The name cannot be modified after creation",
"The name of the physical network to which a port is connected": "The name of the physical network to which a port is connected", "The name of the physical network to which a port is connected": "The name of the physical network to which a port is connected",
"The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"", "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"",

View File

@ -698,6 +698,7 @@
"Details *": "详情 *", "Details *": "详情 *",
"Device ID": "设备ID", "Device ID": "设备ID",
"Device Owner": "设备所属者", "Device Owner": "设备所属者",
"Devicemapper": "设备映射",
"Direct": "方向", "Direct": "方向",
"Direction": "方向", "Direction": "方向",
"Disable": "禁用", "Disable": "禁用",
@ -729,8 +730,8 @@
"Do not set with a backend": "不设置后端", "Do not set with a backend": "不设置后端",
"Docker": "Docker", "Docker": "Docker",
"Docker Storage Driver": "Docker存储驱动程序", "Docker Storage Driver": "Docker存储驱动程序",
"Docker Swarm": "Docker集群", "Docker Swarm": "Docker Swarm",
"Docker Swarm Mode": "Docker集群模式", "Docker Swarm Mode": "Docker Swarm Mode",
"Docker Volume Size": "Docker硬盘大小", "Docker Volume Size": "Docker硬盘大小",
"Docker Volume Size (GiB)": "Docker硬盘大小(GiB)", "Docker Volume Size (GiB)": "Docker硬盘大小(GiB)",
"Domain": "域", "Domain": "域",
@ -924,7 +925,7 @@
"Flavors": "云主机类型", "Flavors": "云主机类型",
"Floating IP": "浮动IP", "Floating IP": "浮动IP",
"Floating IP Address": "浮动IP地址", "Floating IP Address": "浮动IP地址",
"Floating IP Enabled": "启用浮动IP", "Floating IP Enabled": "允许浮动IP",
"Floating IPs": "浮动IP", "Floating IPs": "浮动IP",
"Floating Ip": "浮动IP", "Floating Ip": "浮动IP",
"Floating Ip Address": "浮动IP地址", "Floating Ip Address": "浮动IP地址",
@ -1375,8 +1376,8 @@
"Master Count": "主数量", "Master Count": "主数量",
"Master Flavor": "主类型", "Master Flavor": "主类型",
"Master Flavor ID": "主类型ID", "Master Flavor ID": "主类型ID",
"Master LB": "主LB", "Master LB": "主负载均衡",
"Master LB Enabled": "主LB启用", "Master LB Enabled": "允许主负载均衡",
"Mauritania": "毛里塔尼亚", "Mauritania": "毛里塔尼亚",
"Mauritius": "毛里求斯", "Mauritius": "毛里求斯",
"Max Avail": "最大可用量", "Max Avail": "最大可用量",
@ -1502,7 +1503,7 @@
"No Console": "", "No Console": "",
"No Monitor": "无监控", "No Monitor": "无监控",
"No Outputs": "无输出", "No Outputs": "无输出",
"No Proxy": "代理", "No Proxy": "代理",
"No Raid": "", "No Raid": "",
"No State": "无状态", "No State": "无状态",
"No Task": "空闲", "No Task": "空闲",
@ -2023,6 +2024,7 @@
"Share Type ID": "共享类型ID", "Share Type ID": "共享类型ID",
"Share Type Name": "共享类型名称", "Share Type Name": "共享类型名称",
"Share Types": "共享类型", "Share Types": "共享类型",
"Share group": "",
"Shared": "共享", "Shared": "共享",
"Shared Image": "共享镜像", "Shared Image": "共享镜像",
"Shared Network": "共享网络", "Shared Network": "共享网络",
@ -2234,6 +2236,7 @@
"The ip of external members can be any, including the public network ip.": "外部成员的IP可以是任何IP包括公网IP。", "The ip of external members can be any, including the public network ip.": "外部成员的IP可以是任何IP包括公网IP。",
"The kill signal to send": "要发送的终止信号", "The kill signal to send": "要发送的终止信号",
"The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68IPv6最小1280。", "The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6.": "地址片段的最大传输单位。IPv4最小68IPv6最小1280。",
"The min size is {size} GiB": "最小内存为 {size} GiB",
"The name cannot be modified after creation": "名称创建后不可修改", "The name cannot be modified after creation": "名称创建后不可修改",
"The name of the physical network to which a port is connected": "端口连接到的物理网络的名称", "The name of the physical network to which a port is connected": "端口连接到的物理网络的名称",
"The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "名称应包含字母或数字,长度为 1 到 16且字符只能包含“0-9、a-z、A-Z、-、_”。", "The name should contain letter or number, the length is 1 to 16, characters can only contain \"0-9, a-z, A-Z, -, _.\"": "名称应包含字母或数字,长度为 1 到 16且字符只能包含“0-9、a-z、A-Z、-、_”。",

View File

@ -20,6 +20,12 @@ export class BaseDetail extends Base {
return [this.baseInfoCard, this.networkCard]; return [this.baseInfoCard, this.networkCard];
} }
get leftCardsStyle() {
return {
flex: 1,
};
}
get rightCards() { get rightCards() {
return [this.specCard, this.labelCard]; return [this.specCard, this.labelCard];
} }

View File

@ -19,7 +19,7 @@ import { StepCreate as Base } from './StepCreate';
export class Edit extends Base { export class Edit extends Base {
static id = 'update-cluster-template'; static id = 'update-cluster-template';
static title = t('Update Cluster Template'); static title = t('Edit');
get name() { get name() {
return t('Update Cluster Template'); return t('Update Cluster Template');

View File

@ -65,7 +65,6 @@ export class StepInfo extends Base {
label: t('Cluster Template Name'), label: t('Cluster Template Name'),
type: 'input', type: 'input',
placeholder: t('Cluster Template Name'), placeholder: t('Cluster Template Name'),
required: true,
}, },
{ {
name: 'coe', name: 'coe',

View File

@ -19,10 +19,8 @@ import globalSubnetStore from 'src/stores/neutron/subnet';
export class StepNetwork extends Base { export class StepNetwork extends Base {
async init() { async init() {
const { extra: { fixed_network } = {} } = this.props; this.getNetworkList();
this.state.selectedSubnetId = fixed_network || ''; this.getSubnetList();
this.getFloatingIps();
this.getSubnets();
} }
get title() { get title() {
@ -41,11 +39,11 @@ export class StepNetwork extends Base {
return !!this.props.extra; return !!this.props.extra;
} }
async getFloatingIps() { async getNetworkList() {
globalNetworkStore.fetchList(); await globalNetworkStore.fetchList();
} }
get getFloatingIpList() { get externalNetworks() {
return (globalNetworkStore.list.data || []) return (globalNetworkStore.list.data || [])
.filter( .filter(
(it) => (it) =>
@ -58,7 +56,7 @@ export class StepNetwork extends Base {
})); }));
} }
get getPrivateFloatingIpList() { get privateNetworks() {
return (globalNetworkStore.list.data || []) return (globalNetworkStore.list.data || [])
.filter( .filter(
(it) => (it) =>
@ -68,60 +66,44 @@ export class StepNetwork extends Base {
.map((it) => ({ .map((it) => ({
value: it.id, value: it.id,
label: it.name, label: it.name,
subnetId: it.subnets,
})); }));
} }
async getSubnets() { async getSubnetList() {
globalSubnetStore.fetchList(); await globalSubnetStore.fetchList();
} }
get getSubnetList() { get subnetList() {
const { fixed_network } = this.state;
return (globalSubnetStore.list.data || []) return (globalSubnetStore.list.data || [])
.filter((it) => this.state.selectedSubnetId === it.network_id) .filter((it) => fixed_network === it.network_id)
.map((it) => ({ .map((it) => ({
value: it.id, value: it.id,
label: it.name, label: it.name,
})); }));
} }
onSelectChangeFixedNetwork(value) { get networkDrivers() {
this.setState({ const { context: { coe = '' } = {} } = this.props;
selectedSubnetId: value, let acceptedDrivers = [];
}); if (coe === 'kubernetes') {
this.resetFormValue(['fixed_subnet']); acceptedDrivers = [
{ value: 'calico', label: 'Calico' },
{ value: 'flannel', label: 'Flannel' },
];
} else if (['swarm', 'swarm-mode'].includes(coe)) {
acceptedDrivers = [
{ value: 'docker', label: 'Docker' },
{ value: 'flannel', label: 'Flannel' },
];
} else if (['mesos', 'dcos'].includes(coe)) {
acceptedDrivers = [{ value: 'docker', label: 'Docker' }];
}
return acceptedDrivers;
} }
get getNetworkDriver() { get nameForStateUpdate() {
const { context = {} } = this.props; return ['fixed_network'];
const { coeSelectRows = '', coe = '' } = context;
const networkDriver = [];
if (!coeSelectRows || !coe) {
networkDriver.push(
{ val: 'docker', name: 'Docker' },
{ val: 'flannel', name: 'Flannel' },
{ val: 'calico', name: 'Calico' }
);
}
if (coeSelectRows === 'swarm' || coeSelectRows === 'swarm-mode') {
networkDriver.push(
{ val: 'docker', name: 'Docker' },
{ val: 'flannel', name: 'Flannel' }
);
}
if (coeSelectRows === 'kubernetes') {
networkDriver.push(
{ val: 'calico', name: 'Calico' },
{ val: 'flannel', name: 'Flannel' }
);
}
if (coeSelectRows === 'mesos' || coeSelectRows === 'dcos') {
networkDriver.push({ val: 'docker', name: 'Docker' });
}
return (networkDriver || []).map((it) => ({
value: it.val,
label: it.name,
}));
} }
get defaultValue() { get defaultValue() {
@ -159,14 +141,14 @@ export class StepNetwork extends Base {
} }
get formItems() { get formItems() {
const { extra: { network_driver, external_network_id } = {} } = this.props; const { extra: { network_driver } = {} } = this.props;
return [ return [
{ {
name: 'network_driver', name: 'network_driver',
label: t('Network Driver'), label: t('Network Driver'),
placeholder: t('Choose a Network Driver'), placeholder: t('Choose a Network Driver'),
type: 'select', type: 'select',
options: this.getNetworkDriver, options: this.networkDrivers,
disabled: network_driver && this.isEdit, disabled: network_driver && this.isEdit,
}, },
{ {
@ -192,23 +174,26 @@ export class StepNetwork extends Base {
label: t('External Network'), label: t('External Network'),
placeholder: t('Choose a External Network'), placeholder: t('Choose a External Network'),
type: 'select', type: 'select',
options: this.getFloatingIpList, options: this.externalNetworks,
disabled: external_network_id && this.isEdit, disabled: this.isEdit,
required: true,
}, },
{ {
name: 'fixed_network', name: 'fixed_network',
label: t('Fixed Network'), label: t('Fixed Network'),
placeholder: t('Choose a Private Network'), placeholder: t('Choose a Private Network'),
type: 'select', type: 'select',
options: this.getPrivateFloatingIpList, options: this.privateNetworks,
onChange: (val) => this.onSelectChangeFixedNetwork(val), onChange: () => {
this.updateFormValue('fixed_subnet', null);
},
}, },
{ {
name: 'fixed_subnet', name: 'fixed_subnet',
label: t('Fixed Subnet'), label: t('Fixed Subnet'),
placeholder: t('Choose a Private Network at first'), placeholder: t('Choose a Private Network at first'),
type: 'select', type: 'select',
options: this.getSubnetList, options: this.subnetList,
}, },
{ {
name: 'dns_nameserver', name: 'dns_nameserver',

View File

@ -21,8 +21,8 @@ import FlavorSelectTable from 'src/pages/compute/containers/Instance/components/
export class StepNodeSpec extends Base { export class StepNodeSpec extends Base {
init() { init() {
this.getImageOsDistro(); this.getImageList();
this.getKeypairs(); this.getKeypairsList();
} }
get title() { get title() {
@ -33,10 +33,6 @@ export class StepNodeSpec extends Base {
return t('Node Spec'); return t('Node Spec');
} }
async getImageOsDistro() {
globalImageStore.fetchList();
}
get isStep() { get isStep() {
return true; return true;
} }
@ -45,46 +41,53 @@ export class StepNodeSpec extends Base {
return !!this.props.extra; return !!this.props.extra;
} }
get getImageOsDistroList() { async getImageList() {
await globalImageStore.fetchList();
}
get imageList() {
const { context: { coe = '' } = {} } = this.props;
let acceptedOs = [];
if (coe === 'kubernetes') {
acceptedOs = ['fedora', 'coreos'];
} else if (['swarm', 'swarm-mode'].includes(coe)) {
acceptedOs = ['fedora'];
} else if (['mesos', 'dcos'].includes(coe)) {
acceptedOs = ['ubuntu'];
}
return (globalImageStore.list.data || []) return (globalImageStore.list.data || [])
.filter((it) => it.name.indexOf('coreos') >= 0) .filter(
.filter((it) => it.owner === this.currentProjectId) (it) =>
it.owner === this.currentProjectId &&
acceptedOs.includes(it.os_distro)
)
.map((it) => ({ .map((it) => ({
value: it.id, value: it.id,
label: it.name, label: it.name,
})); }));
} }
async getKeypairs() { async getKeypairsList() {
globalKeypairStore.fetchList(); await globalKeypairStore.fetchList();
} }
get getKeypairList() { get keypairsList() {
return (globalKeypairStore.list.data || []).map((it) => ({ return (globalKeypairStore.list.data || []).map((it) => ({
value: it.name, value: it.name,
label: it.name, label: it.name,
})); }));
} }
get getVolumeDriver() { get volumeDrivers() {
const { context = {} } = this.props; const { context: { coe = '' } = {} } = this.props;
const { coeSelectRows = '', coe = '' } = context; let acceptedVolumeDriver = [];
const volumeDriver = []; if (coe === 'kubernetes') {
if (!coeSelectRows || !coe) { acceptedVolumeDriver = [{ value: 'cinder', label: 'Cinder' }];
volumeDriver.push( } else if (['swarm', 'mesos'].includes(coe)) {
{ val: 'cinder', name: 'Cinder' }, acceptedVolumeDriver = [{ value: 'rexray', label: 'Rexray' }];
{ val: 'rexray', name: 'Rexray' }
);
} }
if (coeSelectRows === 'kubernetes') { return acceptedVolumeDriver;
volumeDriver.push({ val: 'cinder', name: 'Cinder' });
} else if (coeSelectRows) {
volumeDriver.push({ val: 'rexray', name: 'Rexray' });
}
return (volumeDriver || []).map((it) => ({
value: it.val,
label: it.name,
}));
} }
onFlavorChange = (value) => { onFlavorChange = (value) => {
@ -125,20 +128,29 @@ export class StepNodeSpec extends Base {
return values; return values;
} }
get minVolumeSize() {
const { docker_storage_driver } = this.state;
return docker_storage_driver === 'devicemapper' ? 3 : 1;
}
get nameForStateUpdate() {
return ['docker_storage_driver'];
}
get formItems() { get formItems() {
return [ return [
{ {
name: 'image_id', name: 'image_id',
label: t('Image'), label: t('Image'),
type: 'select', type: 'select',
options: this.getImageOsDistroList, options: this.imageList,
required: true, required: true,
}, },
{ {
name: 'keypair_id', name: 'keypair_id',
label: t('Keypair'), label: t('Keypair'),
type: 'select', type: 'select',
options: this.getKeypairList, options: this.keypairsList,
}, },
{ {
name: 'flavor', name: 'flavor',
@ -156,13 +168,17 @@ export class StepNodeSpec extends Base {
name: 'volume_driver', name: 'volume_driver',
label: t('Volume Driver'), label: t('Volume Driver'),
type: 'select', type: 'select',
options: this.getVolumeDriver, options: this.volumeDrivers,
}, },
{ {
name: 'docker_storage_driver', name: 'docker_storage_driver',
label: t('Docker Storage Driver'), label: t('Docker Storage Driver'),
type: 'select', type: 'select',
options: [ options: [
{
label: t('Devicemapper'),
value: 'devicemapper',
},
{ {
label: t('Overlay'), label: t('Overlay'),
value: 'overlay', value: 'overlay',
@ -172,13 +188,29 @@ export class StepNodeSpec extends Base {
value: 'overlay2', value: 'overlay2',
}, },
], ],
onChange: () => {
this.resetFormValue(['docker_volume_size']);
},
}, },
{ {
name: 'docker_volume_size', name: 'docker_volume_size',
label: t('Docker Volume Size (GiB)'), label: t('Docker Volume Size (GiB)'),
type: 'input-int', type: 'input-int',
min: 1, min: this.minVolumeSize,
placeholder: t('Spec'), placeholder: t('Spec'),
validator: (rule, value) => {
if (
this.minVolumeSize === 3 &&
(!value || value < this.minVolumeSize)
) {
return Promise.reject(
new Error(
t('The min size is {size} GiB', { size: this.minVolumeSize })
)
);
}
return Promise.resolve();
},
}, },
]; ];
} }