diff --git a/docs/en/test/2-catalog-introduction.md b/docs/en/test/2-catalog-introduction.md index 6fabac4e..c9294875 100644 --- a/docs/en/test/2-catalog-introduction.md +++ b/docs/en/test/2-catalog-introduction.md @@ -46,7 +46,7 @@ test │ │ │ ├── router.spec.js (Router) │ │ │ ├── security-group.spec.js (Security group) │ │ │ ├── topology.spec.js (Network topology) -│ │ │ ├── virtual-adapter.spec.js (Virtual Adapter) +│ │ │ ├── port.spec.js (Virtual Adapter) │ │ │ └── vpn.spec.js (VPN) │ │ └── storage (Storage) │ │ ├── backup.spec.js (Backup) diff --git a/docs/en/test/3-4-E2E-resource-operation.md b/docs/en/test/3-4-E2E-resource-operation.md index 84fa1e5f..b2359f67 100644 --- a/docs/en/test/3-4-E2E-resource-operation.md +++ b/docs/en/test/3-4-E2E-resource-operation.md @@ -36,7 +36,7 @@ In the E2E process, when creating a resource, it is often necessary to create th - `createNetworkPolicy` - Create network QoS policy - Parameter `name`, the name of the strategy - - Take virtual adapter modification QoS as an example: `test/e2e/integration/pages/network/virtual-adapter.spec.js` + - Take virtual adapter modification QoS as an example: `test/e2e/integration/pages/network/port.spec.js` - Created a policy named `policyName` in preparation for modifying QoS ```javascript @@ -119,7 +119,7 @@ In the E2E process, when creating a resource, it is often necessary to create th - `createSecurityGroup` - Create a security group - Parameter `name`, the name of the security group - - Take the virtual adapter card as an example: `test/e2e/integration/pages/network/virtual-adapter.spec.js` + - Take the virtual adapter card as an example: `test/e2e/integration/pages/network/port.spec.js` -To test management security group, you need to prepare the security group first ```javascript @@ -249,7 +249,7 @@ In the E2E process, when creating a resource, it is often necessary to create th router: routerListUrl, networkQosPolicy: policyListUrl, fip: fipListUrl, - virtualAdapter: virtualAdapterListUrl, + port: portListUrl, // security securityGroup: securityGroupListUrl, diff --git a/docs/zh/test/2-catalog-introduction.md b/docs/zh/test/2-catalog-introduction.md index 84f6d9b9..e6fb69f1 100644 --- a/docs/zh/test/2-catalog-introduction.md +++ b/docs/zh/test/2-catalog-introduction.md @@ -46,7 +46,7 @@ test │ │ │ ├── router.spec.js (路由器) │ │ │ ├── security-group.spec.js (安全组) │ │ │ ├── topology.spec.js (网络拓扑) -│ │ │ ├── virtual-adapter.spec.js (虚拟网卡) +│ │ │ ├── port.spec.js (端口) │ │ │ └── vpn.spec.js (VPN) │ │ └── storage (存储) │ │ ├── backup.spec.js (备份) diff --git a/docs/zh/test/3-4-E2E-resource-operation.md b/docs/zh/test/3-4-E2E-resource-operation.md index 9165599b..200d2eb0 100644 --- a/docs/zh/test/3-4-E2E-resource-operation.md +++ b/docs/zh/test/3-4-E2E-resource-operation.md @@ -36,7 +36,7 @@ - `createNetworkPolicy` - 创建网络QoS策略 - 参数`name`,策略的名称 - - 以虚拟网卡修改QoS为例`test/e2e/integration/pages/network/virtual-adapter.spec.js`为例 + - 以端口修改QoS为例`test/e2e/integration/pages/network/port.spec.js`为例 - 创建了名称为`policyName`的策略,为修改QoS做准备 ```javascript @@ -119,7 +119,7 @@ - `createSecurityGroup` - 创建安全组 - 参数`name`,安全组的名称 - - 以虚拟网卡`test/e2e/integration/pages/network/virtual-adapter.spec.js`为例 + - 以虚拟网卡`test/e2e/integration/pages/network/port.spec.js`为例 - 测试管理安全组,需要先准备好安全组 ```javascript @@ -249,7 +249,7 @@ router: routerListUrl, networkQosPolicy: policyListUrl, fip: fipListUrl, - virtualAdapter: virtualAdapterListUrl, + port: portListUrl, // security securityGroup: securityGroupListUrl, diff --git a/src/components/FormItem/MemberAllocator/index.jsx b/src/components/FormItem/MemberAllocator/index.jsx index 20868974..07fc78c5 100644 --- a/src/components/FormItem/MemberAllocator/index.jsx +++ b/src/components/FormItem/MemberAllocator/index.jsx @@ -71,7 +71,7 @@ const MemberAllocator = ({ componentProps, formItemProps }) => { dataIndex: 'name', render: (n, record) => (
-
{getLink('virtualAdapterDetail', record)}
+
{getLink('portDetail', record)}
{n || '-'}
), diff --git a/src/components/MagicInput/index.less b/src/components/MagicInput/index.less index 949603dc..741a37f6 100644 --- a/src/components/MagicInput/index.less +++ b/src/components/MagicInput/index.less @@ -2,6 +2,7 @@ .magic-input-outer-wrapper { display: flex; + align-items: center; } .magic-input-wrapper { diff --git a/src/layouts/admin-menu.jsx b/src/layouts/admin-menu.jsx index 4016238c..5d271977 100644 --- a/src/layouts/admin-menu.jsx +++ b/src/layouts/admin-menu.jsx @@ -296,17 +296,17 @@ const renderMenu = (t) => { ], }, { - path: '/network/virtual_adapter_admin', - name: t('Virtual Adapters'), - key: 'virtualAdapterAdmin', + path: '/network/port-admin', + name: t('Ports'), + key: 'port', level: 1, children: [ { - path: /^\/network\/virtual_adapter_admin\/detail\/.[^/]+$/, - name: t('Virtual Adapter Detail'), - key: 'virtualAdapterDetailAdmin', + path: /^\/network\/port-admin\/detail\/.[^/]+$/, + name: t('Port Detail'), + key: 'portDetailAdmin', level: 2, - routePath: '/network/virtual_adapter_admin/detail/:id', + routePath: '/network/port-admin/detail/:id', }, ], }, diff --git a/src/layouts/menu.jsx b/src/layouts/menu.jsx index 365cd981..91ad82c2 100644 --- a/src/layouts/menu.jsx +++ b/src/layouts/menu.jsx @@ -262,17 +262,17 @@ const renderMenu = (t) => { ], }, { - path: '/network/virtual_adapter', - name: t('Virtual Adapters'), - key: 'virtualAdapter', + path: '/network/port', + name: t('Ports'), + key: 'port', level: 1, children: [ { - path: /^\/network\/virtual_adapter\/detail\/.[^/]+$/, - name: t('Virtual Adapter Detail'), - key: 'virtualAdapterDetail', + path: /^\/network\/port\/detail\/.[^/]+$/, + name: t('Port Detail'), + key: 'portDetail', level: 2, - routePath: '/network/virtual_adapter/detail/:id', + routePath: '/network/port/detail/:id', }, ], }, diff --git a/src/locales/en.json b/src/locales/en.json index 53e6ff96..9a21be46 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -428,7 +428,6 @@ "Container Deleting": "Container Deleting", "Container Detail": "Container Detail", "Container Format": "Container Format", - "Container ID": "Container ID", "Container Killing": "Container Killing", "Container Name": "Container Name", "Container Orchestration Engine": "Container Orchestration Engine", @@ -581,6 +580,7 @@ "DELETE FAILED": "DELETE FAILED", "DELETE_IN PROGRESS": "DELETE_IN PROGRESS", "DHCP": "DHCP", + "DHCP Agent": "DHCP Agent", "DHCP Agents": "DHCP Agents", "DISK IOPS": "DISK IOPS", "DISK Usage(%)": "DISK Usage(%)", @@ -987,6 +987,7 @@ "French Guiana": "French Guiana", "French Polynesia": "French Polynesia", "Frequent login failure will cause the account to be temporarily locked, please operate after 5 minutes": "Frequent login failure will cause the account to be temporarily locked, please operate after 5 minutes", + "From port": "From port", "Front End": "Front End", "Frontend": "Frontend", "Full": "Full", @@ -1333,7 +1334,6 @@ "Liechtenstein": "Liechtenstein", "Lifetime": "Lifetime", "Lifetime Value": "Lifetime Value", - "Links": "Links", "Listener": "Listener", "Listener Connection Limit": "Listener Connection Limit", "Listener Description": "Listener Description", @@ -2437,6 +2437,7 @@ "Unattached": "Unattached", "Unavailable": "Unavailable", "Unbootable": "Unbootable", + "Unbounded": "Unbounded", "United Arab Emirates": "United Arab Emirates", "United Kingdom": "United Kingdom", "United States": "United States", @@ -2542,17 +2543,15 @@ "View": "View", "View Detail": "View Detail", "View Rules": "View Rules", + "View virtual adapters": "View virtual adapters", "Virgin Islands (U.S.)": "Virgin Islands (U.S.)", "Virtual Adapter": "Virtual Adapter", - "Virtual Adapter Detail": "Virtual Adapter Detail", "Virtual Adapter ID": "Virtual Adapter ID", - "Virtual Adapters": "Virtual Adapters", "Virtual LAN": "Virtual LAN", "Virtual LANs": "Virtual LANs", "Virtual Resource Overview": "Virtual Resource Overview", "Virtual Resources Used": "Virtual Resources Used", "Virtual adapter mainly used for binding instance and other operations, occupying the quota of the port.": "Virtual adapter mainly used for binding instance and other operations, occupying the quota of the port.", - "VirtualAdapter Mac": "VirtualAdapter Mac", "Visibility": "Visibility", "Visualization Compute Optimized Type with GPU": "Visualization Compute Optimized Type with GPU", "Volume": "Volume", @@ -2876,8 +2875,6 @@ "users": "users", "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", - "virtual adapters": "virtual adapters", "volume": "volume", "volume backup": "volume backup", "volume backups": "volume backups", diff --git a/src/locales/zh.json b/src/locales/zh.json index 2aba60cb..90208fe2 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -428,7 +428,6 @@ "Container Deleting": "容器删除中", "Container Detail": "容器详情", "Container Format": "容器格式", - "Container ID": "容器ID", "Container Killing": "容器终止中", "Container Name": "容器名称", "Container Orchestration Engine": "容器编排引擎", @@ -581,6 +580,7 @@ "DELETE FAILED": "删除失败", "DELETE_IN PROGRESS": "删除中", "DHCP": "DHCP", + "DHCP Agent": "DHCP服务", "DHCP Agents": "DHCP服务", "DISK IOPS": "硬盘IOPS", "DISK Usage(%)": "硬盘使用率(%)", @@ -987,6 +987,7 @@ "French Guiana": "法属圭亚那", "French Polynesia": "法属玻里尼西亚", "Frequent login failure will cause the account to be temporarily locked, please operate after 5 minutes": "频繁登陆失败会导致账户暂时锁定,请 5min 后再操作", + "From port": "从端口自动获取", "Front End": "前端", "Frontend": "前端", "Full": "爆满", @@ -1333,7 +1334,6 @@ "Liechtenstein": "列支敦士登", "Lifetime": "生存期", "Lifetime Value": "生存期值", - "Links": "链接", "Listener": "监听器", "Listener Connection Limit": "监听器连接限制", "Listener Description": "监听器描述", @@ -2437,6 +2437,7 @@ "Unattached": "未挂载", "Unavailable": "不可用", "Unbootable": "不可启动", + "Unbounded": "未绑定", "United Arab Emirates": "阿拉伯联合酋长国", "United Kingdom": "英国", "United States": "美国", @@ -2542,17 +2543,15 @@ "View": "查看", "View Detail": "查看详情", "View Rules": "查看规则", + "View virtual adapters": "仅查看虚拟网卡", "Virgin Islands (U.S.)": "维尔京群岛", "Virtual Adapter": "虚拟网卡", - "Virtual Adapter Detail": "虚拟网卡详情", "Virtual Adapter ID": "虚拟网卡ID", - "Virtual Adapters": "虚拟网卡", "Virtual LAN": "虚拟网卡", "Virtual LANs": "块虚拟网卡", "Virtual Resource Overview": "虚拟资源总览", "Virtual Resources Used": "虚拟资源用量", "Virtual adapter mainly used for binding instance and other operations, occupying the quota of the port.": "虚拟网卡,主要用于绑定云主机等操作,占用端口的配额。", - "VirtualAdapter Mac": "虚拟网卡的MAC", "Visibility": "可见性", "Visualization Compute Optimized Type with GPU": "GPU虚拟化型", "Volume": "云硬盘", @@ -2876,8 +2875,6 @@ "users": "用户", "vCPUs": "虚拟CPU", "vCPUs and ram are not used for bare metal scheduling": "vCPUs 和 ram 不用于裸机调度", - "virtual adapter": "虚拟网卡", - "virtual adapters": "虚拟网卡", "volume": "云硬盘", "volume backup": "云硬盘备份", "volume backups": "云硬盘备份", diff --git a/src/pages/compute/containers/Instance/Detail/index.jsx b/src/pages/compute/containers/Instance/Detail/index.jsx index 9ee72cf6..c230fff6 100644 --- a/src/pages/compute/containers/Instance/Detail/index.jsx +++ b/src/pages/compute/containers/Instance/Detail/index.jsx @@ -22,7 +22,7 @@ import { ServerStore } from 'stores/nova/instance'; import Base from 'containers/TabDetail'; import Volumes from 'pages/storage/containers/Volume'; import FloatingIps from 'pages/network/containers/FloatingIp'; -import VirtualAdapter from 'pages/network/containers/VirtualAdapter'; +import VirtualAdapter from 'pages/network/containers/Port'; import actionConfigsRecycleBin from 'pages/management/containers/RecycleBin/actions'; import { toJS } from 'mobx'; import BaseDetail from './BaseDetail'; diff --git a/src/pages/compute/containers/Instance/actions/ManageSecurityGroup.jsx b/src/pages/compute/containers/Instance/actions/ManageSecurityGroup.jsx index 583820d0..2802bdf3 100644 --- a/src/pages/compute/containers/Instance/actions/ManageSecurityGroup.jsx +++ b/src/pages/compute/containers/Instance/actions/ManageSecurityGroup.jsx @@ -16,8 +16,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; import globalServerStore from 'stores/nova/instance'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; -import { PortStore } from 'stores/neutron/port'; +import { PortStore } from 'stores/neutron/port-extension'; import { SecurityGroupStore } from 'stores/neutron/security-group'; import { portStatus } from 'resources/neutron/port'; import { @@ -36,8 +35,7 @@ export class ManageSecurityGroup extends ModalAction { init() { this.store = globalServerStore; this.securityGroupStore = new SecurityGroupStore(); - this.portStore = new VirtualAdapterStore(); - this.portStoreOrigin = new PortStore(); + this.portStore = new PortStore(); this.getPorts(); this.securityGroupMap = {}; } @@ -45,21 +43,16 @@ export class ManageSecurityGroup extends ModalAction { static policy = 'update_port'; getPorts() { - Promise.all([ - this.portStore.fetchList({ device_id: this.item.id }), - this.portStoreOrigin.fetchList({ device_id: this.item.id }), - ]); + this.portStore.fetchList({ device_id: this.item.id }); } get ports() { const portsBeauty = toJS(this.portStore.list.data) || []; - const portsOrigin = toJS(this.portStoreOrigin.list.data) || []; return portsBeauty.map((port) => { - const originPort = portsOrigin.find((it) => it.id === port.id); return { ...port, name: port.id, - security_groups: originPort.security_groups, + security_groups: port.origin_data.security_groups, }; }); } @@ -140,8 +133,7 @@ export class ManageSecurityGroup extends ModalAction { type: 'select-table', required: true, data: this.ports, - isLoading: - this.portStore.list.isLoading && this.portStoreOrigin.list.isLoading, + isLoading: this.portStore.list.isLoading, isMulti: false, onChange: this.onPortChange, filterParams: [ diff --git a/src/pages/compute/containers/Instance/actions/StepCreate/NetworkStep/index.jsx b/src/pages/compute/containers/Instance/actions/StepCreate/NetworkStep/index.jsx index d271b9f6..4b36c7d4 100644 --- a/src/pages/compute/containers/Instance/actions/StepCreate/NetworkStep/index.jsx +++ b/src/pages/compute/containers/Instance/actions/StepCreate/NetworkStep/index.jsx @@ -18,7 +18,7 @@ import { isEmpty, isArray } from 'lodash'; import { NetworkStore } from 'stores/neutron/network'; import { SubnetStore } from 'stores/neutron/subnet'; import { SecurityGroupStore } from 'stores/neutron/security-group'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import { ipValidate } from 'utils/validate'; import Base from 'components/Form'; import NetworkSelect from 'components/FormItem/NetworkSelect'; @@ -38,7 +38,7 @@ export class NetworkStep extends Base { this.networkStore = new NetworkStore(); this.subnetStore = new SubnetStore(); this.securityGroupStore = new SecurityGroupStore(); - this.portStore = new VirtualAdapterStore(); + this.portStore = new PortStore(); this.subnetMap = {}; } diff --git a/src/pages/container-service/containers/Containers/Detail/BaseDetail.jsx b/src/pages/container-service/containers/Containers/Detail/BaseDetail.jsx index aa3c33ad..3c9f1eda 100644 --- a/src/pages/container-service/containers/Containers/Detail/BaseDetail.jsx +++ b/src/pages/container-service/containers/Containers/Detail/BaseDetail.jsx @@ -164,7 +164,7 @@ export class BaseDetail extends Base { <> {value.length ? value.map((it) => { - const link = this.getLinkRender('virtualAdapterDetail', it, { + const link = this.getLinkRender('portDetail', it, { id: it, }); return
{link}
; diff --git a/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx b/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx index 73104e6d..72751405 100644 --- a/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx +++ b/src/pages/container-service/containers/Containers/actions/StepCreate/StepNetworks/index.jsx @@ -12,7 +12,7 @@ import React from 'react'; import { SecurityGroupStore } from 'stores/neutron/security-group'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import Base from 'components/Form'; import { inject, observer } from 'mobx-react'; import { portColumns, portFilters } from 'src/resources/neutron/port'; @@ -24,7 +24,7 @@ import { getLinkRender } from 'utils/route-map'; export class StepNetworks extends Base { init() { - this.portStore = new VirtualAdapterStore(); + this.portStore = new PortStore(); this.securityGroupStore = new SecurityGroupStore(); } diff --git a/src/pages/heat/containers/Stack/Detail/Resource.jsx b/src/pages/heat/containers/Stack/Detail/Resource.jsx index 9e2e9bea..e4e83c0e 100644 --- a/src/pages/heat/containers/Stack/Detail/Resource.jsx +++ b/src/pages/heat/containers/Stack/Detail/Resource.jsx @@ -70,7 +70,7 @@ export class Resource extends Base { }, { key: 'OS::Ironic::Port', - routeName: 'virtualAdapterDetail', + routeName: 'portDetail', }, { key: 'OS::Keystone::Domain', @@ -111,7 +111,7 @@ export class Resource extends Base { }, { key: 'OS::Neutron::Port', - routeName: 'virtualAdapterDetail', + routeName: 'portDetail', }, { key: 'OS::Neutron::QoSPolicy', diff --git a/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/Actions/CreateMember.jsx b/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/Actions/CreateMember.jsx index 8c81fe29..5976fe72 100644 --- a/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/Actions/CreateMember.jsx +++ b/src/pages/network/containers/LoadBalancers/Listener/Detail/Member/Actions/CreateMember.jsx @@ -16,7 +16,7 @@ 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 { PortStore } from 'stores/neutron/port-extension'; import { toJS } from 'mobx'; import { uniqWith, get } from 'lodash'; import globalLbaasStore from 'stores/octavia/loadbalancer'; @@ -39,7 +39,7 @@ export class CreateAction extends ModalAction { ); init() { - this.store = new VirtualAdapterStore(); + this.store = new PortStore(); this.memberStore = new PoolMemberStore(); this.lbDetail = {}; this.state = { diff --git a/src/pages/network/containers/LoadBalancers/StepCreateComponents/MemberStep/index.jsx b/src/pages/network/containers/LoadBalancers/StepCreateComponents/MemberStep/index.jsx index 4b03453c..492daf85 100644 --- a/src/pages/network/containers/LoadBalancers/StepCreateComponents/MemberStep/index.jsx +++ b/src/pages/network/containers/LoadBalancers/StepCreateComponents/MemberStep/index.jsx @@ -14,14 +14,12 @@ import { inject, observer } from 'mobx-react'; import Base from 'components/Form'; -import { PortStore } from 'stores/neutron/port'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import { get } from 'lodash'; export class MemberStep extends Base { init() { - this.store = new VirtualAdapterStore(); - this.portStore = new PortStore(); + this.store = new PortStore(); this.state = { ports: [], }; diff --git a/src/pages/network/containers/Network/Detail/index.jsx b/src/pages/network/containers/Network/Detail/index.jsx index 7deda6e6..ed0e1dbe 100644 --- a/src/pages/network/containers/Network/Detail/index.jsx +++ b/src/pages/network/containers/Network/Detail/index.jsx @@ -16,7 +16,7 @@ import { inject, observer } from 'mobx-react'; import Base from 'containers/TabDetail'; import { NetworkStore } from 'stores/neutron/network'; import { networkStatus } from 'resources/neutron/network'; -import VirtualAdapter from 'src/pages/network/containers/VirtualAdapter'; +import Port from 'src/pages/network/containers/Port'; import globalRootStore from 'stores/root'; import Subnets from './Subnets'; import Detail from './Detail'; @@ -145,7 +145,7 @@ export class NetworkDetail extends Base { { title: t('Ports'), key: 'ports', - component: VirtualAdapter, + component: Port, }, ]; return tabs; diff --git a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx b/src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx similarity index 93% rename from src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx rename to src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx index 67bb210c..c831fd61 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx +++ b/src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/CreateAllowedAddressPair.jsx @@ -14,7 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import { ipValidate } from 'utils/validate'; import { isEmpty } from 'lodash'; @@ -28,7 +28,7 @@ export class CreateAllowedAddressPair extends ModalAction { static policy = 'update_port'; init() { - this.store = globalVirtualAdapterStore; + this.store = globalPortStore; } get name() { @@ -62,12 +62,12 @@ export class CreateAllowedAddressPair extends ModalAction { ip_address, }; mac_address.type === 'manual' && (data.mac_address = mac_address.mac); - return globalVirtualAdapterStore + return globalPortStore .update(this.item, { allowed_address_pairs: [data, ...allowed_address_pairs], }) .then((ret) => { - globalVirtualAdapterStore.setDetail(ret.port); + globalPortStore.setDetail(ret.port); }); }; @@ -137,7 +137,7 @@ export class CreateAllowedAddressPair extends ModalAction { type: 'mac-address', options: [ { - label: t('VirtualAdapter Mac'), + label: t('From port'), value: 'auto', }, { diff --git a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx b/src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/Delete.jsx similarity index 90% rename from src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx rename to src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/Delete.jsx index 1ea0e5e4..61a8f534 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/Delete.jsx +++ b/src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/Delete.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; export default class DeleteAction extends ConfirmAction { get id() { @@ -57,7 +57,7 @@ export default class DeleteAction extends ConfirmAction { const newData = allowed_address_pairs.filter( (i) => i.ip_address !== data.ip_address ); - return globalVirtualAdapterStore + return globalPortStore .update( { id }, { @@ -65,7 +65,7 @@ export default class DeleteAction extends ConfirmAction { } ) .then((ret) => { - globalVirtualAdapterStore.setDetail(ret.port); + globalPortStore.setDetail(ret.port); }); }; } diff --git a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/index.jsx b/src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/index.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/actions/index.jsx rename to src/pages/network/containers/Port/Detail/AllowedAddressPair/actions/index.jsx diff --git a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/index.jsx b/src/pages/network/containers/Port/Detail/AllowedAddressPair/index.jsx similarity index 95% rename from src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/index.jsx rename to src/pages/network/containers/Port/Detail/AllowedAddressPair/index.jsx index bc9953ac..1bd4107f 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/AllowedAddressPair/index.jsx +++ b/src/pages/network/containers/Port/Detail/AllowedAddressPair/index.jsx @@ -14,13 +14,13 @@ import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import List from 'stores/base-list'; import actionConfigs from './actions'; export class AllowedAddressPair extends Base { init() { - this.store = globalVirtualAdapterStore; + this.store = globalPortStore; // because of the father component use new Store // so set detail to globalStore to share data this.store.setDetail(this.props.detail); diff --git a/src/pages/network/containers/VirtualAdapter/Detail/BaseDetail/index.jsx b/src/pages/network/containers/Port/Detail/BaseDetail/index.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/Detail/BaseDetail/index.jsx rename to src/pages/network/containers/Port/Detail/BaseDetail/index.jsx diff --git a/src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/ReleaseIP.jsx b/src/pages/network/containers/Port/Detail/FixedIPs/actions/ReleaseIP.jsx similarity index 93% rename from src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/ReleaseIP.jsx rename to src/pages/network/containers/Port/Detail/FixedIPs/actions/ReleaseIP.jsx index 11691ab8..bbef811f 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/ReleaseIP.jsx +++ b/src/pages/network/containers/Port/Detail/FixedIPs/actions/ReleaseIP.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; export default class DeleteAction extends ConfirmAction { get id() { @@ -64,7 +64,7 @@ export default class DeleteAction extends ConfirmAction { (it) => it.ip_address !== ip_address || it.subnet_id !== subnet_id ); } - return globalVirtualAdapterStore.update( + return globalPortStore.update( { id }, { fixed_ips: newFixedIps, diff --git a/src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/index.jsx b/src/pages/network/containers/Port/Detail/FixedIPs/actions/index.jsx similarity index 92% rename from src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/index.jsx rename to src/pages/network/containers/Port/Detail/FixedIPs/actions/index.jsx index 8596e26d..261f6374 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/actions/index.jsx +++ b/src/pages/network/containers/Port/Detail/FixedIPs/actions/index.jsx @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import AllocateIP from 'pages/network/containers/VirtualAdapter/actions/AllocateIP'; +import AllocateIP from 'pages/network/containers/Port/actions/AllocateIP'; import ReleaseIP from './ReleaseIP'; const actionConfigs = { diff --git a/src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/index.jsx b/src/pages/network/containers/Port/Detail/FixedIPs/index.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/Detail/FixedIPs/index.jsx rename to src/pages/network/containers/Port/Detail/FixedIPs/index.jsx diff --git a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/Detach.jsx b/src/pages/network/containers/Port/Detail/SecurityGroups/actions/Detach.jsx similarity index 90% rename from src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/Detach.jsx rename to src/pages/network/containers/Port/Detail/SecurityGroups/actions/Detach.jsx index a69a5d23..93d2ab42 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/Detach.jsx +++ b/src/pages/network/containers/Port/Detail/SecurityGroups/actions/Detach.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; export default class DetachAction extends ConfirmAction { get id() { @@ -45,6 +45,6 @@ export default class DetachAction extends ConfirmAction { const data = { security_groups: security_groups.filter((it) => it !== item.id), }; - return globalVirtualAdapterStore.update({ id }, data); + return globalPortStore.update({ id }, data); }; } diff --git a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/index.jsx b/src/pages/network/containers/Port/Detail/SecurityGroups/actions/index.jsx similarity index 72% rename from src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/index.jsx rename to src/pages/network/containers/Port/Detail/SecurityGroups/actions/index.jsx index 510ee10e..603771cd 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/actions/index.jsx +++ b/src/pages/network/containers/Port/Detail/SecurityGroups/actions/index.jsx @@ -12,18 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -import ManageSecurityGroup from 'pages/network/containers/VirtualAdapter/actions/ManageSecurityGroup'; +import ManageSecurityGroup from 'pages/network/containers/Port/actions/ManageSecurityGroup'; const actionConfigs = { - rowActions: { - // firstAction: EditAction, - // moreActions: [{ - // action: Attach, - // }], - }, - batchActions: [ - // DeleteAction, - ], + rowActions: {}, + batchActions: [], primaryActions: [ManageSecurityGroup], }; diff --git a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/index.jsx b/src/pages/network/containers/Port/Detail/SecurityGroups/index.jsx similarity index 95% rename from src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/index.jsx rename to src/pages/network/containers/Port/Detail/SecurityGroups/index.jsx index 8664f3e9..a5320d96 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/index.jsx +++ b/src/pages/network/containers/Port/Detail/SecurityGroups/index.jsx @@ -14,9 +14,9 @@ import React from 'react'; import { observer, inject } from 'mobx-react'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import { Button, Table, Collapse, Divider, Col, Row, Spin, Empty } from 'antd'; -import ManageSecurityGroup from 'pages/network/containers/VirtualAdapter/actions/ManageSecurityGroup'; +import ManageSecurityGroup from 'pages/network/containers/Port/actions/ManageSecurityGroup'; import { Link } from 'react-router-dom'; import classnames from 'classnames'; import { toJS } from 'mobx'; @@ -34,7 +34,7 @@ const { Panel } = Collapse; export class SecurityGroup extends React.Component { constructor(props) { super(props); - this.store = new VirtualAdapterStore(); + this.store = new PortStore(); } componentDidMount() { diff --git a/src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/index.less b/src/pages/network/containers/Port/Detail/SecurityGroups/index.less similarity index 100% rename from src/pages/network/containers/VirtualAdapter/Detail/SecurityGroups/index.less rename to src/pages/network/containers/Port/Detail/SecurityGroups/index.less diff --git a/src/pages/network/containers/VirtualAdapter/Detail/index.jsx b/src/pages/network/containers/Port/Detail/index.jsx similarity index 90% rename from src/pages/network/containers/VirtualAdapter/Detail/index.jsx rename to src/pages/network/containers/Port/Detail/index.jsx index 35c9a256..53dd0c48 100644 --- a/src/pages/network/containers/VirtualAdapter/Detail/index.jsx +++ b/src/pages/network/containers/Port/Detail/index.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { inject, observer } from 'mobx-react'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import Base from 'containers/TabDetail'; import { networkStatus } from 'resources/neutron/network'; import FixedIPs from './FixedIPs'; @@ -22,9 +22,9 @@ import AllowedAddressPair from './AllowedAddressPair'; import BaseDetail from './BaseDetail'; import actionConfigs from '../actions'; -export class VirtualAdapterDetail extends Base { +export class PortDetail extends Base { get name() { - return t('virtual adapter'); + return t('port'); } get policy() { @@ -32,7 +32,7 @@ export class VirtualAdapterDetail extends Base { } get listUrl() { - return this.getRoutePath('virtualAdapter'); + return this.getRoutePath('port'); } get actionConfigs() { @@ -118,8 +118,8 @@ export class VirtualAdapterDetail extends Base { } init() { - this.store = new VirtualAdapterStore(); + this.store = new PortStore(); } } -export default inject('rootStore')(observer(VirtualAdapterDetail)); +export default inject('rootStore')(observer(PortDetail)); diff --git a/src/pages/network/containers/VirtualAdapter/Detail/index.less b/src/pages/network/containers/Port/Detail/index.less similarity index 100% rename from src/pages/network/containers/VirtualAdapter/Detail/index.less rename to src/pages/network/containers/Port/Detail/index.less diff --git a/src/pages/network/containers/VirtualAdapter/actions/AllocateIP.jsx b/src/pages/network/containers/Port/actions/AllocateIP.jsx similarity index 95% rename from src/pages/network/containers/VirtualAdapter/actions/AllocateIP.jsx rename to src/pages/network/containers/Port/actions/AllocateIP.jsx index 6a62ee44..3c32b473 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/AllocateIP.jsx +++ b/src/pages/network/containers/Port/actions/AllocateIP.jsx @@ -14,7 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import { NetworkStore } from 'stores/neutron/network'; import { SubnetStore } from 'stores/neutron/subnet'; @@ -79,7 +79,7 @@ export class AllocateIP extends ModalAction { } return ret; }); - return globalVirtualAdapterStore.update(this.item, { + return globalPortStore.update(this.item, { fixed_ips: [...data, ...this.item.fixed_ips], }); }; diff --git a/src/pages/network/containers/VirtualAdapter/actions/AssociateFIP.jsx b/src/pages/network/containers/Port/actions/AssociateFIP.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/actions/AssociateFIP.jsx rename to src/pages/network/containers/Port/actions/AssociateFIP.jsx diff --git a/src/pages/network/containers/VirtualAdapter/actions/Attach.jsx b/src/pages/network/containers/Port/actions/Attach.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/actions/Attach.jsx rename to src/pages/network/containers/Port/actions/Attach.jsx diff --git a/src/pages/network/containers/VirtualAdapter/actions/Create.jsx b/src/pages/network/containers/Port/actions/Create.jsx similarity index 98% rename from src/pages/network/containers/VirtualAdapter/actions/Create.jsx rename to src/pages/network/containers/Port/actions/Create.jsx index e22192cc..d1b34cfd 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/Create.jsx +++ b/src/pages/network/containers/Port/actions/Create.jsx @@ -20,7 +20,7 @@ import { Button } from 'antd'; import { NetworkStore } from 'stores/neutron/network'; import { SecurityGroupStore } from 'stores/neutron/security-group'; import { QoSPolicyStore } from 'stores/neutron/qos-policy'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import globalProjectStore from 'stores/keystone/project'; import { SubnetStore } from 'stores/neutron/subnet'; import { getQoSPolicyTabs } from 'resources/neutron/qos-policy'; @@ -200,7 +200,7 @@ export class CreateAction extends ModalAction { (data.security_groups = security_groups.selectedRowKeys || undefined); data.project_id = this.currentProjectId; bindingProfile && (data['binding:profile'] = JSON.parse(bindingProfile)); - return globalVirtualAdapterStore.create(data); + return globalPortStore.create(data); }; get formItems() { diff --git a/src/pages/network/containers/VirtualAdapter/actions/Delete.jsx b/src/pages/network/containers/Port/actions/Delete.jsx similarity index 90% rename from src/pages/network/containers/VirtualAdapter/actions/Delete.jsx rename to src/pages/network/containers/Port/actions/Delete.jsx index 3427d651..2d092d02 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/Delete.jsx +++ b/src/pages/network/containers/Port/actions/Delete.jsx @@ -13,7 +13,7 @@ // limitations under the License. import { ConfirmAction } from 'containers/Action'; -import globalVirtualAdapter from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; export default class DeleteAction extends ConfirmAction { get id() { @@ -50,5 +50,5 @@ export default class DeleteAction extends ConfirmAction { return true; } - onSubmit = (data) => globalVirtualAdapter.delete(data); + onSubmit = (data) => globalPortStore.delete(data); } diff --git a/src/pages/network/containers/VirtualAdapter/actions/Detach.jsx b/src/pages/network/containers/Port/actions/Detach.jsx similarity index 92% rename from src/pages/network/containers/VirtualAdapter/actions/Detach.jsx rename to src/pages/network/containers/Port/actions/Detach.jsx index 506508f1..472dd92f 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/Detach.jsx +++ b/src/pages/network/containers/Port/actions/Detach.jsx @@ -38,7 +38,8 @@ export default class Detach extends ConfirmAction { policy = 'os_compute_api:os-attach-interfaces:delete'; - allowedCheckFunc = (item) => !!item.device_id; + allowedCheckFunc = (item) => + !!item.device_id && item.device_owner === 'compute:nova'; onSubmit = async () => { const { id, device_id } = this.item; diff --git a/src/pages/network/containers/VirtualAdapter/actions/DisAssociateFIP.jsx b/src/pages/network/containers/Port/actions/DisAssociateFIP.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/actions/DisAssociateFIP.jsx rename to src/pages/network/containers/Port/actions/DisAssociateFIP.jsx diff --git a/src/pages/network/containers/VirtualAdapter/actions/Edit.jsx b/src/pages/network/containers/Port/actions/Edit.jsx similarity index 95% rename from src/pages/network/containers/VirtualAdapter/actions/Edit.jsx rename to src/pages/network/containers/Port/actions/Edit.jsx index 4690d850..5585a8cf 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/Edit.jsx +++ b/src/pages/network/containers/Port/actions/Edit.jsx @@ -14,7 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; const portTypes = 'normal,macvtap,direct,baremetal,direct-physical,virtio-forwarder,smart-nic'; @@ -60,7 +60,7 @@ export class Edit extends ModalAction { if (type && type !== 'auto') { data.mac_address = mac; } - return globalVirtualAdapterStore.update({ id }, data); + return globalPortStore.update({ id }, data); }; get formItems() { diff --git a/src/pages/network/containers/VirtualAdapter/actions/ManageSecurityGroup.jsx b/src/pages/network/containers/Port/actions/ManageSecurityGroup.jsx similarity index 96% rename from src/pages/network/containers/VirtualAdapter/actions/ManageSecurityGroup.jsx rename to src/pages/network/containers/Port/actions/ManageSecurityGroup.jsx index 80e2cbf0..9d16cfa5 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/ManageSecurityGroup.jsx +++ b/src/pages/network/containers/Port/actions/ManageSecurityGroup.jsx @@ -14,7 +14,7 @@ import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import { SecurityGroupStore } from 'stores/neutron/security-group'; import { securityGroupColumns, @@ -74,7 +74,7 @@ export class ManageSecurityGroup extends ModalAction { const { id, security_groups, port_security_enabled } = this.item; let sgs = security_groups; if (!security_groups) { - const detail = await globalVirtualAdapterStore.fetchDetail({ id }); + const detail = await globalPortStore.fetchDetail({ id }); sgs = detail.security_groups; } const results = await Promise.all( diff --git a/src/pages/network/containers/VirtualAdapter/actions/ModifyQoS.jsx b/src/pages/network/containers/Port/actions/ModifyQoS.jsx similarity index 96% rename from src/pages/network/containers/VirtualAdapter/actions/ModifyQoS.jsx rename to src/pages/network/containers/Port/actions/ModifyQoS.jsx index f7935b3f..c091658e 100644 --- a/src/pages/network/containers/VirtualAdapter/actions/ModifyQoS.jsx +++ b/src/pages/network/containers/Port/actions/ModifyQoS.jsx @@ -16,7 +16,7 @@ import React from 'react'; import { inject, observer } from 'mobx-react'; import { ModalAction } from 'containers/Action'; import { QoSPolicyStore } from 'stores/neutron/qos-policy'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import { getQoSPolicyTabs } from 'resources/neutron/qos-policy'; import { qosEndpoint } from 'client/client/constants'; @@ -103,7 +103,7 @@ export class ModifyQoS extends ModalAction { ? null : qos_policy_id.selectedRowKeys[0]); } - return globalVirtualAdapterStore.update({ id }, data); + return globalPortStore.update({ id }, data); }; get formItems() { diff --git a/src/pages/network/containers/VirtualAdapter/actions/index.jsx b/src/pages/network/containers/Port/actions/index.jsx similarity index 100% rename from src/pages/network/containers/VirtualAdapter/actions/index.jsx rename to src/pages/network/containers/Port/actions/index.jsx diff --git a/src/pages/network/containers/VirtualAdapter/index.jsx b/src/pages/network/containers/Port/index.jsx similarity index 63% rename from src/pages/network/containers/VirtualAdapter/index.jsx rename to src/pages/network/containers/Port/index.jsx index ea482571..858314e8 100644 --- a/src/pages/network/containers/VirtualAdapter/index.jsx +++ b/src/pages/network/containers/Port/index.jsx @@ -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. @@ -15,15 +15,15 @@ import React from 'react'; import { observer, inject } from 'mobx-react'; import Base from 'containers/List'; -import { VirtualAdapterStore } from 'stores/neutron/virtual-adapter'; +import { PortStore } from 'stores/neutron/port-extension'; import { portStatus } from 'resources/neutron/port'; import { emptyActionConfig } from 'utils/constants'; import actionConfigs from './actions'; -export class VirtualAdapter extends Base { +export class Port extends Base { init() { - this.store = new VirtualAdapterStore(); - this.downloadStore = new VirtualAdapterStore(); + this.store = new PortStore(); + this.downloadStore = new PortStore(); } get isInstanceDetail() { @@ -61,8 +61,6 @@ export class VirtualAdapter extends Base { newParams.device_id = id; } else if (this.isNetworkDetail) { newParams.network_id = id; - } else { - newParams.device_owner = ['compute:nova', '']; } return newParams; }; @@ -72,7 +70,7 @@ export class VirtualAdapter extends Base { } get name() { - return t('virtual adapters'); + return t('ports'); } get adminPageHasProjectFilter() { @@ -99,16 +97,56 @@ export class VirtualAdapter extends Base { return actionConfigs.actionConfigs; } - // get hideCustom () { - // return true; - // } + renderResource = (serverName, item) => { + const { device_id, device_owner } = item; + if (!device_owner) { + return device_id || '-'; + } + let value = device_id; + let link = null; + if (device_owner === 'compute:nova') { + value = serverName ? `${device_id} (${serverName})` : device_id; + link = this.getLinkRender( + 'instanceDetail', + value, + { id: device_id }, + { tab: 'interface' } + ); + } else if ( + [ + 'network:router_interface', + 'network:ha_router_replicated_interface', + 'network:router_ha_interface', + ].includes(device_owner) + ) { + link = this.getLinkRender('routerDetail', value, { id: device_id }); + } else if (device_owner === 'network:floatingip') { + link = this.getLinkRender('fipDetail', value, { id: device_id }); + } + if (link) { + return ( + <> + {device_owner} +
+ {link} + + ); + } + return ( + <> + {device_owner} +
+ {device_id || '-'} + + ); + }; getColumns = () => { const columns = [ { title: t('ID/Name'), dataIndex: 'name', - routeName: this.getRouteName('virtualAdapterDetail'), + routeName: this.getRouteName('portDetail'), }, { title: t('Project ID/Name'), @@ -120,43 +158,17 @@ export class VirtualAdapter extends Base { { title: t('Bind Resource'), dataIndex: 'server_name', - stringify: (server_name, item) => { - if (item.device_id && item.device_owner === 'compute:nova') { - return `${item.device_owner} \n ${item.device_id} (${server_name})`; + stringify: (serverName, item) => { + const { device_id, device_owner } = item; + if (device_id && device_owner === 'compute:nova' && serverName) { + return `${device_owner} \n ${device_id} (${serverName})`; } return ` - ${item.device_owner} ${item.device_owner && `\n`} - ${item.device_id || '-'} + ${device_owner} ${device_owner && `\n`} + ${device_id || '-'} `; }, - render: (server_name, item) => { - const { device_id, device_owner } = item; - if (device_id && device_owner === 'compute:nova') { - const value = server_name - ? `${device_id} (${server_name})` - : device_id; - const link = this.getLinkRender( - 'instanceDetail', - value, - { id: item.device_id }, - { tab: 'interface' } - ); - return ( - <> - {item.device_owner} -
- {link} - - ); - } - return ( - <> - {item.device_owner} - {item.device_owner &&
} - {item.device_id || '-'} - - ); - }, + render: this.renderResource, isHideable: true, sorter: false, }, @@ -228,8 +240,38 @@ export class VirtualAdapter extends Base { name: 'network_name', }); } + const deviceOwner = { + label: t('Device Owner'), + name: 'device_owner', + options: [ + { + label: t('Instance'), + key: 'compute:nova', + checkLabel: t('View virtual adapters'), + isQuick: true, + }, + { + label: t('Router'), + key: 'network:router_ha_interface,network:ha_router_replicated_interface,network:router_interface,network:router_gateway,network:router_interface_distributed,network:router_centralized_snat', + }, + { + label: t('Floating IP'), + key: 'network:floatingip,network:floatingip_agent_gateway,', + }, + { label: t('DHCP Agent'), key: 'network:dhcp' }, + { + label: t('Others'), + key: 'network:local_ip,network:routed,network:distributed', + }, + { + label: t('Unbounded'), + key: 'none', + }, + ], + }; + ret.push(deviceOwner); return ret; } } -export default inject('rootStore')(observer(VirtualAdapter)); +export default inject('rootStore')(observer(Port)); diff --git a/src/pages/network/routes/index.js b/src/pages/network/routes/index.js index 8408bc8e..ec3b37d7 100644 --- a/src/pages/network/routes/index.js +++ b/src/pages/network/routes/index.js @@ -22,9 +22,9 @@ import FloatingIp from '../containers/FloatingIp'; import FloatingIpDetail from '../containers/FloatingIp/Detail'; import Topology from '../containers/Topology'; import RouterDetail from '../containers/Router/Detail'; -import PortDetail from '../containers/Router/Port/Detail'; -import VirtualAdapter from '../containers/VirtualAdapter'; -import VirtualAdapterDetail from '../containers/VirtualAdapter/Detail'; +import RouterPortDetail from '../containers/Router/Port/Detail'; +import Port from '../containers/Port'; +import PortDetail from '../containers/Port/Detail'; import QoSPolicy from '../containers/QoSPolicy'; import AdminQoSPolicy from '../containers/QoSPolicy/QoSPolicy'; import QoSPolicyDetail from '../containers/QoSPolicy/Detail'; @@ -72,12 +72,12 @@ export default [ }, { path: `${PATH}/router/:routerId/port/:id`, - component: PortDetail, + component: RouterPortDetail, exact: true, }, { path: `${PATH}/router-admin/:routerId/port/:id`, - component: PortDetail, + component: RouterPortDetail, exact: true, }, { path: `${PATH}/floatingip`, component: FloatingIp, exact: true }, @@ -93,23 +93,23 @@ export default [ exact: true, }, { - path: `${PATH}/virtual_adapter`, - component: VirtualAdapter, + path: `${PATH}/port`, + component: Port, exact: true, }, { - path: `${PATH}/virtual_adapter_admin`, - component: VirtualAdapter, + path: `${PATH}/port-admin`, + component: Port, exact: true, }, { - path: `${PATH}/virtual_adapter/detail/:id`, - component: VirtualAdapterDetail, + path: `${PATH}/port/detail/:id`, + component: PortDetail, exact: true, }, { - path: `${PATH}/virtual_adapter_admin/detail/:id`, - component: VirtualAdapterDetail, + path: `${PATH}/port-admin/detail/:id`, + component: PortDetail, exact: true, }, { path: `${PATH}/qos-policy`, component: QoSPolicy, exact: true }, diff --git a/src/resources/neutron/port.jsx b/src/resources/neutron/port.jsx index 6541b3e7..06199f31 100644 --- a/src/resources/neutron/port.jsx +++ b/src/resources/neutron/port.jsx @@ -112,7 +112,7 @@ export function getPortFormItem(device_owner) { { title: t('ID/Name'), dataIndex: 'name', - routeName: this.getRouteName('virtualAdapterDetail'), + routeName: this.getRouteName('portDetail'), }, { title: t('Description'), diff --git a/src/stores/index.jsx b/src/stores/index.jsx index f1134dd6..f83a2d8d 100644 --- a/src/stores/index.jsx +++ b/src/stores/index.jsx @@ -12,7 +12,7 @@ import globalServerGroupStore from 'stores/nova/server-group'; import globalSnapshotStore from 'stores/cinder/snapshot'; import globalStaticRouteStore from 'stores/neutron/static-route'; import globalSubnetStore from 'stores/neutron/subnet'; -import globalVirtualAdapterStore from 'stores/neutron/virtual-adapter'; +import globalPortStore from 'stores/neutron/port-extension'; import globalVolumeStore from 'stores/cinder/volume'; import globalComputeHostStore from 'stores/nova/compute-host'; import globalHypervisorStore from 'stores/nova/hypervisor'; @@ -33,9 +33,9 @@ export default { globalSnapshotStore, globalStaticRouteStore, globalSubnetStore, - globalVirtualAdapterStore, globalVolumeStore, globalComputeHostStore, globalHypervisorStore, globalStackStore, + globalPortStore, }; diff --git a/src/stores/neutron/virtual-adapter.js b/src/stores/neutron/port-extension.js similarity index 85% rename from src/stores/neutron/virtual-adapter.js rename to src/stores/neutron/port-extension.js index 068c9dc2..d14ae12e 100644 --- a/src/stores/neutron/virtual-adapter.js +++ b/src/stores/neutron/port-extension.js @@ -19,8 +19,9 @@ import globalFloatingIpsStore from 'stores/neutron/floatingIp'; import client from 'client'; import List from 'stores/base-list'; import Base from 'stores/base'; +import { isString } from 'lodash'; -export class VirtualAdapterStore extends Base { +export class PortStore extends Base { get client() { return client.neutron.ports; } @@ -40,6 +41,24 @@ export class VirtualAdapterStore extends Base { } }; + get paramsFuncPage() { + return (params, all_projects) => { + const { current, device_owner, ...rest } = params; + const newParams = { ...rest }; + if (device_owner && isString(device_owner)) { + if (device_owner === 'none') { + newParams.device_owner = ['']; + } else { + newParams.device_owner = device_owner.split(','); + } + } + if (!all_projects) { + newParams.tenant_id = this.currentProjectId; + } + return newParams; + }; + } + @observable fixed_ips = new List(); @@ -133,6 +152,6 @@ export class VirtualAdapterStore extends Base { } } -const globalVirtualAdapterStore = new VirtualAdapterStore(); +const globalPortStore = new PortStore(); -export default globalVirtualAdapterStore; +export default globalPortStore; diff --git a/test/e2e/config/config-network.yaml b/test/e2e/config/config-network.yaml index c535e531..1dcce3df 100644 --- a/test/e2e/config/config-network.yaml +++ b/test/e2e/config/config-network.yaml @@ -21,7 +21,7 @@ testFiles: # network - pages/network/router.spec.js - pages/network/network.spec.js - - pages/network/virtual-adapter.spec.js + - pages/network/port.spec.js - pages/network/qos-policy.spec.js - pages/network/floatingip.spec.js - pages/network/security-group.spec.js diff --git a/test/e2e/config/config.yaml b/test/e2e/config/config.yaml index d6512901..35fbcc36 100644 --- a/test/e2e/config/config.yaml +++ b/test/e2e/config/config.yaml @@ -43,7 +43,7 @@ testFiles: # network - pages/network/router.spec.js - pages/network/network.spec.js - - pages/network/virtual-adapter.spec.js + - pages/network/port.spec.js - pages/network/qos-policy.spec.js - pages/network/floatingip.spec.js - pages/network/security-group.spec.js diff --git a/test/e2e/integration/pages/network/virtual-adapter.spec.js b/test/e2e/integration/pages/network/port.spec.js similarity index 91% rename from test/e2e/integration/pages/network/virtual-adapter.spec.js rename to test/e2e/integration/pages/network/port.spec.js index a99f5530..f329116d 100644 --- a/test/e2e/integration/pages/network/virtual-adapter.spec.js +++ b/test/e2e/integration/pages/network/port.spec.js @@ -13,18 +13,18 @@ // limitations under the License. import { onlyOn } from '@cypress/skip-test'; -import { virtualAdapterListUrl } from '../../../support/constants'; +import { portListUrl } from '../../../support/constants'; -describe('The Virtual Adapter Page', () => { - const listUrl = virtualAdapterListUrl; +describe('The Port Page', () => { + const listUrl = portListUrl; const uuid = Cypress._.random(0, 1e6); - const name = `e2e-virtual-adapter-${uuid}`; + const name = `e2e-port-${uuid}`; const newname = `${name}-1`; - const securityGroupName = `e2e-sg-for-virtual-adapter-${uuid}`; - const policyName = `e2e-policy-for-virtual-adapter-${uuid}`; - const networkName = `e2e-network-for-virtual-adapter-${uuid}`; - const instanceName = `e2e-instance-for-virtual-adapter-${uuid}`; - const routerName = `e2e-router-for-virtual-adapter-${uuid}`; + const securityGroupName = `e2e-sg-for-port-${uuid}`; + const policyName = `e2e-policy-for-port-${uuid}`; + const networkName = `e2e-network-for-port-${uuid}`; + const instanceName = `e2e-instance-for-port-${uuid}`; + const routerName = `e2e-router-for-port-${uuid}`; const qosServiceEnabled = (Cypress.env('extensions') || []).includes( 'neutron::qos' ); diff --git a/test/e2e/support/constants.js b/test/e2e/support/constants.js index 4988f66e..31b7b6fb 100644 --- a/test/e2e/support/constants.js +++ b/test/e2e/support/constants.js @@ -36,7 +36,7 @@ export const networkListUrl = '/network/networks'; export const routerListUrl = '/network/router'; export const policyListUrl = '/network/qos-policy-admin'; export const fipListUrl = '/network/floatingip'; -export const virtualAdapterListUrl = '/network/virtual_adapter'; +export const portListUrl = '/network/port'; export const vpnListUrl = '/network/vpn'; export const lbListUrl = '/network/load-balancers'; export const topologyUrl = '/network/topo'; @@ -85,7 +85,7 @@ export default { router: routerListUrl, networkQosPolicy: policyListUrl, fip: fipListUrl, - virtualAdapter: virtualAdapterListUrl, + port: portListUrl, // security securityGroup: securityGroupListUrl,