fix: fix subnet cidr tip

1. fix subent cidr tip when select network
2. update subnet selector style

Change-Id: I28e00000353e4929c13c74264582dc14d6e726ed
This commit is contained in:
zhangjingwei 2024-03-19 12:03:26 +08:00
parent fa29659199
commit e1a9d17f4c
2 changed files with 32 additions and 24 deletions

View File

@ -291,33 +291,26 @@ export default class NetworkSelect extends React.Component {
}
renderIp() {
const { subnet, subnets, ipType, ip } = this.state;
if (!subnet) {
const { subnet, subnets, ipType, ip, network } = this.state;
if (!network) {
return null;
}
const item = subnets.find((it) => it.id === subnet);
if (!item) {
return null;
}
const totalAllocationPools = [];
subnets.forEach((sub) => {
const { allocation_pools: pools = [] } = sub;
pools.forEach((pool) => {
totalAllocationPools.push(pool);
});
});
const { allocation_pools: pools } = item;
const details = totalAllocationPools.map((pool, index) => (
<span key={`pool.start.${index}`} style={{ marginRight: 10 }}>
{pool.start}--{pool.end}
</span>
));
const detailsDiv = pools.map((pool, index) => (
<div key={`pool.start.${index}`}>
{pool.start}--{pool.end}
</div>
));
if (ipType === 0) {
const totalAllocationPools = [];
const subnetsForCurrentNetwork = subnets.filter(
(s) => s.network_id === network
);
subnetsForCurrentNetwork.forEach((sub) => {
const { allocation_pools: pools = [] } = sub;
pools.forEach((pool) => {
totalAllocationPools.push(pool);
});
});
const details = totalAllocationPools.map((pool, index) => (
<span key={`pool.start.${index}`} style={{ marginRight: 10 }}>
{pool.start}--{pool.end}
</span>
));
const tips = (
<span>
<span className={styles.label}>{t('Allocation Pools')}: </span>
@ -326,6 +319,20 @@ export default class NetworkSelect extends React.Component {
);
return <Col span={12}>{tips}</Col>;
}
if (!subnet) {
return null;
}
const item = subnets.find((it) => it.id === subnet);
if (!item) {
return null;
}
const { allocation_pools: pools } = item;
const detailsDiv = pools.map((pool, index) => (
<div key={`pool.start.${index}`}>
{pool.start}--{pool.end}
</div>
));
const tips = (
<span>
<span className={styles.label}>{t('Allocation Pools')}: </span>

View File

@ -260,6 +260,7 @@ export class NetworkStep extends Base {
}
return Promise.resolve();
},
wrapperCol: { span: 19 },
},
{
name: 'divider1',