Merge "fix: Remove fetching fip in port list page"
This commit is contained in:
commit
73929c7978
@ -149,7 +149,6 @@
|
||||
"Backend Name": "Backend Name",
|
||||
"Backing Up": "Backing Up",
|
||||
"Backup": "Backup",
|
||||
"Backup Capacity": "Backup Capacity",
|
||||
"Backup Detail": "Backup Detail",
|
||||
"Backup Mode": "Backup Mode",
|
||||
"Backup Name": "Backup Name",
|
||||
@ -942,7 +941,6 @@
|
||||
"Maintenance": "Maintenance",
|
||||
"Manage Access": "Manage Access",
|
||||
"Manage Host": "Manage Host",
|
||||
"Manage Member": "Manage Member",
|
||||
"Manage Metadata": "Manage Metadata",
|
||||
"Manage QoS": "Manage QoS",
|
||||
"Manage Resource Types": "Manage Resource Types",
|
||||
@ -1274,7 +1272,6 @@
|
||||
"Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).",
|
||||
"Quota: Project quotas sufficient resources can be created": "Quota: Project quotas sufficient resources can be created",
|
||||
"RAM": "RAM",
|
||||
"RAM(GB)": "RAM(GB)",
|
||||
"RAM(MB)": "RAM(MB)",
|
||||
"RAW - Raw disk image format": "RAW - Raw disk image format",
|
||||
"ROUND_ROBIN": "Round Robin",
|
||||
@ -1877,8 +1874,6 @@
|
||||
"flavor": "flavor",
|
||||
"floating ip": "floating ip",
|
||||
"floating ips": "floating ips",
|
||||
"floatingip": "floatingip",
|
||||
"gigabytes": "gigabytes",
|
||||
"heat services": "heat services",
|
||||
"host aggregates": "host aggregates",
|
||||
"hypervisor": "hypervisor",
|
||||
@ -1941,7 +1936,6 @@
|
||||
"security group": "security group",
|
||||
"security group rules": "security group rules",
|
||||
"security groups": "security groups",
|
||||
"security_group": "security_group",
|
||||
"select an existing port": "select an existing port",
|
||||
"server group": "server group",
|
||||
"server groups": "server groups",
|
||||
@ -1958,7 +1952,6 @@
|
||||
"static routers": "static routers",
|
||||
"stop instance": "stop instance",
|
||||
"storage backend": "storage backend",
|
||||
"subnet": "subnet",
|
||||
"subnets": "subnets",
|
||||
"suspend instance": "suspend instance",
|
||||
"the policy is in use": "the policy is in use",
|
||||
@ -1974,7 +1967,6 @@
|
||||
"user group": "user group",
|
||||
"user groups": "user groups",
|
||||
"users": "users",
|
||||
"vCPU": "vCPU",
|
||||
"vCPUs": "vCPUs",
|
||||
"vCPUs and ram are not used for bare metal scheduling": "vCPUs and ram are not used for bare metal scheduling",
|
||||
"virtual adapter": "virtual adapter",
|
||||
|
@ -149,7 +149,6 @@
|
||||
"Backend Name": "后端名称",
|
||||
"Backing Up": "备份中",
|
||||
"Backup": "备份",
|
||||
"Backup Capacity": "备份容量(GB)",
|
||||
"Backup Detail": "备份详情",
|
||||
"Backup Mode": "备份方式",
|
||||
"Backup Name": "备份名称",
|
||||
@ -942,7 +941,6 @@
|
||||
"Maintenance": "运维管理",
|
||||
"Manage Access": "访问管理",
|
||||
"Manage Host": "管理主机",
|
||||
"Manage Member": "管理成员",
|
||||
"Manage Metadata": "管理元数据",
|
||||
"Manage QoS": "管理QoS",
|
||||
"Manage Resource Types": "管理资源类型",
|
||||
@ -1274,7 +1272,6 @@
|
||||
"Quota: Insufficient quota to create resources, please adjust resource quantity or quota(left { quota }, input { input }).": "配额:项目配额不足,无法创建资源,请进行资源数量或配额的调整(剩余{ quota },输入{ input })。",
|
||||
"Quota: Project quotas sufficient resources can be created": "配额:项目配额充足,可创建资源",
|
||||
"RAM": "内存",
|
||||
"RAM(GB)": "",
|
||||
"RAM(MB)": "内存(MB)",
|
||||
"RAW - Raw disk image format": "RAW - 原始磁盘映像格式",
|
||||
"ROUND_ROBIN": "轮询算法",
|
||||
@ -1877,8 +1874,6 @@
|
||||
"flavor": "云主机类型",
|
||||
"floating ip": "浮动IP",
|
||||
"floating ips": "浮动IP",
|
||||
"floatingip": "浮动IP",
|
||||
"gigabytes": "云硬盘容量",
|
||||
"heat services": "编排服务",
|
||||
"host aggregates": "主机集合",
|
||||
"hypervisor": "虚拟机管理器",
|
||||
@ -1941,7 +1936,6 @@
|
||||
"security group": "安全组",
|
||||
"security group rules": "安全组规则",
|
||||
"security groups": "安全组",
|
||||
"security_group": "安全组",
|
||||
"select an existing port": "选择已有网卡",
|
||||
"server group": "云主机组",
|
||||
"server groups": "云主机组",
|
||||
@ -1958,7 +1952,6 @@
|
||||
"static routers": "静态路由",
|
||||
"stop instance": "关闭云主机",
|
||||
"storage backend": "存储后端",
|
||||
"subnet": "子网",
|
||||
"subnets": "子网",
|
||||
"suspend instance": "挂起云主机",
|
||||
"the policy is in use": "策略正在使用中",
|
||||
@ -1974,7 +1967,6 @@
|
||||
"user group": "用户组",
|
||||
"user groups": "用户组",
|
||||
"users": "用户",
|
||||
"vCPU": "虚拟CPU",
|
||||
"vCPUs": "虚拟CPU",
|
||||
"vCPUs and ram are not used for bare metal scheduling": "vCPUs 和 ram 不用于裸机调度",
|
||||
"virtual adapter": "虚拟网卡",
|
||||
|
@ -1,254 +0,0 @@
|
||||
// Copyright 2021 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.
|
||||
|
||||
import React from 'react';
|
||||
import { inject, observer } from 'mobx-react';
|
||||
import { ModalAction } from 'containers/Action';
|
||||
import { PoolMemberStore } from 'stores/octavia/pool-member';
|
||||
import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter';
|
||||
import { Input } from 'antd';
|
||||
import { portStatus, portSortProps } from 'resources/port';
|
||||
|
||||
@inject('rootStore')
|
||||
@observer
|
||||
export default class MemberManagement extends ModalAction {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
memberUpdateValue: [],
|
||||
};
|
||||
}
|
||||
|
||||
static id = 'manage-mamber';
|
||||
|
||||
static title = t('Manage Member');
|
||||
|
||||
get name() {
|
||||
return t('Manage Member');
|
||||
}
|
||||
|
||||
static policy = 'os_load-balancer_api:member:put';
|
||||
|
||||
static allowed = (item) =>
|
||||
Promise.resolve(item.provisioning_status === 'ACTIVE');
|
||||
|
||||
init() {
|
||||
this.store = new VirtualAdapterStore();
|
||||
this.memberStore = new PoolMemberStore();
|
||||
this.state.sgInitValue = {
|
||||
selectedRowKeys: [],
|
||||
selectedRows: [],
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getMember();
|
||||
}
|
||||
|
||||
static get modalSize() {
|
||||
return 'large';
|
||||
}
|
||||
|
||||
async getMember() {
|
||||
// const virtualAdapter = this.store.list;
|
||||
const { default_pool_id } = this.item;
|
||||
const members = await this.memberStore.fetchList({
|
||||
pool_id: default_pool_id,
|
||||
});
|
||||
// const { members } = res;
|
||||
const memberInitValue = {
|
||||
selectedRowKeys: members.map((it) => it.address),
|
||||
selectedRows: members.map((it) => {
|
||||
it.id = it.address;
|
||||
it.member_ip = it.address;
|
||||
return it;
|
||||
}),
|
||||
};
|
||||
this.setState({
|
||||
memberInitValue,
|
||||
});
|
||||
this.updateFormValue('Member', memberInitValue);
|
||||
}
|
||||
|
||||
getModalSize() {
|
||||
return 'large';
|
||||
}
|
||||
|
||||
get item() {
|
||||
const { item } = this.props;
|
||||
if (!item) {
|
||||
return this.containerProps.detail;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
get defaultValue() {
|
||||
return {};
|
||||
}
|
||||
|
||||
get formItems() {
|
||||
const { memberInitValue, memberUpdateValue } = this.state;
|
||||
return [
|
||||
{
|
||||
name: 'Member',
|
||||
label: t('Member'),
|
||||
type: 'select-table',
|
||||
backendPageStore: this.store,
|
||||
extraParams: {
|
||||
device_owner: ['compute:nova', ''],
|
||||
addressAsIdKey: true,
|
||||
},
|
||||
initValue: memberInitValue,
|
||||
required: true,
|
||||
isMulti: true,
|
||||
tagKey: 'member_ip',
|
||||
...portSortProps,
|
||||
// filterParams:
|
||||
columns: [
|
||||
{
|
||||
title: t('IP'),
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: t('Name'),
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: t('Attach Instance'),
|
||||
dataIndex: 'server_name',
|
||||
sorter: false,
|
||||
},
|
||||
{
|
||||
title: t('IPv4 Address'),
|
||||
dataIndex: 'ipv4',
|
||||
render: (value) => value.map((it) => <div key={it}>{it}</div>),
|
||||
isHideable: true,
|
||||
stringify: (value) => value.join(','),
|
||||
sorter: false,
|
||||
},
|
||||
{
|
||||
title: t('IPv6 Address'),
|
||||
dataIndex: 'ipv6',
|
||||
render: (value) => value.map((it) => <div key={it}>{it}</div>),
|
||||
isHideable: true,
|
||||
stringify: (value) => value.join(','),
|
||||
sorter: false,
|
||||
},
|
||||
{
|
||||
title: t('Status'),
|
||||
dataIndex: 'status',
|
||||
render: (value) => portStatus[value] || value,
|
||||
},
|
||||
{
|
||||
title: t('Port'),
|
||||
dataIndex: 'protocol_port',
|
||||
sorter: false,
|
||||
render: (text, record) => {
|
||||
const { selectedRows } = memberInitValue;
|
||||
const updateMember = memberUpdateValue.filter(
|
||||
(it) => record.id === it.id
|
||||
)[0];
|
||||
const member = selectedRows.filter(
|
||||
(it) => record.id === it.id
|
||||
)[0];
|
||||
const defaultValue = member ? member.protocol_port : text;
|
||||
const value = updateMember
|
||||
? updateMember.protocol_port
|
||||
: defaultValue;
|
||||
return (
|
||||
<Input
|
||||
style={{ width: '50%' }}
|
||||
onChange={(e) =>
|
||||
this.handleChange(
|
||||
Number(e.target.value),
|
||||
record,
|
||||
'protocol_port'
|
||||
)
|
||||
}
|
||||
defaultValue={value}
|
||||
type="number"
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('Weight'),
|
||||
dataIndex: 'weight',
|
||||
sorter: false,
|
||||
render: (text, record) => {
|
||||
const { selectedRows } = memberInitValue;
|
||||
const updateMember = memberUpdateValue.filter(
|
||||
(it) => record.id === it.id
|
||||
)[0];
|
||||
const member = selectedRows.filter(
|
||||
(it) => record.id === it.id
|
||||
)[0];
|
||||
const defaultValue = member ? member.weight : text;
|
||||
const value = updateMember ? updateMember.weight : defaultValue;
|
||||
return (
|
||||
<Input
|
||||
style={{ width: '50%' }}
|
||||
onChange={(e) =>
|
||||
this.handleChange(Number(e.target.value), record, 'weight')
|
||||
}
|
||||
value={value}
|
||||
type="number"
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// handleChange = (value, record, title) => {
|
||||
// const { memberUpdateValue, memberInitValue: { selectedRows } } = this.state;
|
||||
// const update = memberUpdateValue.filter(it => record.id === it.id);
|
||||
// if (update[0]) {
|
||||
// memberUpdateValue.map((member) => {
|
||||
// if (record.id === member.id) {
|
||||
// member[title] = value;
|
||||
// }
|
||||
// return member;
|
||||
// });
|
||||
// } else {
|
||||
// // const member = selectedRows.filter(it => record.id === it.id)[0];
|
||||
// // const { weight, protocol_port } = member;
|
||||
// // record.weight = weight;
|
||||
// // record.protocol_port = protocol_port;
|
||||
// record[title] = value;
|
||||
// memberUpdateValue.push(record);
|
||||
// }
|
||||
// this.setState(memberUpdateValue);
|
||||
// }
|
||||
|
||||
onSubmit = (values) => {
|
||||
const { default_pool_id } = this.item;
|
||||
const {
|
||||
Member: { selectedRowKeys: address_group = [], selectedRows } = {},
|
||||
} = values;
|
||||
const { memberUpdateValue } = this.state;
|
||||
const members = address_group.map((address) => {
|
||||
let inputData = memberUpdateValue.filter((it) => it.id === address)[0];
|
||||
if (!inputData) {
|
||||
inputData = selectedRows.filter((it) => it.id === address)[0];
|
||||
}
|
||||
const { weight, protocol_port } = inputData;
|
||||
const ip_address = { weight, protocol_port, address };
|
||||
return ip_address;
|
||||
});
|
||||
return this.memberStore.batchUpdate({ default_pool_id, data: members });
|
||||
};
|
||||
}
|
@ -39,9 +39,6 @@ export const actionConfigs = {
|
||||
{
|
||||
action: EditHealthMonitor,
|
||||
},
|
||||
// {
|
||||
// action: MemberManagement,
|
||||
// },
|
||||
],
|
||||
},
|
||||
batchActions: [
|
||||
|
@ -84,14 +84,15 @@ export default class AssociateFip extends ModalAction {
|
||||
|
||||
handleFixedIPChange = (e) => handleFixedIPChange.call(this, e);
|
||||
|
||||
static canAssociated = (item) =>
|
||||
item.associatedDetail && item.associatedDetail.length < item.ipv4.length;
|
||||
|
||||
static allowed = (item, containerProps) => {
|
||||
const { isAdminPage = false } = containerProps;
|
||||
return Promise.resolve(
|
||||
!isAdminPage && isNotError(item) && this.canAssociated(item)
|
||||
);
|
||||
return Promise.resolve(!isAdminPage && isNotError(item) && canAssociated());
|
||||
|
||||
function canAssociated() {
|
||||
return (
|
||||
item.associatedDetail && item.associatedDetail.length < item.ipv4.length
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
onSubmit = (values) => {
|
||||
|
@ -46,13 +46,15 @@ export default class DisAssociateFip extends ModalAction {
|
||||
|
||||
static policy = 'update_floatingip';
|
||||
|
||||
static canDisassociated = (item) => item.associatedDetail.length !== 0;
|
||||
|
||||
static allowed = (item, containerProps) => {
|
||||
const { isAdminPage = false } = containerProps;
|
||||
return Promise.resolve(
|
||||
!isAdminPage && isNotError(item) && this.canDisassociated(item)
|
||||
!isAdminPage && isNotError(item) && canDisassociated()
|
||||
);
|
||||
|
||||
function canDisassociated() {
|
||||
return item.associatedDetail && item.associatedDetail.length;
|
||||
}
|
||||
};
|
||||
|
||||
get formItems() {
|
||||
|
@ -151,9 +151,8 @@ export class VirtualAdapter extends Base {
|
||||
{item.device_owner}
|
||||
<br />
|
||||
<Link
|
||||
to={`${this.getUrl('/compute/instance')}/detail/${
|
||||
item.device_id
|
||||
}?tab=interface`}
|
||||
to={`${this.getUrl('/compute/instance')}/detail/${item.device_id
|
||||
}?tab=interface`}
|
||||
>
|
||||
{`${item.device_id}`}
|
||||
{server_name && `(${server_name})`}
|
||||
@ -201,23 +200,6 @@ export class VirtualAdapter extends Base {
|
||||
dataIndex: 'mac_address',
|
||||
isHideable: true,
|
||||
},
|
||||
{
|
||||
title: t('Floating IP Address'),
|
||||
dataIndex: 'associatedDetail',
|
||||
isHideable: true,
|
||||
render: (value) =>
|
||||
value && value.length ? value[0].floating_ip_address : '-',
|
||||
sorter: false,
|
||||
},
|
||||
// {
|
||||
// title: t('Associated Resources'),
|
||||
// dataIndex: 'device_owner',
|
||||
// },
|
||||
// {
|
||||
// title: t('Created At'),
|
||||
// dataIndex: 'created_at',
|
||||
// valueRender: 'toLocalTime',
|
||||
// },
|
||||
{
|
||||
title: t('Status'),
|
||||
dataIndex: 'status',
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
import globalNetworkStore from 'stores/neutron/network';
|
||||
import { action, observable, toJS } from 'mobx';
|
||||
import { action, observable } from 'mobx';
|
||||
import globalSecurityGroupStore from 'stores/neutron/security-group';
|
||||
import globalFloatingIpsStore from 'stores/neutron/floatingIp';
|
||||
import client from 'client';
|
||||
@ -103,39 +103,6 @@ export class VirtualAdapterStore extends Base {
|
||||
});
|
||||
}
|
||||
|
||||
async listDidFetch(items, allProjects, filters) {
|
||||
if (items.length === 0) {
|
||||
return items;
|
||||
}
|
||||
const { device_id, device_owner, addressAsIdKey, network_id } = filters;
|
||||
if (device_owner || device_id || network_id) {
|
||||
// fetch fixed_ips details
|
||||
const details = await Promise.all(
|
||||
items.map((item) => {
|
||||
if (addressAsIdKey) {
|
||||
const { id, ipv4, ipv6 } = item;
|
||||
item.address_id = id;
|
||||
item.member_ip = ipv6.concat(ipv4);
|
||||
item.member_show = item.member_ip.join('、');
|
||||
// item.id = item.member_ip[0];
|
||||
}
|
||||
return Promise.all(
|
||||
item.fixed_ips.map((fixed_ip) =>
|
||||
this.getItemFloatingIPs(fixed_ip.ip_address, item.id)
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
details.forEach((detail, index) => {
|
||||
items[index].associatedDetail = [];
|
||||
detail.forEach((ip) => {
|
||||
items[index].associatedDetail.push(...toJS(ip));
|
||||
});
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
async getItemFloatingIPs(fixed_ip, portId) {
|
||||
return globalFloatingIpsStore.pureFetchList({
|
||||
fixed_ip_address: fixed_ip,
|
||||
|
Loading…
Reference in New Issue
Block a user